From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 17:05:25 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6370106564A; Sun, 1 Jan 2012 17:05:25 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 753808FC12; Sun, 1 Jan 2012 17:05:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01H5P7n021737; Sun, 1 Jan 2012 17:05:25 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01H5Pig021735; Sun, 1 Jan 2012 17:05:25 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201011705.q01H5Pig021735@svn.freebsd.org> From: Rick Macklem Date: Sun, 1 Jan 2012 17:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229173 - in stable/8/sys: conf fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 17:05:25 -0000 Author: rmacklem Date: Sun Jan 1 17:05:24 2012 New Revision: 229173 URL: http://svn.freebsd.org/changeset/base/229173 Log: MFC: r227493 Move the assignment of default values for some mount options to before the nfs_decode_args() call in the new NFS client, so they don't overwrite the value specified on the command line. Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 1 16:41:33 2012 (r229172) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 1 17:05:24 2012 (r229173) @@ -1208,7 +1208,16 @@ mountnfs(struct nfs_args *argp, struct m vfs_getnewfsid(mp); nmp->nm_mountp = mp; mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); + + /* + * Since nfs_decode_args() might optionally set them, these need to + * set to defaults before the call, so that the optional settings + * aren't overwritten. + */ nmp->nm_negnametimeo = negnametimeo; + nmp->nm_timeo = NFS_TIMEO; + nmp->nm_retry = NFS_RETRANS; + nmp->nm_readahead = NFS_DEFRAHEAD; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1227,8 +1236,6 @@ mountnfs(struct nfs_args *argp, struct m else nmp->nm_maxfilesize = OFF_MAX; - nmp->nm_timeo = NFS_TIMEO; - nmp->nm_retry = NFS_RETRANS; if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) { nmp->nm_wsize = NFS_WSIZE; nmp->nm_rsize = NFS_RSIZE; @@ -1236,7 +1243,6 @@ mountnfs(struct nfs_args *argp, struct m } nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); nmp->nm_numgrps = NFS_MAXGRPS; - nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) nmp->nm_tprintf_delay = 0; From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 18:59:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05E9C106566B; Sun, 1 Jan 2012 18:59:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E45E38FC15; Sun, 1 Jan 2012 18:59:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01IxZld025982; Sun, 1 Jan 2012 18:59:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IxZSM025979; Sun, 1 Jan 2012 18:59:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011859.q01IxZSM025979@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 18:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229187 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 18:59:36 -0000 Author: kib Date: Sun Jan 1 18:59:35 2012 New Revision: 229187 URL: http://svn.freebsd.org/changeset/base/229187 Log: MFC r227394: Stopped process may legitimately have some threads sleeping and not suspended, if the sleep is uninterruptible. MFC r227442: Weaken the part of assertions added in the r227394. Only check that the process state is stopped. Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Sun Jan 1 18:54:29 2012 (r229186) +++ stable/8/sys/amd64/amd64/machdep.c Sun Jan 1 18:59:35 2012 (r229187) @@ -1986,7 +1986,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); fpugetregs(td); fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs); Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Sun Jan 1 18:54:29 2012 (r229186) +++ stable/8/sys/i386/i386/machdep.c Sun Jan 1 18:59:35 2012 (r229187) @@ -3220,7 +3220,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); #ifdef DEV_NPX npxgetregs(td); From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 19:12:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFA641065670; Sun, 1 Jan 2012 19:12:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9A208FC0C; Sun, 1 Jan 2012 19:12:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01JC72Y026567; Sun, 1 Jan 2012 19:12:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01JC778026565; Sun, 1 Jan 2012 19:12:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011912.q01JC778026565@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 19:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229191 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 19:12:07 -0000 Author: kib Date: Sun Jan 1 19:12:07 2012 New Revision: 229191 URL: http://svn.freebsd.org/changeset/base/229191 Log: MFC r227529: Remove the condition that is always true. Modified: stable/8/sys/vm/vm_pager.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/vm/vm_pager.c ============================================================================== --- stable/8/sys/vm/vm_pager.c Sun Jan 1 19:11:47 2012 (r229190) +++ stable/8/sys/vm/vm_pager.c Sun Jan 1 19:12:07 2012 (r229191) @@ -190,7 +190,7 @@ vm_pager_init() * Initialize known pagers */ for (pgops = pagertab; pgops < &pagertab[npagers]; pgops++) - if (pgops && ((*pgops)->pgo_init != NULL)) + if ((*pgops)->pgo_init != NULL) (*(*pgops)->pgo_init) (); } From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 22:33:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2C44106564A; Sun, 1 Jan 2012 22:33:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A46A8FC1A; Sun, 1 Jan 2012 22:33:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01MXVLv034395; Sun, 1 Jan 2012 22:33:31 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MXUic034392; Sun, 1 Jan 2012 22:33:30 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201012233.q01MXUic034392@svn.freebsd.org> From: Doug Barton Date: Sun, 1 Jan 2012 22:33:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229223 - stable/8/games/fortune/datfiles X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 22:33:31 -0000 Author: dougb Date: Sun Jan 1 22:33:29 2012 New Revision: 229223 URL: http://svn.freebsd.org/changeset/base/229223 Log: MFC r228909: 1. Remove a bunch of duplicates. Usually this means removing them from fortunes, but occasionally remove them from the other 2 files when they are not offensive, or not murphy'ish enough. Where the version in fortunes had better attribution and/or formatting, copy it over. 2. Fix a few typos 3. Use the full name of François De La Rochefoucauld, fix one of his quotes, and remove the duplicate of it. MFC r228934: Prefer ASCII apostrophes over Unicode ones like the rest of the file. MFC r228938: 1. Correct capitalization of the nobility particle for Francois de La Rochefoucauld introduced in r228909 2. Change c-cedilla introduced in the same commit to ASCII c since non-UTF-8 terminals will choke on the non-ASCII text. Modified: stable/8/games/fortune/datfiles/fortunes stable/8/games/fortune/datfiles/fortunes-o.real stable/8/games/fortune/datfiles/murphy Directory Properties: stable/8/games/fortune/ (props changed) Modified: stable/8/games/fortune/datfiles/fortunes ============================================================================== --- stable/8/games/fortune/datfiles/fortunes Sun Jan 1 22:33:02 2012 (r229222) +++ stable/8/games/fortune/datfiles/fortunes Sun Jan 1 22:33:29 2012 (r229223) @@ -773,40 +773,6 @@ the female, autopsied her, and sure enou "What do you think?" said the first ranger. "The Czech is in the male," replied the second. % - A group of soldiers being prepared for a practice landing on a tropical -island were warned of the one danger the island held, a poisonous snake that -could be readily identified by its alternating orange and black bands. They -were instructed, should they find one of these snakes, to grab the tail end of -the snake with one hand and slide the other hand up the body of the snake to -the snake's head. Then, forcefully, bend the thumb above the snake's head -downward to break the snake's spine. All went well for the landing, the -charge up the beach, and the move into the jungle. At one foxhole site, two -men were starting to dig and wondering what had happened to their partner. -Suddenly he staggered out of the underbrush, uniform in shreds, covered with -blood. He collapsed to the ground. His buddies were so shocked they could -only blurt out, "What happened?" - "I ran from the beachhead to the edge of the jungle, and, as I hit the -ground, I saw an orange and black striped snake right in front of me. I -grabbed its tail end with my left hand. I placed my right hand above my left -hand. I held firmly with my left hand and slid my right hand up the body of -the snake. When I reached the head of the snake I flicked my right thumb down -to break the snake's spine... did you ever goose a tiger?" -% - A guy returns from a long trip to Europe, having left his beloved -dog in his brother's care. The minute he's cleared customs, he calls up his -brother and inquires after his pet. - "Your dog's dead," replies his brother bluntly. - The guy is devastated. "You know how much that dog meant to me," -he moaned into the phone. "Couldn't you at least have thought of a nicer way -of breaking the news? Couldn't you have said, `Well, you know, the dog got -outside one day, and was crossing the street, and a car was speeding around a -corner...' or something...? Why are you always so thoughtless?" - "Look, I'm sorry," said his brother, "I guess I just didn't think." - "Okay, okay, let's just put it behind us. How are you anyway? -How's Mom?" - His brother is silent a moment. "Uh," he stammers, "uh... Mom got -outside one day..." -% A hard-luck actor who appeared in one colossal disaster after another finally got a break, a broken leg to be exact. Someone pointed out that it's the first time the poor fellow's been in the same cast for more than a week. @@ -1137,12 +1103,6 @@ went out to be killed? The Pole pulls a bottle of vodka from the other side of his jacket. He smiles and replies, "Five men on one bottle -- too many." % - A priest was walking along the cliffs at Dover when he came upon -two locals pulling another man ashore on the end of a rope. "That's what -I like to see", said the priest, "A man helping his fellow man". - As he was walking away, one local remarked to the other, "Well, -he sure doesn't know the first thing about shark fishing." -% A program should be light and agile, its subroutines connected like a strings of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little nor too much, neither needless @@ -1361,16 +1321,6 @@ realize the full significance of Pharoah -- Grendel Briarton "Through Time & Space With Ferdinand Feghoot!" % - After watching an extremely attractive maternity-ward patient -earnestly thumbing her way through a telephone directory for several -minutes, a hospital orderly finally asked if he could be of some help. - "No, thanks," smiled the young mother, "I'm just looking for a -name for my baby." - "But the hospital supplies a special booklet that lists hundreds -of first names and their meanings," said the orderly. - "That won't help," said the woman, "my baby already has a first -name." -% All I really need to know about how to live and what to do and how to be I learned in kindergarten. Wisdom was not at the top of the graduate-school mountain, but there in the sandpile at Sunday School. @@ -1470,26 +1420,6 @@ the ideas and frills that were cautiousl The result, as Ovid says, is a "big pile". -- Frederick Brooks, Jr., "The Mythical Man-Month" % - An eighty-year-old woman is rocking away the afternoon on her -porch when she sees an old, tarnished lamp sitting near the steps. She -picks it up, rubs it gently, and lo and behold a genie appears! The genie -tells the woman the he will grant her any three wishes her heart desires. - After a bit of thought, she says, "I wish I were young and -beautiful!" And POOF! In a cloud of smoke she becomes a young, beautiful, -voluptuous woman. - After a little more thought, she says, "I would like to be rich -for the rest of my life." And POOF! When the smoke clears, there are -stacks and stacks of money lying on the porch. - The genie then says, "Now, madam, what is your final wish?" - "Well," says the woman, "I would like for you to transform my -faithful old cat, whom I have loved dearly for fifteen years, into a young -handsome prince!" - And with another billow of smoke the cat is changed into a tall, -handsome, young man, with dark hair, dressed in a dashing uniform. - As they gaze at each other in adoration, the prince leans over to -the woman and whispers into her ear, "Now, aren't you sorry you had me -fixed?" -% An elderly man stands in line for hours at a Warsaw meat store (meat is severely rationed). When the butcher comes out at the end of the day and announces that there is no meat left, the man flies into a rage. @@ -1552,14 +1482,6 @@ young welp with a masochistic streak who up-and-down bureaucracy in the history of mankind." -- R. L. Forward, "Flight of the Dragonfly" % - "Anything else, sir?" asked the attentive bellhop, trying his best -to make the lady and gentleman comfortable in their penthouse suite in the -posh hotel. - "No. No, thank you," replied the gentleman. - "Anything for your wife, sir?" the bellhop asked. - "Why, yes, young man," said the gentleman. "Would you bring me -a postcard?" -% "Anything else you wish to draw to my attention, Mr. Holmes ?" "The curious incident of the stable dog in the nighttime." "But the dog did nothing in the nighttime." @@ -1932,52 +1854,16 @@ said the Duck: "it's generally a frog or The question is, what did the archbishop find?" % - Four Oxford dons were taking their evening walk together and as -usual, were engaged in casual but learned conversation. On this particular -evening, their conversation was about the names given to groups of animals, -such as a "pride of lions" or a "gaggle of geese." - One of the professors noticed a group of prostitutes down the block, -and posed the question, "What name would be given to that group?" The four -fell into silence for a moment, as they pondered the possibilities... - At last, one spoke: "How about `a Jam of Tarts'?" The others nodded -in acknowledgment as they continued to consider the problem. A second -professor spoke: "I'd suggest `an Essay of Trollops.'" Again, the others -nodded. A third spoke: "I propose `a Flourish of Strumpets.'" - They continued their walk in silence, until the first professor -remarked to the remaining professor, who was the most senior and learned of -the four, "You haven't suggested a name for our ladies. What are your -thoughts?" - Replied the fourth professor, "`An Anthology of Prose.'" -% Fred noticed his roommate had a black eye upon returning from a dance. "What happened?" "I was struck by the beauty of the place." % - Friends were surprised, indeed, when Frank and Jennifer broke their -engagement, but Frank had a ready explanation: "Would you marry someone who -was habitually unfaithful, who lied at every turn, who was selfish and lazy -and sarcastic?" - "Of course not," said a sympathetic friend. - "Well," retorted Frank, "neither would Jennifer." -% "Gee, Mudhead, everyone at Morse Science High has an extracurricular activity except you." "Well, gee, doesn't Louise count?" "Only to ten, Mudhead." -- The Firesign Theatre % - "Gentlemen of the jury," said the defense attorney, now beginning -to warm to his summation, "the real question here before you is, shall this -beautiful young woman be forced to languish away her loveliest years in a -dark prison cell? Or shall she be set free to return to her cozy little -apartment at 4134 Mountain Ave. -- there to spend her lonely, loveless hours -in her boudoir, lying beside her little Princess phone, 962-7873?" -% - God decided to take the devil to court and settle their -differences once and for all. - When Satan heard of this, he grinned and said, "And just -where do you think you're going to find a lawyer?" -% Graduating seniors, parents and friends... Let me begin by reassuring you that my remarks today will stand up to the most stringent requirements of the new appropriateness. @@ -2050,33 +1936,6 @@ for it is complete within itself. It ex Software and Hardware, ashamed, returned to their homes. -- Geoffrey James, "The Tao of Programming" % - Harry, a golfing enthusiast if there ever was one, arrived home -from the club to an irate, ranting wife. - "I'm leaving you, Harry," his wife announced bitterly. "You -promised me faithfully that you'd be back before six and here it is almost -nine. It just can't take that long to play 18 holes of golf." - "Honey, wait," said Harry. "Let me explain. I know what I promised -you, but I have a very good reason for being late. Fred and I tee'd off -right on time and everything was fine for the first three holes. Then, on -the fourth tee Fred had a stroke. I ran back to the clubhouse but couldn't -find a doctor. And, by the time I got back to Fred, he was dead. So, for -the next 15 holes, it was hit the ball, drag Fred, hit the ball, drag Fred... -% - Harry constantly irritated his friends with his eternal optimism. -No matter how bad the situation, he would always say, "Well, it could have -been worse." - To cure him of his annoying habit, his friends decided to invent a -situation so completely black, so dreadful, that even Harry could find no -hope in it. Approaching him at the club bar one day, one of them said, -"Harry! Did you hear what happened to George? He came home last night, -found his wife in bed with another man, shot them both, and then turned -the gun on himself!" - "Terrible," said Harry. "But it could have been worse." - "How in hell," demanded his dumbfounded friend, "could it possibly -have been worse?" - "Well," said Harry, "if it had happened the night before, I'd be -dead right now." -% "Has anyone had problems with the computer accounts?" "Yes; I don't have one." "Okay, you can send mail to one of the tutors..." @@ -2112,13 +1971,6 @@ lessening mine; as he who lights his tap without darkening me. -- Thomas Jefferson on patents on ideas % - "Heard you were moving your piano, so I came over to help." - "Thanks. Got it upstairs already." - "Do it alone?" - "Nope. Hitched the cat to it." - "How would that help?" - "Used a whip." -% "Hey, Sam, how about a loan?" "Whattaya need?" "Oh, about $500." @@ -2182,11 +2034,6 @@ could forget that, to within half a perc social climber said to her roommate. "I mean, I've never seen a Porsche full of money before." % - "How'd you get that flat?" - "Ran over a bottle." - "Didn't you see it?" - "Damn kid had it under his coat." -% Human thinking can skip over a great deal, leap over small misunderstandings, can contain ifs and buts in untroubled corners of the mind. But the machine has no corners. Despite all the attempts to @@ -2199,11 +2046,6 @@ line by code line, the programmer confro The ways of human and machine understanding are disjunct. -- Ellen Ullman, "Close to the Machine" % - "I believe you have the wrong number," said the old gentleman into -the phone. "You'll have to call the weather bureau for that information." - "Who was that?" his young wife asked. - "Some guy wanting to know if the coast was clear." -% "I cannot read the fiery letters," said Frito Bugger in a quavering voice. "No," said GoodGulf, "but I can. The letters are Elvish, of @@ -2496,11 +2338,6 @@ it gets so bad you can't handle it alone would destroy the whole point of it." -- Thomas Pynchon, "The Crying of Lot 49" % - "I'm looking for adventure, excitement, beautiful women," cried the -young man to his father as he prepared to leave home. "Don't try to stop me. -I'm on my way." - "Who's trying to stop you?" shouted the father. "Take me along!" -% I'm sure that VMS is completely documented, I just haven't found the right manual yet. I've been working my way through the manuals in the document library and I'm half way through the second cabinet, (3 shelves to go), so I @@ -2558,20 +2395,6 @@ pie-bakers and pie-dividers is way out o been an efficiency expert? -- Motor Trend, May 1983 % - In the beginning, God created the Earth and he said, "Let there be -mud." - And there was mud. - And God said, "Let Us make living creatures out of mud, so the mud -can see what we have done." - And God created every living creature that now moveth, and one was -man. Mud-as-man alone could speak. - "What is the purpose of all this?" man asked politely. - "Everything must have a purpose?" asked God. - "Certainly," said man. - "Then I leave it to you to think of one for all of this," said God. - And He went away. - -- Kurt Vonnegut, Jr., "Between Time and Timbuktu" -% In the beginning there was data. The data was without form and null, and darkness was upon the face of the console; and the Spirit of IBM was moving over the face of the market. And DEC said, "Let there @@ -2926,11 +2749,6 @@ Church soon made its peace with Galileo' earth really does revolve about the sun. -- S. J. Gould, "The Mismeasure of Man" % - "My mother," said the sweet young steno, "says there are some things -a girl should not do before twenty." - "Your mother is right," said the executive, "I don't like a large -audience, either." -% NEW YORK -- Kraft Foods, Inc. announced today that its board of directors unanimously rejected the $11 billion takeover bid by Philip Morris and Co. A Kraft spokesman stated in a press conference that the @@ -3727,14 +3545,6 @@ was solidly entrenched in the market, an improve ... -- Dave Barry, "In Search of Excellence" % - "That wife of mine is a liar," said the angry husband to a -sympathetic pal seated next to him in a bar. - "How do you know?" the friend asked. - "She didn't come home last night, and when I asked her where -she'd been she said she'd spent the night with her sister Shirley." - "So?" - "So, she's a liar. I spent the night with her sister Shirley." -% "That's right; the upper-case shift works fine on the screen, but they're not coming out on the damn printer... Hold? Sure, I'll hold." -- e. e. cummings last service call @@ -3768,13 +3578,6 @@ laughed uproariously. "What's the matte got a sense of humor?" "I don't have to laugh," she said. "I'm leaving Friday anyway. % - The doctor had just finished giving the young man a thorough -physical examination. "The best thing for you to do," the M.D. said, -"is give up drinking, give up smoking, get to bed early and stay away -from women." - "Doc, I don't deserve the best," pleaded his patient. "What's -second best?" -% The FIELD GUIDE to NORTH AMERICAN MALES SPECIES: Cranial Males @@ -3889,22 +3692,6 @@ win through and still know where his tow reckoned with. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" % - The honeymooning couple agreed it was a fine day for horseback riding. -After a mile or so, the bride's mount cantered under a low tree and a -branch scraped her forehead lightly. The groom dismounted, glared at his -wife's horse, and said, "That's number one." - The ride then proceeded. After another mile or so, the bride's -horse stumbled over a pebble and the lady suffered a slight jostling. -Again, her man leapt from his saddle and strode over to the nervous animal. -"That's two," he said. - Five miles later, the bride's horse became frightened when a rabbit -crossed its path, reared up and threw the girl. Immediately, the groom was -off his horse. "That's three!", he shouted, and, pulling out a pistol, he -shot the horse between the eyes. - "You brute!" shrieked his bride. "Now I see the kind of man I -married! You're a sadist, that's what!" - The groom turned to her coolly. "That's one," he said. -% "The jig's up, Elman." "Which jig?" -- Jeff Elman @@ -4349,29 +4136,6 @@ of his mortal enemy -- to those both com spread only for demons or for gods." -- Gordon R. Dickson, "Soldier Ask Not" % - "They spend years searching for their natural parents, convinced their -parents will be happy to see them. I mean, really, can you imagine someone -being happy to see an orphan? Nobody wants them... that's why they're orphans!" - The speaker is Anne Baker, founder and guiding force behind -Orphan-Off, an organization dedicated to keeping orphans confused about the -whereabouts of their natural parents. She is a woman with a mission: - "Basically, what we do is band together to exchange information -about which orphans are looking for which parents in what part of the -country. We're completely computerized. - "The idea is to throw the orphans as many red herrings and false -leads as possible. We'll tell some twenty-three-year-old loser that his -real parents can be found at a certain address on the other side of the -country. Well, by the time the kid shows up, the family is prepared. They -look over the kid's photos and information and they say, 'Oh, the Emersons... -yeah, they used to live here... I think they moved out about five years ago. -I think they went to Iowa, or maybe Idaho.' - "Bam, the door shuts in the kid's face and he's back to zero again. -He's got nothing to go on but the orphan's pathetic determination to continue. - "It's really amazing how much these kids will put up with. Last year -we even sent one kid all the way to Australia. I mean, really. Besides, if -your natural parents were Australian, would you want to meet them?" - -- "National Lampoon", September, 1984 -% This is where the bloodthirsty license agreement is supposed to go, explaining that Interactive EasyFlow is a copyrighted package licensed for use by a single person, and sternly warning you not to pirate copies of it @@ -4683,13 +4447,6 @@ men with whom I felt an immediate sympat more satisfactory to me than the opaque vogue word "empathy". -- Alistair Cooke, "Six Men" % - "What the hell are you getting so upset about? I thought you -didn't believe in God". - "I don't," she sobbed, bursting violently into tears, "but the -God I don't believe in is a good God, a just God, a merciful God. He's -not the mean and stupid God you make Him out to be". - -- Joseph Heller -% "What was the worst thing you've ever done?" "I won't tell you that, but I'll tell you the worst thing that ever happened to me... the most dreadful thing." @@ -4806,20 +4563,6 @@ unanswered. Eventually the form for the the section marked "DEDUCTIONS," Rogers listed: "Bad debt, US Government -- $40,000." % - With deep concern, if not alarm, Dick noted that his friend -Conrad was drunker than he'd ever seen him before. "What's the trouble, -buddy?", he asked, sliding onto the stool next to his friend. - "It's a woman, Dick," Conrad replied. - "I guessed that much. Tell me about it." - "I can't," Conrad said. But after a few more drinks his tongue -and resolution both seemed to weaken and, turning to his buddy, he said, -"Okay. It's your wife." - "My wife!!" - "Yeah." - "What about her?" - Conrad pondered the question heavily, and draped his arm around -his pal. "Well, buddy-boy," he said, "I'm afraid she's cheating on us." -% Work Hard. Rock Hard. Eat Hard. @@ -4956,7 +4699,7 @@ the soul. Worry, doubt, self-distrust, long, long years that bow the head and turn the growing spirit back to dust. - Whether seventy or sixteen, there is in every being’s heart a + Whether seventy or sixteen, there is in every being's heart a love of wonder; the sweet amazement at the stars and starlike things and thoughts; the undaunted challenge of events, the unfailing childlike appetite for what comes next, and the joy in the game of life. @@ -6593,9 +6336,6 @@ a fund for his funeral. The Lord Chief a shilling. "Only a shilling?" exclaimed the man. "Only a shilling to bury an attorney? Here's a guinea; go and bury twenty of them." % -A fail-safe circuit will destroy others. - -- Klipstein -% A failure will not appear until a unit has passed final inspection. % A fair exterior is a silent recommendation. @@ -6662,17 +6402,6 @@ go!'" % A few hours grace before the madness begins again. % -A figure with curves always offers a lot of interesting angles. -% -A fisherman from Maine went to Alabama on his vacation. He rented a boat, -rowed out to the middle of the lake, and cast his line, but when he looked -down into the water he was horrified to see a man wrapped in chains lying -on the bottom of the lake. He quickly rowed to shore and ran to the police -station. "Sheriff, sheriff," he gasped, there's a guy wrapped in chains, -drowned in the lake!" - "Now ain't that jest like a Yankee," drawled the sheriff, "to steal -more chain than he can swim with?" -% A fitter fits; Though sinners sin A cutter cuts; And thinners thin And an aircraft spotter spots; And paper-blotters blot @@ -6697,11 +6426,6 @@ A fool and his honey are soon parted. % A fool and his money are soon popular. % -A fool and your money are soon partners. -% -A fool is a man who worries about whether or not his lover has integrity. -A wise man, on the other hand, busies himself with deeper attributes. -% A fool must now and then be right by chance. % A foolish consistency is the hobgoblin of little minds. @@ -6744,8 +6468,6 @@ You'll just be walking down the street a A friend of mine won't get a divorce, because he hates lawyers more than he hates his wife. % -A friend with weed is a friend indeed. -% A full belly makes a dull brain. -- Benjamin Franklin @@ -6809,9 +6531,6 @@ A girl with a future avoids the man with A girl's best friend is her mutter. -- Dorothy Parker % -A girl's conscience doesn't really keep her from doing anything wrong-- -it merely keeps her from enjoying it. -% A gleekzorp without a tornpee is like a quop without a fertsneet (sort of). % @@ -7102,27 +6821,6 @@ A language that doesn't have everything actually easier to program in than some that do. -- Dennis M. Ritchie % -A lanky Texan was mad because Texas had just become the second largest state in -the Union, so he made up his mind to move to Alaska. He drove for three days -and three nights to get there and finally he came to what looked like the state -line. He halted his car and walked up to the border guard. "Hi, there! How -do I become a resident of this here biggest state?" demanded the Texan. - The guard looked him up and down and grinned. "Waal," he answered, -there are three things you gotta do to get in. First, drink down a quart of -110 proof corn liquor without blinkin'. Second, kill a grizzly bear, and -third, make love to an Eskimo woman." - "Sounds easy enough," said the Texan. "Where can I get a quart of -this here corn liquor?" - "Got one right here," replied the guard. - The Texan gulped down the whiskey without batting an eyelash. -"Now, do you happen to know where I can find me a grizzly?" - "Yep," answered the guard, "there's a big b'ar over that way, 'bout -a mile... lives in a cave on that cliff." - The Texan lurched merrily off. About an hour later he returned -with his clothes almost torn off and his face scratched and bloody. He was -smiling happily. "Now," he roared, "where's that damn Eskimo woman you -want killed?" -% A large number of installed systems work by fiat. That is, they work by being declared to work. -- Anatol Holt @@ -7230,33 +6928,16 @@ A lot of people I know believe in positi and so do I. I believe everything positively stinks. -- Lew Col % -A lover without indiscretion is no lover at all. - -- Thomas Hardy -% A major, with wonderful force, Called out in Hyde Park for a horse. All the flowers looked round, But no horse could be found; So he just rhododendron, of course. % -A male gynecologist is like an auto mechanic who has never owned a car. - -- Carrie Snow -% -A man always needs to remember one thing about -a beautiful woman. Somewhere, somebody's tired of her. -% A man always remembers his first love with special tenderness, but after that begins to bunch them. -- H. L. Mencken % -A man arrived home early to find his wife in the arms of his best friend, -who swore how much they were in love. To quiet the enraged husband, the -lover suggested, "Friends shouldn't fight, let's play gin rummy. If I win, -you get a divorce so I can marry her. If you win, I promise never to see -her again. Okay?" - "Alright," agreed the husband. "But how about a quarter a point -on the side to make it interesting?" -% A man can have two, maybe three love affairs while he's married. After that it's cheating. -- Yves Montand @@ -7393,9 +7074,6 @@ in no other way. A man who fishes for marlin in ponds will put his money in Etruscan bonds. % -A man who likes to lie in bed can usually -find a girl willing to listen to him. -% A man who turns green has eschewed protein. % A man with 3 wings and a dictionary is cousin to the turkey. @@ -7403,12 +7081,8 @@ A man with 3 wings and a dictionary is c A man with one watch knows what time it is. A man with two watches is never quite sure. % -A man without a God is like a fish without a bicycle. -% A man without a woman is like a fish without gills. % -A man without a woman is like a statue without pigeons. -% A man would still do something out of sheer perversity - he would create destruction and chaos - just to gain his point... and if all this could in turn be analyzed and prevented by predicting that it would occur, then man @@ -7593,33 +7267,6 @@ will go far towards curing the rascal of A New York City ordinance prohibits the shooting of rabbits from the rear of a Third Avenue street car -- if the car is in motion. % -A New Yorker is riding down the road in his new Mercedes. So intent is he -on the cocaine in his hand he completely misses a turn and his car plunges -over the five-hundred-foot cliff to be smashed into pieces at the bottom. -As the on-lookers rush to the edge of the cliff they see him fifty feet -from the top of the cliff clinging to a stunted bush with all his strength. -"Dear Lord," he prays, "I never asked you for nothin' before, but I'm askin' -you now: Save me, Lord, save me." - Booms the Lord: "LET GO OF THE BRANCH." - "But Lord, if I do that, I'll fall!" - "TRUST ME, LET GO OF THE BRANCH." - "But Lord, I'm gonna fall and die..." - "TRUST ME TO SAVE YOU. LET GO OF THE BRANCH." - Okay, Lord, I'll trust you, here I... here I go!" And he falls -to his death. - "DUMB YANKEE." -% -A New Yorker was driving through Berkeley when he saw a big crowd gathered -by the side of the street. Curiosity got the better of him and he leaned -out of his window to ask an onlooker what was going on. The fellow explained -that a protestor against the U.S. position in South America had doused -himself with gasoline and set himself on fire. "That's terrible," gasped -the man. "But why is everyone still standing around?" - "Well, they're taking up a collection for his wife and kids," the -onlooker explained. "Would you be willing to help?" - "Well, sure," replied the New Yorker. "I suppose I could spare a -gallon or two." -% A newspaper is a circulating library with high blood pressure. -- Arthure "Bugs" Baer % @@ -7684,12 +7331,6 @@ itself, and that is an excellent thing f manufacturers for whom patriotic terrors are an abundant source of gain. -- Anatole France % -A perfectly honest woman, a woman who never flatters, who never manages, -who never cajoles, who never conceals, who never uses her eyes, who never -speculates on the effect which she produces, who never is conscious of -unspoken admiration, what a monster, I say, would such a female be! - -- Thackeray -% A person forgives only when they are in the wrong. % A person is just about as big as the things that make him angry. @@ -7794,8 +7435,6 @@ last pair of shoes, already worn out in of yours to press against my heart. -- Johann Wolfgang von Goethe % -A pretty woman can do anything; an ugly woman must do everything. -% A priest advised Voltaire on his death bed to renounce the devil. Replied Voltaire, "This is no time to make new enemies." % @@ -7881,23 +7520,6 @@ the ball is more than three inches from to make a travesty of the game. -- Donald A. Metz % -A rabbi and a priest are sitting together on a train, and the rabbi leans -over and asks, "So, how high can you advance in your organization?" - The priest replies, "Well, if I am lucky, I guess I could become a -Bishop." - "Well, could you get any higher than that?" - "I suppose that if my works are seen in a very good light that I -might be made an Archbishop." - "Is there any way that you might go higher than that?" - "If all the Saints should smile, I guess I could be made a Cardinal." - "Could you be anything higher than a Cardinal?" - Hesitating a little bit, the priest said, "I suppose that I could -be elected Pope, but only if it's God's will." - "And could you be anything higher than that, is there any way to go -up from being the Pope?" - "What?! I should be the Messiah himself?!" - The rabbi leaned back and smiled. "One of our boys made it." -% A raccoon tangled with a 23,000 volt line today. The results blacked out 1400 homes and, of course, one raccoon. -- Steel City News @@ -7912,17 +7534,6 @@ A real diplomat is one who can cut his n his neighbor notice it. -- Trygve Lie % -A real estate agent, looking over a farmer's house for possible sale, -commented to the farmer how sturdy the house looked. - The farmer replied, "Yep, built it with my bare hands... did it -the hard way. The steps to the front door, here, carved 'em out of -field stones... did it the hard way. That hardwood floor in the living -room, dovetailed the pieces myself... did it the hard way. The ceiling -beams, made 'em out of my own oak trees... did it the hard way." - Just then, the farmer's gorgeous daughter walked in. The farmer -looks over at the real estate agent who is trying not to stare too -obviously and smiles. "Yep... standing up in a canoe." -% A real friend isn't someone you use once and then throw away. A real friend is someone you can use over and over again. % @@ -8180,8 +7791,6 @@ the student with a stick. % A student who changes the course of history is probably taking an exam. % -A stunning blonde, but probably all bean dip above the eyebrows. -% A successful [software] tool is one that was used to do something undreamed of by its author. -- S. C. Johnson @@ -8318,12 +7927,6 @@ than some of the stuff that nature repla A verbal contract isn't worth the paper it's written on. -- Samuel Goldwyn % -A very intelligent turtle -Found programming UNIX a hurdle - The system, you see, - Ran as slow as did he, -And that's not saying much for the turtle. -% A violent man will die a violent death. -- Lao Tsu % @@ -8351,9 +7954,6 @@ Software rots if not used. These are great mysteries. -- Geoffrey James, "The Tao of Programming" % -A widow is more sought after than an old maid of the same age. - -- Addison -% A wise man can see more from a mountain top than a fool can from the bottom of a well. % @@ -8382,27 +7982,14 @@ A woman can look both moral and exciting were quite a struggle. -- Edna Ferber % -A woman can never be too rich or too thin. -% A woman did what a woman had to, the best way she knew how. To do more was impossible, to do less, unthinkable. -- Dirisha, "The Man Who Never Missed" % -A woman employs sincerity only when every other form of deception has failed. - -- Scott -% A woman, especially if she have the misfortune of knowing anything, should conceal it as well as she can. -- Jane Austen % -A woman forgives the audacity of which -her beauty has prompted us to be guilty. - -- LeSage -% -A woman has got to love a bad man once or twice in her life to be -thankful for a good one. - -- Marjorie Kinnan Rawlings -% A woman is like your shadow; follow her, she flies; fly from her, she follows. -- Chamfort @@ -8580,7 +8167,7 @@ Abscond, v.: % Absence diminishes mediocre passions and increases great ones, as the wind blows out candles and fans fires. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Absence in love is like water upon fire; a little quickens, but much extinguishes it. @@ -8654,11 +8241,6 @@ Accept people for what they are -- compl ACCEPTANCE TESTING: An unsuccessful attempt to find bugs. % -Acceptance without proof is the fundamental characteristic of Western -religion; rejection without proof is the fundamental characteristic of -Western science. - -- Gary Zukav, "The Dancing Wu Li Masters" -% Accident, n.: A condition in which presence of mind is good, but absence of body is better. @@ -8993,8 +8575,6 @@ the unimpeded right to get rich, to use cost to others, to win advancement. -- Norman Thomas % -After I run your program, let's make love like crazed weasels, OK? -% After living in New York, you trust nobody, but you believe everything. Just in case. % @@ -9535,7 +9115,7 @@ All the men on my staff can type. % All the passions make us commit faults; love makes us commit the most ridiculous ones. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % All the really good ideas I ever had came to me while I was milking a cow. -- Grant Wood @@ -10571,8 +10151,6 @@ Any girl can be glamorous; all you have stupid. -- Hedy Lamarr % -Any given program, when running, is obsolete. -% Any given program will expand to fill available memory. % Any great truth can -- and eventually will -- be expressed as a cliche -- @@ -11466,9 +11044,6 @@ Asking a working writer what he thinks a lamp-post how it feels about dogs. -- Christopher Hampton % -Ass, n.: - The masculine of "lass". -% Assembly language experience is [important] for the maturity and understanding of how computers work that it provides. -- D. Gries @@ -12051,11 +11626,6 @@ the wise man saith, "Put all your eggs i basket!" -- Mark Twain % -Behold the unborn foetus and - Weep salt tears crocodilian; -All life is sacred (save, of course, - An enemy civilian). -% Behold the warranty -- the bold print giveth and the fine print taketh away. % @@ -12477,8 +12047,6 @@ Blessed are the forgetful: for they get the better even of their blunders. -- Friedrich Nietzsche % -Blessed are the meek for they shall inhibit the earth. -% Blessed are the young, for they shall inherit the national debt. -- Herbert Hoover % @@ -13660,9 +13228,6 @@ Drinking beer and playing cards neighb plays with elves! -- Elmo and Patsy, "Grandma Got Run Over by a Reindeer" % -Christ: - A man who was born at least 5,000 years ahead of his time. -% Christ died for our sins, so let's not disappoint Him. % Christianity might be a good thing if anyone ever tried it. @@ -13748,8 +13313,6 @@ the walk before it stops snowing. Cleanliness becomes more important when godliness is unlikely. -- P. J. O'Rourke % -Cleanliness is next to impossible. -% CLEVELAND: Where their last tornado did six million dollars worth of improvements. @@ -13890,9 +13453,6 @@ Coincidences are spiritual puns. -- G. K. Chesterton % Cold, adj.: - When the local flashers are handing out written descriptions. -% -Cold, adj.: When the politicians walk around with their hands in their own pockets. % @@ -14184,7 +13744,7 @@ Computers will not be perfected until th than the estimate the job will cost. % Conceit causes more conversation than wit. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Concept, n.: Any "idea" for which an outside consultant billed you more than @@ -14644,8 +14204,6 @@ DALLAS: The city that chose Astroturf to keep the cheerleaders from grazing. % -Dallas still lives. God MUST be dead. -% Dammit Jim, I'm an actor not a doctor. % Dammit, man, that's unprofessional! A good bartender laughs anyway! @@ -14908,14 +14466,6 @@ of education may be of even greater impo correct current table manners, vital as Miss Manners believes that is. % Dear Miss Manners: - Please list some tactful ways of removing a man's saliva from -your face. - -Gentle Reader: - Please list some decent ways of acquiring a man's saliva on -your face ... -% -Dear Miss Manners: I carry a big black umbrella, even if there's just a thirty percent chance of rain. May I ask a young lady who is a stranger to me to share its protection? This morning, I was waiting for a bus in comparative comfort, my umbrella @@ -15537,16 +15087,12 @@ Do clones have navels? Do I like getting drunk? Depends on who's doing the drinking. -- Amy Gorin % -Do infants have as much fun in infancy as adults do in adultery? -% Do Miami a favor. When you leave, take someone with you. % Do molecular biologists wear designer genes? % Do more than anyone expects, and pretty soon everyone will expect more. % -Do not believe in miracles -- rely on them. -% Do not clog intellect's sluices with bits of knowledge of questionable uses. % Do not count your chickens before they are hatched. @@ -16031,10 +15577,6 @@ want to help you could agree with each o % Don't you wish you had more energy... or less ambition? % -Dope will get you through times of no money better that money will get -you through times of no dope. - -- Gilbert Shelton -% Dorothy: How can you talk if you haven't got a brain? Scarecrow: I don't know. But some people without brains do an awful lot of talking, don't they? @@ -19581,12 +19123,6 @@ GEMINI (May 21 - June 20) the mail carefully, although there won't be anything good in it today, either. % -GEMINI (May 21 - June 20) - You are a quick and intelligent thinker. People like you -because you are bisexual. However, you are inclined to expect too much -for too little. This means you are cheap. Geminis are known for -committing incest. -% GEMINI (May 21 to Jun. 20) Good news and bad news highlighted. Enjoy the good news while you can; the bad news will make you forget it. You will enjoy praise @@ -20001,8 +19537,6 @@ can't find it anywhere. I'm sure he's t would he lie about a thing like that? -- Arthur Naiman, "Every Goy's Guide to Yiddish" % -God gives us relatives; thank goodness we can chose our friends. -% God grant us the serenity to accept the things we cannot change, courage to change the things we can, and wisdom to know the difference. % @@ -20033,8 +19567,6 @@ but by pains and contradictions. % God is a comic playing to an audience that's afraid to laugh. % -God is a polytheist. -% God is Dead. -- Nietzsche Nietzsche is Dead. @@ -20071,8 +19603,6 @@ God made machine language; all the rest God made the integers; all else is the work of Man. -- Kronecker % -God made the world in six days, and was arrested on the seventh. -% God may be subtle, but He isn't plain mean. -- Albert Einstein % @@ -20174,10 +19704,6 @@ Diary of a Young Girl LITE(tm) % Good advice is one of those insults that ought to be forgiven. % -Good advice is something a man gives -when he is too old to set a bad example. - -- La Rochefoucauld -% Good day for a change of scene. Repaper the bedroom wall. % Good day for business affairs. @@ -20373,8 +19899,6 @@ GRAVITY: % Gravity brings me down. % -Gravity is a myth, the Earth sucks. -% Gray's Law of Programming: 'n+1' trivial tasks are expected to be accomplished in the same time as 'n' tasks. @@ -20457,13 +19981,6 @@ Groundhog Day has been observed only onc groundhog came out of its hole, it was killed by a mudslide. -- Johnny Carson % -Grover Cleveland, though constantly at loggerheads with the Senate, got on -better with the House of Representatives. A popular story circulating -during his presidency concerned the night he was roused by his wife crying, -"Wake up! I think there are burglars in the house." - "No, no, my dear," said the president sleepily, "in the Senate -maybe, but not in the House." -% Growing old isn't bad when you consider the alternatives. -- Maurice Chevalier % @@ -21832,8 +21349,6 @@ Him: "Really? That's incredible... Hindsight is always 20:20. -- Billy Wilder % -Hindsight is an exact science. -% Hippogriff, n.: An animal (now extinct) which was half horse and half griffin. The griffin was itself a compound creature, half lion and half @@ -22032,8 +21547,6 @@ Home is the place where, when you have t they have to take you in. -- Robert Frost, "The Death of the Hired Man" % -Home is where the hurt is. -% Home life as we understand it is no more natural to us than a cage is to a cockatoo. -- George Bernard Shaw @@ -25271,9 +24784,6 @@ is a camel's behind. % If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars? % -If a child annoys you, quiet him by brushing their hair. If this doesn't -work, use the other side of the brush on the other end of the child. -% If A equals success, then the formula is _A = _X + _Y + _Z. _X is work. _Y is play. _Z is keep your mouth shut. -- Albert Einstein @@ -25454,8 +24964,6 @@ We're offering a substantial reward. He blind in his left eye, is missing part of his right ear and the tip of his tail. He's been recently fixed. Answers to "Lucky". % -If anything can go wrong, it will. -% If at first you do succeed, try to hide your astonishment. % If at first you don't succeed, destroy all evidence that you tried. @@ -25866,8 +25374,6 @@ of a student-poet to hang on to his ever % If it weren't for the last minute, nothing would ever get done. % -If it's not in the computer, it doesn't exist. -% If it's Tuesday, this must be someone else's fortune. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 23:09:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61A7A1065670; Sun, 1 Jan 2012 23:09:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BCE68FC12; Sun, 1 Jan 2012 23:09:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01N9whh035751; Sun, 1 Jan 2012 23:09:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01N9wnD035749; Sun, 1 Jan 2012 23:09:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012309.q01N9wnD035749@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229229 - stable/8/sys/fs/nullfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 23:09:58 -0000 Author: kib Date: Sun Jan 1 23:09:57 2012 New Revision: 229229 URL: http://svn.freebsd.org/changeset/base/229229 Log: MFC r227695: Use the plain panic calls, without additional printing around them. Modified: stable/8/sys/fs/nullfs/null_subr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/nullfs/null_subr.c ============================================================================== --- stable/8/sys/fs/nullfs/null_subr.c Sun Jan 1 23:08:19 2012 (r229228) +++ stable/8/sys/fs/nullfs/null_subr.c Sun Jan 1 23:09:57 2012 (r229229) @@ -289,22 +289,12 @@ null_checkvp(vp, fil, lno) #endif if (a->null_lowervp == NULLVP) { /* Should never happen */ - int i; u_long *p; - printf("vp = %p, ZERO ptr\n", (void *)vp); - for (p = (u_long *) a, i = 0; i < 8; i++) - printf(" %lx", p[i]); - printf("\n"); - panic("null_checkvp"); + panic("null_checkvp %p", vp); } VI_LOCK_FLAGS(a->null_lowervp, MTX_DUPOK); - if (a->null_lowervp->v_usecount < 1) { - int i; u_long *p; - printf("vp = %p, unref'ed lowervp\n", (void *)vp); - for (p = (u_long *) a, i = 0; i < 8; i++) - printf(" %lx", p[i]); - printf("\n"); - panic ("null with unref'ed lowervp"); - } + if (a->null_lowervp->v_usecount < 1) + panic ("null with unref'ed lowervp, vp %p lvp %p", + vp, a->null_lowervp); VI_UNLOCK(a->null_lowervp); #ifdef notyet printf("null %x/%d -> %x/%d [%s, %d]\n", From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 23:12:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EC1A106564A; Sun, 1 Jan 2012 23:12:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1822D8FC12; Sun, 1 Jan 2012 23:12:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01NCulQ035953; Sun, 1 Jan 2012 23:12:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NCu9B035951; Sun, 1 Jan 2012 23:12:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012312.q01NCu9B035951@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229231 - stable/8/sys/fs/nullfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 23:12:57 -0000 Author: kib Date: Sun Jan 1 23:12:56 2012 New Revision: 229231 URL: http://svn.freebsd.org/changeset/base/229231 Log: MFC r227696: Do not use NULLVPTOLOWERVP() in the null_print(). If diagnostic is compiled in, and show vnode is used from ddb on the faulty nullfs vnode, we get panic instead of vnode dump. Modified: stable/8/sys/fs/nullfs/null_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/8/sys/fs/nullfs/null_vnops.c Sun Jan 1 23:12:43 2012 (r229230) +++ stable/8/sys/fs/nullfs/null_vnops.c Sun Jan 1 23:12:56 2012 (r229231) @@ -729,7 +729,7 @@ null_print(struct vop_print_args *ap) { struct vnode *vp = ap->a_vp; - printf("\tvp=%p, lowervp=%p\n", vp, NULLVPTOLOWERVP(vp)); + printf("\tvp=%p, lowervp=%p\n", vp, VTONULL(vp)->null_lowervp); return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 23:17:22 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F3831065677; Sun, 1 Jan 2012 23:17:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57DC18FC0C; Sun, 1 Jan 2012 23:17:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01NHMMv036281; Sun, 1 Jan 2012 23:17:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NHM0B036275; Sun, 1 Jan 2012 23:17:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012317.q01NHM0B036275@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229233 - stable/8/sys/fs/msdosfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 23:17:22 -0000 Author: kib Date: Sun Jan 1 23:17:21 2012 New Revision: 229233 URL: http://svn.freebsd.org/changeset/base/229233 Log: MFC r227817: Put all the messages from msdosfs under the MSDOSFS_DEBUG ifdef. Modified: stable/8/sys/fs/msdosfs/msdosfs_conv.c stable/8/sys/fs/msdosfs/msdosfs_denode.c stable/8/sys/fs/msdosfs/msdosfs_fat.c stable/8/sys/fs/msdosfs/msdosfs_lookup.c stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_conv.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_conv.c Sun Jan 1 23:17:21 2012 (r229233) @@ -1052,8 +1052,10 @@ mbnambuf_write(struct mbnambuf *nbp, cha size_t count, newlen; if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: non-decreasing id: id %d, last id %d\n", id, nbp->nb_last_id); +#endif return; } @@ -1062,7 +1064,9 @@ mbnambuf_write(struct mbnambuf *nbp, cha count = strlen(name); newlen = nbp->nb_len + count; if (newlen > WIN_MAXLEN || newlen > MAXNAMLEN) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: file name length %zu too large\n", newlen); +#endif return; } Modified: stable/8/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_denode.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_denode.c Sun Jan 1 23:17:21 2012 (r229233) @@ -263,8 +263,10 @@ deget(pmp, dirclust, diroffset, depp) * instead of what is written in directory entry. */ if (diroffset == 0 && ldep->de_StartCluster != dirclust) { +#ifdef MSDOSFS_DEBUG printf("deget(): \".\" entry at clust %lu != %lu\n", dirclust, ldep->de_StartCluster); +#endif ldep->de_StartCluster = dirclust; } @@ -274,8 +276,11 @@ deget(pmp, dirclust, diroffset, depp) if (error == E2BIG) { ldep->de_FileSize = de_cn2off(pmp, size); error = 0; - } else + } else { +#ifdef MSDOSFS_DEBUG printf("deget(): pcbmap returned %d\n", error); +#endif + } } } else nvp->v_type = VREG; @@ -351,8 +356,10 @@ detrunc(dep, length, flags, cred, td) * directory's life. */ if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) { +#ifdef MSDOSFS_DEBUG printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n", dep->de_dirclust, dep->de_diroffset); +#endif return (EINVAL); } Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Jan 1 23:17:21 2012 (r229233) @@ -503,7 +503,9 @@ fatentry(function, pmp, cn, oldcontents, * Be sure they asked us to do something. */ if ((function & (FAT_SET | FAT_GET)) == 0) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): function code doesn't specify get or set\n"); +#endif return (EINVAL); } @@ -512,7 +514,9 @@ fatentry(function, pmp, cn, oldcontents, * where to put it, give them an error. */ if ((function & FAT_GET) && oldcontents == NULL) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): get function with no place to put result\n"); +#endif return (EINVAL); } #endif @@ -997,7 +1001,9 @@ extendfile(dep, count, bpp, ncp, flags) */ if (dep->de_StartCluster == MSDOSFSROOT && (dep->de_Attributes & ATTR_DIRECTORY)) { +#ifdef MSDOSFS_DEBUG printf("extendfile(): attempt to extend root directory\n"); +#endif return (ENOSPC); } Modified: stable/8/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 1 23:17:21 2012 (r229233) @@ -902,8 +902,10 @@ doscheckpath(source, target) out:; if (bp) brelse(bp); +#ifdef MSDOSFS_DEBUG if (error == ENOTDIR) printf("doscheckpath(): .. not a directory?\n"); +#endif if (dep != NULL) vput(DETOV(dep)); return (error); Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 1 23:17:21 2012 (r229233) @@ -555,7 +555,9 @@ mountmsdosfs(struct vnode *devvp, struct || pmp->pm_FATsecs || getushort(b710->bpbFSVers)) { error = EINVAL; +#ifdef MSDOSFS_DEBUG printf("mountmsdosfs(): bad FAT32 filesystem\n"); +#endif goto error_exit; } pmp->pm_fatmask = FAT32_MASK; @@ -633,8 +635,10 @@ mountmsdosfs(struct vnode *devvp, struct clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv; if (pmp->pm_maxcluster >= clusters) { +#ifdef MSDOSFS_DEBUG printf("Warning: number of clusters (%ld) exceeds FAT " "capacity (%ld)\n", pmp->pm_maxcluster + 1, clusters); +#endif pmp->pm_maxcluster = clusters - 1; } From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 23:46:34 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5A6D106566C; Sun, 1 Jan 2012 23:46:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A019F8FC22; Sun, 1 Jan 2012 23:46:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01NkYTC037884; Sun, 1 Jan 2012 23:46:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NkY35037882; Sun, 1 Jan 2012 23:46:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012346.q01NkY35037882@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229246 - stable/8/sys/fs/fifofs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 23:46:34 -0000 Author: kib Date: Sun Jan 1 23:46:34 2012 New Revision: 229246 URL: http://svn.freebsd.org/changeset/base/229246 Log: MFC r228263: Initialize fifoinfo fi_wgen field on open. Modified: stable/8/sys/fs/fifofs/fifo_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/8/sys/fs/fifofs/fifo_vnops.c Sun Jan 1 23:46:08 2012 (r229245) +++ stable/8/sys/fs/fifofs/fifo_vnops.c Sun Jan 1 23:46:34 2012 (r229246) @@ -207,7 +207,7 @@ fail1: free(fip, M_VNODE); return (error); } - fip->fi_readers = fip->fi_writers = 0; + fip->fi_wgen = fip->fi_readers = fip->fi_writers = 0; wso->so_snd.sb_lowat = PIPE_BUF; SOCKBUF_LOCK(&rso->so_rcv); rso->so_rcv.sb_state |= SBS_CANTRCVMORE; From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 1 23:58:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B126710656D4; Sun, 1 Jan 2012 23:58:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2A88FC16; Sun, 1 Jan 2012 23:58:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q01Nwg23038614; Sun, 1 Jan 2012 23:58:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NwggW038612; Sun, 1 Jan 2012 23:58:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012358.q01NwggW038612@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229253 - stable/8/sys/ddb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2012 23:58:42 -0000 Author: kib Date: Sun Jan 1 23:58:42 2012 New Revision: 229253 URL: http://svn.freebsd.org/changeset/base/229253 Log: Show the thread kernel stack base address for 'show threads'. Modified: stable/8/sys/ddb/db_thread.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/ddb/db_thread.c ============================================================================== --- stable/8/sys/ddb/db_thread.c Sun Jan 1 23:58:20 2012 (r229252) +++ stable/8/sys/ddb/db_thread.c Sun Jan 1 23:58:42 2012 (r229253) @@ -94,7 +94,8 @@ db_show_threads(db_expr_t addr, boolean_ thr = kdb_thr_first(); while (!db_pager_quit && thr != NULL) { - db_printf(" %6ld (%p) ", (long)thr->td_tid, thr); + db_printf(" %6ld (%p) (stack %p) ", (long)thr->td_tid, thr, + (void *)thr->td_kstack); prev_jb = kdb_jmpbuf(jb); if (setjmp(jb) == 0) { if (db_trace_thread(thr, 1) != 0) From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 03:52:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63B50106566C; Mon, 2 Jan 2012 03:52:35 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 516158FC08; Mon, 2 Jan 2012 03:52:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q023qZ9K046418; Mon, 2 Jan 2012 03:52:35 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q023qZRr046416; Mon, 2 Jan 2012 03:52:35 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201020352.q023qZRr046416@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 03:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229259 - in stable/8/sys: conf fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 03:52:35 -0000 Author: rmacklem Date: Mon Jan 2 03:52:34 2012 New Revision: 229259 URL: http://svn.freebsd.org/changeset/base/229259 Log: MFC: r227494 Since NFSv4 byte range locking only works for regular files, add a sanity check for the vnode type to the NFSv4 client. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 03:26:59 2012 (r229258) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 03:52:34 2012 (r229259) @@ -2877,6 +2877,8 @@ nfs_advlock(struct vop_advlock_args *ap) u_quad_t size; if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) { + if (vp->v_type != VREG) + return (EINVAL); if ((ap->a_flags & F_POSIX) != 0) cred = p->p_ucred; else From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 04:47:39 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E0C3106564A; Mon, 2 Jan 2012 04:47:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BAB78FC08; Mon, 2 Jan 2012 04:47:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q024ldUU048340; Mon, 2 Jan 2012 04:47:39 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q024ldHP048338; Mon, 2 Jan 2012 04:47:39 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201020447.q024ldHP048338@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 04:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229264 - in stable/8/sys: conf fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 04:47:39 -0000 Author: rmacklem Date: Mon Jan 2 04:47:38 2012 New Revision: 229264 URL: http://svn.freebsd.org/changeset/base/229264 Log: MFC: r227517 Move the setting of the default value for nm_wcommitsize to before the nfs_decode_args() call in the new NFS client, so that a specfied command line value won't be overwritten. Also, modify the calculation for small values of desiredvnodes to avoid an unusually large value or a divide by zero crash. It seems that the default value for nm_wcommitsize is very conservative and may need to change at some time. Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 2 04:25:25 2012 (r229263) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 2 04:47:38 2012 (r229264) @@ -1218,6 +1218,10 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; nmp->nm_readahead = NFS_DEFRAHEAD; + if (desiredvnodes >= 11000) + nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); + else + nmp->nm_wcommitsize = hibufspace / 10; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1241,7 +1245,6 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_rsize = NFS_RSIZE; nmp->nm_readdirsize = NFS_READDIRSIZE; } - nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:16:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D8F3106566C; Mon, 2 Jan 2012 17:16:09 +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 5BAA28FC15; Mon, 2 Jan 2012 17:16:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02HG9GR076483; Mon, 2 Jan 2012 17:16:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HG9Yi076481; Mon, 2 Jan 2012 17:16:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021716.q02HG9Yi076481@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229290 - in stable/8/sys: conf dev/ahci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:16:09 -0000 Author: mav Date: Mon Jan 2 17:16:08 2012 New Revision: 229290 URL: http://svn.freebsd.org/changeset/base/229290 Log: MFC r227635: Change the way how "not implemented" AHCI channels handled. Instead of completely skipping them, create ahcich devices for them to allocate unit numbers, but mark them as disabled to prevent driver probe and attach. Last time some BIOSes tend to report unused channels as "not implemented". This change makes ahcichX devices numbering consistent, independently of connected disks. It makes per-channel driver hints usable and CAM devices wiring possible on such systems. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:13:56 2012 (r229289) +++ stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:16:08 2012 (r229290) @@ -498,13 +498,14 @@ ahci_attach(device_t dev) } /* Attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { - if ((ctlr->ichannels & (1 << unit)) == 0) - continue; child = device_add_child(dev, "ahcich", -1); - if (child == NULL) + if (child == NULL) { device_printf(dev, "failed to add channel device\n"); - else - device_set_ivars(child, (void *)(intptr_t)unit); + continue; + } + device_set_ivars(child, (void *)(intptr_t)unit); + if ((ctlr->ichannels & (1 << unit)) == 0) + device_disable(child); } bus_generic_attach(dev); return 0; From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:21:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A463106564A; Mon, 2 Jan 2012 17:21: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 F2F318FC0C; Mon, 2 Jan 2012 17:21:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02HLfCX076788; Mon, 2 Jan 2012 17:21:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HLfBu076783; Mon, 2 Jan 2012 17:21:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021721.q02HLfBu076783@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229292 - in stable/8: share/man/man4 sys/conf sys/dev/ahci sys/dev/ata/chipsets X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:21:42 -0000 Author: mav Date: Mon Jan 2 17:21:41 2012 New Revision: 229292 URL: http://svn.freebsd.org/changeset/base/229292 Log: MFC r228200: Add hw.ahci.force tunable to control whether AHCI drivers should attach to known AHCI-capable chips (AMD/NVIDIA), configured for legacy emulation. Enabled by default to get additional performance and functionality of AHCI when it can't be enabled by BIOS. Can be disabled to honor BIOS settings if needed for some reason. Modified: stable/8/share/man/man4/ahci.4 stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/chipsets/ata-ati.c stable/8/sys/dev/ata/chipsets/ata-nvidia.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/share/man/man4/ahci.4 ============================================================================== --- stable/8/share/man/man4/ahci.4 Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/share/man/man4/ahci.4 Mon Jan 2 17:21:41 2012 (r229292) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2011 +.Dd December 2, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -97,6 +97,9 @@ A manual bus reset is needed on device h .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. +.It Va hw.ahci.force +setting to nonzero value forces driver attach to some known AHCI-capable +chips even if they are configured for legacy IDE emulation. Default is 1. .El .Sh DESCRIPTION This driver provides the Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:21:41 2012 (r229292) @@ -291,6 +291,9 @@ static struct { #define RECOVERY_REQUEST_SENSE 2 #define recovery_slot spriv_field1 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); + static int ahci_probe(device_t dev) { @@ -308,7 +311,8 @@ ahci_probe(device_t dev) for (i = 0; ahci_ids[i].id != 0; i++) { if (ahci_ids[i].id == devid && ahci_ids[i].rev <= revid && - (valid || !(ahci_ids[i].quirks & AHCI_Q_NOFORCE))) { + (valid || (force_ahci == 1 && + !(ahci_ids[i].quirks & AHCI_Q_NOFORCE)))) { /* Do not attach JMicrons with single PCI function. */ if (pci_get_vendor(dev) == 0x197b && (pci_read_config(dev, 0xdf, 1) & 0x40) == 0) Modified: stable/8/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ati.c Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/sys/dev/ata/chipsets/ata-ati.c Mon Jan 2 17:21:41 2012 (r229292) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_ati_chipinit(device_t dev); +static int ata_ati_dumb_ch_attach(device_t dev); static int ata_ati_ixp700_ch_attach(device_t dev); static int ata_ati_setmode(device_t dev, int target, int mode); @@ -63,6 +64,8 @@ static int ata_ati_setmode(device_t dev, #define SII_MEMIO 1 #define SII_BUG 0x04 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); /* * ATI chipset support functions @@ -111,7 +114,10 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: - ctlr->chipinit = ata_ahci_chipinit; + if (force_ahci == 1 || pci_get_subclass(dev) != PCIS_STORAGE_IDE) + ctlr->chipinit = ata_ahci_chipinit; + else + ctlr->chipinit = ata_ati_chipinit; break; } return (BUS_PROBE_DEFAULT); @@ -127,6 +133,11 @@ ata_ati_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; + if (ctlr->chip->cfg1 == ATI_AHCI) { + ctlr->ch_attach = ata_ati_dumb_ch_attach; + ctlr->setmode = ata_sata_setmode; + return (0); + } switch (ctlr->chip->chipid) { case ATA_ATI_IXP600: /* IXP600 only has 1 PATA channel */ @@ -165,6 +176,17 @@ ata_ati_chipinit(device_t dev) } static int +ata_ati_dumb_ch_attach(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_pci_ch_attach(dev)) + return ENXIO; + ch->flags |= ATA_SATA; + return (0); +} + +static int ata_ati_ixp700_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); Modified: stable/8/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-nvidia.c Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/sys/dev/ata/chipsets/ata-nvidia.c Mon Jan 2 17:21:41 2012 (r229292) @@ -65,6 +65,8 @@ static int ata_nvidia_setmode(device_t d #define NVAHCI 0x04 #define NVNOFORCE 0x08 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); /* * nVidia chipset support functions @@ -181,7 +183,7 @@ ata_nvidia_probe(device_t dev) ata_set_desc(dev); if ((ctlr->chip->cfg1 & NVAHCI) && - ((ctlr->chip->cfg1 & NVNOFORCE) == 0 || + ((force_ahci == 1 && (ctlr->chip->cfg1 & NVNOFORCE) == 0) || pci_get_subclass(dev) != PCIS_STORAGE_IDE)) ctlr->chipinit = ata_ahci_chipinit; else From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:28:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06C241065675; Mon, 2 Jan 2012 17:28: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 E8BF98FC18; Mon, 2 Jan 2012 17:28:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02HSEgl077190; Mon, 2 Jan 2012 17:28:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HSEQg077186; Mon, 2 Jan 2012 17:28:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021728.q02HSEQg077186@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229294 - in stable/8/sys: conf dev/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:28:15 -0000 Author: mav Date: Mon Jan 2 17:28:14 2012 New Revision: 229294 URL: http://svn.freebsd.org/changeset/base/229294 Log: MFC r226680: Some dmesg cosmetics: - for the legacy PCI ATA channels move channel number out of the device description, same as it is for ahci(4), siis(4) and mvs(4); - add device description for the ISA ATA channels. Modified: stable/8/sys/dev/ata/ata-isa.c stable/8/sys/dev/ata/ata-pci.c stable/8/sys/dev/ata/ata-pci.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ata/ata-isa.c ============================================================================== --- stable/8/sys/dev/ata/ata-isa.c Mon Jan 2 17:27:07 2012 (r229293) +++ stable/8/sys/dev/ata/ata-isa.c Mon Jan 2 17:28:14 2012 (r229294) @@ -92,6 +92,7 @@ ata_isa_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlio); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); + device_set_desc(dev, "ATA channel"); return (ata_probe(dev)); } Modified: stable/8/sys/dev/ata/ata-pci.c ============================================================================== --- stable/8/sys/dev/ata/ata-pci.c Mon Jan 2 17:27:07 2012 (r229293) +++ stable/8/sys/dev/ata/ata-pci.c Mon Jan 2 17:28:14 2012 (r229294) @@ -545,6 +545,19 @@ ata_pci_dmafini(device_t dev) } int +ata_pci_print_child(device_t dev, device_t child) +{ + int retval; + + retval = bus_print_child_header(dev, child); + retval += printf(" at channel %d", + (int)(intptr_t)device_get_ivars(child)); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { @@ -574,6 +587,7 @@ static device_method_t ata_pci_methods[] DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), DEVMETHOD(pci_read_config, ata_pci_read_config), DEVMETHOD(pci_write_config, ata_pci_write_config), + DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), { 0, 0 } @@ -594,12 +608,10 @@ MODULE_DEPEND(atapci, ata, 1, 1, 1); static int ata_pcichannel_probe(device_t dev) { - char buffer[32]; if ((intptr_t)device_get_ivars(dev) < 0) return (ENXIO); - sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev)); - device_set_desc_copy(dev, buffer); + device_set_desc(dev, "ATA channel"); return ata_probe(dev); } Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:27:07 2012 (r229293) +++ stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:28:14 2012 (r229294) @@ -549,6 +549,7 @@ int ata_pci_write_ivar(device_t dev, dev uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width); void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width); +int ata_pci_print_child(device_t dev, device_t child); int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); @@ -601,6 +602,7 @@ static device_method_t __CONCAT(dname,_m DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \ DEVMETHOD(pci_read_config, ata_pci_read_config), \ DEVMETHOD(pci_write_config, ata_pci_write_config), \ + DEVMETHOD(bus_print_child, ata_pci_print_child), \ DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \ { 0, 0 } \ }; \ From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:31:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 966C0106564A; Mon, 2 Jan 2012 17:31:29 +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 6A4168FC1C; Mon, 2 Jan 2012 17:31:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02HVToJ077405; Mon, 2 Jan 2012 17:31:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HVTXY077402; Mon, 2 Jan 2012 17:31:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021731.q02HVTXY077402@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229296 - in stable/8/sys: conf dev/ata dev/ata/chipsets X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:31:29 -0000 Author: mav Date: Mon Jan 2 17:31:28 2012 New Revision: 229296 URL: http://svn.freebsd.org/changeset/base/229296 Log: MFC r228497: Add PCI IDs for the Intel ICH9M SATA controllers. Modified: stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:30:27 2012 (r229295) +++ stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:31:28 2012 (r229296) @@ -193,6 +193,10 @@ struct ata_pci_controller { #define ATA_I82801IB_AH4 0x29238086 #define ATA_I82801IB_R1 0x29258086 #define ATA_I82801IB_S2 0x29268086 +#define ATA_I82801IBM_S1 0x29288086 +#define ATA_I82801IBM_AH 0x29298086 +#define ATA_I82801IBM_R1 0x292a8086 +#define ATA_I82801IBM_S2 0x292d8086 #define ATA_I82801JIB_S1 0x3a208086 #define ATA_I82801JIB_AH 0x3a228086 #define ATA_I82801JIB_R1 0x3a258086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Mon Jan 2 17:30:27 2012 (r229295) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Mon Jan 2 17:31:28 2012 (r229296) @@ -157,6 +157,10 @@ ata_intel_probe(device_t dev) { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IBM_S1, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:38:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 756801065670; Mon, 2 Jan 2012 17:38: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 4936E8FC0C; Mon, 2 Jan 2012 17:38:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02Hc7V4077807; Mon, 2 Jan 2012 17:38:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Hc75F077804; Mon, 2 Jan 2012 17:38:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021738.q02Hc75F077804@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229298 - in stable/8/sys: cam conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:38:07 -0000 Author: mav Date: Mon Jan 2 17:38:06 2012 New Revision: 229298 URL: http://svn.freebsd.org/changeset/base/229298 Log: MFC r227637: Introduce CAM_SIM_POLLED SIM flag, indicating that it works in polling mode. It blocks CAM SWI usage on requests completion, unneeded because of polling and denied during kernel dumping because of blocked scheduler. Before r198899 there was periph flag CAM_PERIPH_POLLED, but that was wrong, because there is whole SIM is polled or handled by SWI, not a single periph. Modified: stable/8/sys/cam/cam_sim.h stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/cam_sim.h ============================================================================== --- stable/8/sys/cam/cam_sim.h Mon Jan 2 17:36:14 2012 (r229297) +++ stable/8/sys/cam/cam_sim.h Mon Jan 2 17:38:06 2012 (r229298) @@ -104,7 +104,8 @@ struct cam_sim { u_int32_t flags; #define CAM_SIM_REL_TIMEOUT_PENDING 0x01 #define CAM_SIM_MPSAFE 0x02 -#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_POLLED 0x08 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Mon Jan 2 17:36:14 2012 (r229297) +++ stable/8/sys/cam/cam_xpt.c Mon Jan 2 17:38:06 2012 (r229298) @@ -2903,6 +2903,9 @@ xpt_polled_action(union ccb *start_ccb) mtx_assert(sim->mtx, MA_OWNED); + /* Don't use ISR for this SIM while polling. */ + sim->flags |= CAM_SIM_POLLED; + /* * Steal an opening so that no other queued requests * can get it before us while we simulate interrupts. @@ -2942,6 +2945,9 @@ xpt_polled_action(union ccb *start_ccb) } else { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; } + + /* We will use CAM ISR for this SIM again. */ + sim->flags &= ~CAM_SIM_POLLED; } /* @@ -4103,7 +4109,7 @@ xpt_done(union ccb *done_ccb) TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) { + if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) { mtx_lock(&cam_simq_lock); first = TAILQ_EMPTY(&cam_simq); TAILQ_INSERT_TAIL(&cam_simq, sim, links); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:40:21 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 322F01065689; Mon, 2 Jan 2012 17:40:21 +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 05BFA8FC0C; Mon, 2 Jan 2012 17:40:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02HeKg9077970; Mon, 2 Jan 2012 17:40:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HeKq8077968; Mon, 2 Jan 2012 17:40:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021740.q02HeKq8077968@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229300 - in stable/8/sys: cam/ata conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:40:21 -0000 Author: mav Date: Mon Jan 2 17:40:20 2012 New Revision: 229300 URL: http://svn.freebsd.org/changeset/base/229300 Log: MFC r228819: Update list of 4K physical sector hard drives. Modified: stable/8/sys/cam/ata/ata_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Mon Jan 2 17:39:18 2012 (r229299) +++ stable/8/sys/cam/ata/ata_da.c Mon Jan 2 17:40:20 2012 (r229300) @@ -163,6 +163,11 @@ static struct ada_quirk_entry ada_quirk_ }, { /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD155UI*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD204UI*", "*" }, /*quirks*/ADA_Q_4K }, @@ -172,6 +177,16 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* Seagate Barracuda Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???DM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Barracuda Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500423AS*", "*" }, /*quirks*/ADA_Q_4K @@ -183,6 +198,16 @@ static struct ada_quirk_entry ada_quirk_ }, { /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640424AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750420AS*", "*" }, /*quirks*/ADA_Q_4K }, @@ -192,6 +217,11 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Seagate Momentus Thin Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???LT*", "*" }, /*quirks*/ADA_Q_4K From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 17:58:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2D64106564A; Mon, 2 Jan 2012 17:58: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 DF75F8FC14; Mon, 2 Jan 2012 17:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02Hw7OA078830; Mon, 2 Jan 2012 17:58:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Hw7BP078824; Mon, 2 Jan 2012 17:58:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021758.q02Hw7BP078824@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229302 - in stable/8: sbin/geom/class/raid sbin/geom/class/sched sys/conf sys/geom/raid X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 17:58:08 -0000 Author: mav Date: Mon Jan 2 17:58:07 2012 New Revision: 229302 URL: http://svn.freebsd.org/changeset/base/229302 Log: MFC r226816: Clarify disks/volumes above 2TiB support in geom_raid: - add support for volumes above 2TiB with Promise metadata format; - enforse and document other limitations: - Intel and Promise metadata formats do not support disks above 2TiB; - NVIDIA metadata format does not support volumes above 2TiB. Sponsored by: iXsystems, Inc. Modified: stable/8/sbin/geom/class/raid/graid.8 stable/8/sys/geom/raid/md_intel.c stable/8/sys/geom/raid/md_nvidia.c stable/8/sys/geom/raid/md_promise.c Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/multipath/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/8/sbin/geom/class/raid/graid.8 Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sbin/geom/class/raid/graid.8 Mon Jan 2 17:58:07 2012 (r229302) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2011 +.Dd October 26, 2011 .Dt GRAID 8 .Os .Sh NAME @@ -250,6 +250,9 @@ If you started migration using BIOS or i complete it there. Do not run GEOM RAID class on migrating volumes under pain of possible data corruption! +.Sh 2TiB BARRIERS +Intel and Promise metadata formats do not support disks above 2TiB. +NVIDIA metadata format does not support volumes above 2TiB. .Sh EXIT STATUS Exit status is 0 on success, and non-zero if the command fails. .Sh SEE ALSO Modified: stable/8/sys/geom/raid/md_intel.c ============================================================================== --- stable/8/sys/geom/raid/md_intel.c Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sys/geom/raid/md_intel.c Mon Jan 2 17:58:07 2012 (r229302) @@ -1172,15 +1172,18 @@ g_raid_md_taste_intel(struct g_raid_md_o g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { - if (vendor == 0x8086) { + if (vendor != 0x8086) { + G_RAID_DEBUG(1, + "Intel vendor mismatch 0x%04x != 0x8086", + vendor); + } else if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + G_RAID_DEBUG(1, + "Intel disk '%s' is too big.", pp->name); + } else { G_RAID_DEBUG(1, "No Intel metadata, forcing spare."); spare = 2; goto search; - } else { - G_RAID_DEBUG(1, - "Intel vendor mismatch 0x%04x != 0x8086", - vendor); } } return (G_RAID_MD_TASTE_FAIL); @@ -1194,9 +1197,9 @@ g_raid_md_taste_intel(struct g_raid_md_o } if (meta->disk[disk_pos].sectors != (pp->mediasize / pp->sectorsize)) { - G_RAID_DEBUG(1, "Intel size mismatch %u != %u", - meta->disk[disk_pos].sectors, - (u_int)(pp->mediasize / pp->sectorsize)); + G_RAID_DEBUG(1, "Intel size mismatch %ju != %ju", + (off_t)meta->disk[disk_pos].sectors, + (off_t)(pp->mediasize / pp->sectorsize)); goto fail1; } @@ -1449,6 +1452,13 @@ g_raid_md_ctl_intel(struct g_raid_md_obj cp->private = disk; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + error = -8; + break; + } + error = g_raid_md_get_label(cp, &pd->pd_disk_meta.serial[0], INTEL_SERIAL_LEN); if (error != 0) { @@ -1940,6 +1950,14 @@ g_raid_md_ctl_intel(struct g_raid_md_obj pp = cp->provider; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + g_raid_kill_consumer(sc, cp); + error = -8; + break; + } + /* Read disk serial. */ error = g_raid_md_get_label(cp, &serial[0], INTEL_SERIAL_LEN); Modified: stable/8/sys/geom/raid/md_nvidia.c ============================================================================== --- stable/8/sys/geom/raid/md_nvidia.c Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sys/geom/raid/md_nvidia.c Mon Jan 2 17:58:07 2012 (r229302) @@ -1033,7 +1033,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob char arg[16]; const char *verb, *volname, *levelname, *diskname; int *nargs, *force; - off_t size, sectorsize, strip; + off_t size, sectorsize, strip, volsize; intmax_t *sizearg, *striparg; int numdisks, i, len, level, qual, update; int error; @@ -1182,7 +1182,20 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob gctl_error(req, "Size too small."); return (-13); } - if (size > 0xffffffffffffllu * sectorsize) { + + if (level == G_RAID_VOLUME_RL_RAID0 || + level == G_RAID_VOLUME_RL_CONCAT || + level == G_RAID_VOLUME_RL_SINGLE) + volsize = size * numdisks; + else if (level == G_RAID_VOLUME_RL_RAID1) + volsize = size; + else if (level == G_RAID_VOLUME_RL_RAID5) + volsize = size * (numdisks - 1); + else { /* RAID1E */ + volsize = ((size * numdisks) / strip / 2) * + strip; + } + if (volsize > 0xffffffffllu * sectorsize) { gctl_error(req, "Size too big."); return (-14); } @@ -1196,18 +1209,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob vol->v_raid_level_qualifier = G_RAID_VOLUME_RLQ_NONE; vol->v_strip_size = strip; vol->v_disks_count = numdisks; - if (level == G_RAID_VOLUME_RL_RAID0 || - level == G_RAID_VOLUME_RL_CONCAT || - level == G_RAID_VOLUME_RL_SINGLE) - vol->v_mediasize = size * numdisks; - else if (level == G_RAID_VOLUME_RL_RAID1) - vol->v_mediasize = size; - else if (level == G_RAID_VOLUME_RL_RAID5) - vol->v_mediasize = size * (numdisks - 1); - else { /* RAID1E */ - vol->v_mediasize = ((size * numdisks) / strip / 2) * - strip; - } + vol->v_mediasize = volsize; vol->v_sectorsize = sectorsize; g_raid_start_volume(vol); Modified: stable/8/sys/geom/raid/md_promise.c ============================================================================== --- stable/8/sys/geom/raid/md_promise.c Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sys/geom/raid/md_promise.c Mon Jan 2 17:58:07 2012 (r229302) @@ -121,7 +121,8 @@ struct promise_raid_conf { uint64_t rebuild_lba64; /* Per-volume rebuild position. */ uint32_t magic_4; uint32_t magic_5; - uint32_t filler3[325]; + uint32_t total_sectors_high; + uint32_t filler3[324]; uint32_t checksum; } __packed; @@ -213,6 +214,7 @@ g_raid_md_promise_print(struct promise_r printf("rebuild_lba64 %ju\n", meta->rebuild_lba64); printf("magic_4 0x%08x\n", meta->magic_4); printf("magic_5 0x%08x\n", meta->magic_5); + printf("total_sectors_high 0x%08x\n", meta->total_sectors_high); printf("=================================================\n"); } @@ -867,6 +869,9 @@ g_raid_md_promise_start(struct g_raid_vo vol->v_strip_size = 512 << meta->stripe_shift; //ZZZ vol->v_disks_count = meta->total_disks; vol->v_mediasize = (off_t)meta->total_sectors * 512; //ZZZ + if (meta->total_sectors_high < 256) /* If value looks sane. */ + vol->v_mediasize |= + ((off_t)meta->total_sectors_high << 32) * 512; //ZZZ vol->v_sectorsize = 512; //ZZZ for (i = 0; i < vol->v_disks_count; i++) { sd = &vol->v_subdisks[i]; @@ -1318,6 +1323,13 @@ g_raid_md_ctl_promise(struct g_raid_md_o cp->private = disk; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + error = -8; + break; + } + /* Read kernel dumping information. */ disk->d_kd.offset = 0; disk->d_kd.length = OFF_MAX; @@ -1609,8 +1621,17 @@ g_raid_md_ctl_promise(struct g_raid_md_o error = -4; break; } + pp = cp->provider; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + g_raid_kill_consumer(sc, cp); + error = -8; + break; + } + pd = malloc(sizeof(*pd), M_MD_PROMISE, M_WAITOK | M_ZERO); disk = g_raid_create_disk(sc); @@ -1716,6 +1737,8 @@ g_raid_md_write_promise(struct g_raid_md meta->array_width /= 2; meta->array_number = vol->v_global_id; meta->total_sectors = vol->v_mediasize / vol->v_sectorsize; + meta->total_sectors_high = + (vol->v_mediasize / vol->v_sectorsize) >> 32; meta->cylinders = meta->total_sectors / (255 * 63) - 1; meta->heads = 254; meta->sectors = 63; From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 19:23:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 332D2106566B; Mon, 2 Jan 2012 19:23:53 +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 1C9078FC08; Mon, 2 Jan 2012 19:23:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02JNq04082123; Mon, 2 Jan 2012 19:23:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JNqMC082121; Mon, 2 Jan 2012 19:23:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021923.q02JNqMC082121@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229308 - in stable/8/sys: conf geom/multipath X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 19:23:53 -0000 Author: mav Date: Mon Jan 2 19:23:52 2012 New Revision: 229308 URL: http://svn.freebsd.org/changeset/base/229308 Log: Forcefully reMFC r208082, r208101 (mjacob) MFCed at r207126 and r209278 and for some reason reverted at r209279 without reverting metadatata. Modified: stable/8/sys/geom/multipath/g_multipath.c Directory Properties: stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 18:59:55 2012 (r229307) +++ stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 19:23:52 2012 (r229308) @@ -197,7 +197,7 @@ g_multipath_done_error(struct bio *bp) break; } } - if (sc->cp_active == NULL) { + if (sc->cp_active == NULL || sc->cp_active->provider == NULL) { printf("GEOM_MULTIPATH: out of providers for %s\n", sc->sc_name); g_topology_unlock(); @@ -743,7 +743,7 @@ g_multipath_ctl_getactive(struct gctl_re return; } sc = gp->softc; - if (sc->cp_active) { + if (sc->cp_active && sc->cp_active->provider) { sbuf_printf(sb, "%s\n", sc->cp_active->provider->name); } else { sbuf_printf(sb, "none\n"); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 19:27:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98104106564A; Mon, 2 Jan 2012 19:27:24 +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 7EDE78FC13; Mon, 2 Jan 2012 19:27:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02JROYR082278; Mon, 2 Jan 2012 19:27:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JROpO082273; Mon, 2 Jan 2012 19:27:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021927.q02JROpO082273@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229309 - in stable/8: sbin/geom/class/multipath sbin/geom/class/sched sys/conf sys/geom/multipath X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 19:27:24 -0000 Author: mav Date: Mon Jan 2 19:27:23 2012 New Revision: 229309 URL: http://svn.freebsd.org/changeset/base/229309 Log: MFC r227464, r227471: Major GEOM MULTIPATH class rewrite: - Improved locking and destruction process to fix crashes. - Improved "automatic" configuration method to make it consistent and safe by reading metadata back from all specified paths after writing to one. - Added provider size check to reduce chance of ordering conflict with other GEOM classes. - Added "manual" configuration method without using on-disk metadata. - Added "add" and "remove" commands to allow manage paths manually. - Failed paths are no longer dropped from geom, but only marked as FAIL and excluded from I/O operations. - Automatically restore failed paths when all others paths are marked as failed, for example, because of device-caused (not transport) errors. - Added "fail" and "restore" commands to manually control FAIL flag. - geom is now destroyed on last path disconnection. - Added optional Active/Active mode support. Unlike Active/Passive mode, load evenly distributed between all working paths. If supported by the device, it allows to significantly improve performance, utilizing bandwidth of all paths. It is controlled by -A option during creation. Disabled by default now. - Improved `status` and `list` commands output. Sponsored by: iXsystems, inc. Modified: stable/8/sbin/geom/class/multipath/geom_multipath.c stable/8/sbin/geom/class/multipath/gmultipath.8 stable/8/sys/geom/multipath/g_multipath.c stable/8/sys/geom/multipath/g_multipath.h Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/multipath/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- stable/8/sbin/geom/class/multipath/geom_multipath.c Mon Jan 2 19:23:52 2012 (r229308) +++ stable/8/sbin/geom/class/multipath/geom_multipath.c Mon Jan 2 19:27:23 2012 (r229309) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -48,31 +49,58 @@ uint32_t version = G_MULTIPATH_VERSION; static void mp_main(struct gctl_req *, unsigned int); static void mp_label(struct gctl_req *); static void mp_clear(struct gctl_req *); -static void mp_add(struct gctl_req *); struct g_command class_commands[] = { { - "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, + { + { 'A', "active_active", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, "[-vA] name prov ..." }, { - "add", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, + { + { 'A', "active_active", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, "[-vA] name prov ..." }, { - "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + "add", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" }, { - "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, - NULL, "[-v] prov ..." + "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" + }, + { + "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" + }, + { + "restore", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" }, { "rotate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + NULL, "[-v] name" }, { "getactive", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name" + }, + { + "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name" + }, + { + "stop", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name" + }, + { + "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, NULL, "[-v] prov ..." }, G_CMD_SENTINEL @@ -90,8 +118,6 @@ mp_main(struct gctl_req *req, unsigned i } if (strcmp(name, "label") == 0) { mp_label(req); - } else if (strcmp(name, "add") == 0) { - mp_add(req); } else if (strcmp(name, "clear") == 0) { mp_clear(req); } else { @@ -103,13 +129,13 @@ static void mp_label(struct gctl_req *req) { struct g_multipath_metadata md; - off_t disksiz = 0, msize; - uint8_t *sector; + off_t disksize = 0, msize; + uint8_t *sector, *rsector; char *ptr; uuid_t uuid; uint32_t secsize = 0, ssize, status; - const char *name, *mpname; - int error, i, nargs; + const char *name, *name2, *mpname; + int error, i, nargs, fd; nargs = gctl_get_int(req, "nargs"); if (nargs < 2) { @@ -132,14 +158,14 @@ mp_label(struct gctl_req *req) } if (i == 1) { secsize = ssize; - disksiz = msize; + disksize = msize; } else { if (secsize != ssize) { gctl_error(req, "%s sector size %u different.", name, ssize); return; } - if (disksiz != msize) { + if (disksize != msize) { gctl_error(req, "%s media size %ju different.", name, (intmax_t)msize); return; @@ -155,7 +181,7 @@ mp_label(struct gctl_req *req) md.md_version = G_MULTIPATH_VERSION; mpname = gctl_get_ascii(req, "arg0"); strlcpy(md.md_name, mpname, sizeof(md.md_name)); - md.md_size = disksiz; + md.md_size = disksize; md.md_sectorsize = secsize; uuid_create(&uuid, &status); if (status != uuid_s_ok) { @@ -168,19 +194,10 @@ mp_label(struct gctl_req *req) return; } strlcpy(md.md_uuid, ptr, sizeof (md.md_uuid)); + md.md_active_active = gctl_get_int(req, "active_active"); free(ptr); /* - * Clear metadata on initial provider first. - */ - name = gctl_get_ascii(req, "arg1"); - error = g_metadata_clear(name, NULL); - if (error != 0) { - gctl_error(req, "cannot clear metadata on %s: %s.", name, strerror(error)); - return; - } - - /* * Allocate a sector to write as metadata. */ sector = malloc(secsize); @@ -189,6 +206,12 @@ mp_label(struct gctl_req *req) return; } memset(sector, 0, secsize); + rsector = malloc(secsize); + if (rsector == NULL) { + free(sector); + gctl_error(req, "unable to allocate metadata buffer"); + return; + } /* * encode the metadata @@ -198,6 +221,7 @@ mp_label(struct gctl_req *req) /* * Store metadata on the initial provider. */ + name = gctl_get_ascii(req, "arg1"); error = g_metadata_store(name, sector, secsize); if (error != 0) { gctl_error(req, "cannot store metadata on %s: %s.", name, strerror(error)); @@ -205,20 +229,29 @@ mp_label(struct gctl_req *req) } /* - * Now add the rest of the providers. + * Now touch the rest of the providers to hint retaste. */ - error = gctl_change_param(req, "verb", -1, "add"); - if (error) { - gctl_error(req, "unable to change verb to \"add\": %s.", strerror(error)); - return; - } for (i = 2; i < nargs; i++) { - error = gctl_change_param(req, "arg1", -1, gctl_get_ascii(req, "arg%d", i)); - if (error) { - gctl_error(req, "unable to add %s to %s: %s.", gctl_get_ascii(req, "arg%d", i), mpname, strerror(error)); + name2 = gctl_get_ascii(req, "arg%d", i); + fd = g_open(name2, 1); + if (fd < 0) { + fprintf(stderr, "Unable to open %s: %s.\n", + name2, strerror(errno)); + continue; + } + if (pread(fd, rsector, secsize, disksize - secsize) != + (ssize_t)secsize) { + fprintf(stderr, "Unable to read metadata from %s: %s.\n", + name2, strerror(errno)); + g_close(fd); continue; } - mp_add(req); + g_close(fd); + if (memcmp(sector, rsector, secsize)) { + fprintf(stderr, "No metadata found on %s." + " It is not a path of %s.\n", + name2, name); + } } } @@ -247,13 +280,3 @@ mp_clear(struct gctl_req *req) } } -static void -mp_add(struct gctl_req *req) -{ - const char *errstr; - - errstr = gctl_issue(req); - if (errstr != NULL && errstr[0] != '\0') { - gctl_error(req, "%s", errstr); - } -} Modified: stable/8/sbin/geom/class/multipath/gmultipath.8 ============================================================================== --- stable/8/sbin/geom/class/multipath/gmultipath.8 Mon Jan 2 19:23:52 2012 (r229308) +++ stable/8/sbin/geom/class/multipath/gmultipath.8 Mon Jan 2 19:27:23 2012 (r229309) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2007 +.Dd October 31, 2011 .Dt GMULTIPATH 8 .Os .Sh NAME @@ -32,11 +32,48 @@ .Nd "disk multipath control utility" .Sh SYNOPSIS .Nm +.Cm create +.Op Fl Av +.Ar name +.Ar prov ... +.Nm .Cm label -.Op Fl hv +.Op Fl Av .Ar name .Ar prov ... .Nm +.Cm add +.Op Fl v +.Ar name prov +.Nm +.Cm remove +.Op Fl v +.Ar name prov +.Nm +.Cm fail +.Op Fl v +.Ar name prov +.Nm +.Cm restore +.Op Fl v +.Ar name prov +.Nm +.Cm rotate +.Op Fl v +.Ar name +.Nm +.Cm getactive +.Op Fl v +.Ar name +.Nm +.Cm destroy +.Op Fl v +.Ar name +.Nm +.Cm stop +.Op Fl v +.Ar name +.Nm .Cm clear .Op Fl v .Ar prov ... @@ -53,27 +90,79 @@ The .Nm utility is used for device multipath configuration. .Pp -Only automatic configuration is supported at the present time via the -.Cm label -command. -This operation writes a label on the last sector of the underlying -disk device with a contained name and UUID. -The UUID guarantees uniqueness -in a shared storage environment but is in general too cumbersome to use. +The multipath device can be configured using two different methods: +.Dq manual +or +.Dq automatic . +When using the +.Dq manual +method, no metadata are stored on the devices, so the multipath +device has to be configured by hand every time it is needed. +Additional device paths also won't be detected automatically. +The +.Dq automatic +method uses on-disk metadata to detect device and all it's paths. +Metadata use the last sector of the underlying disk device and +include device name and UUID. +The UUID guarantees uniqueness in a shared storage environment +but is in general too cumbersome to use. The name is what is exported via the device interface. .Pp The first argument to .Nm indicates an action to be performed: .Bl -tag -width ".Cm destroy" +.It Cm create +Create multipath device with +.Dq manual +method without writing any on-disk metadata. +It is up to administrator, how to properly identify device paths. +Kernel will only check that all given providers have same media and +sector sizes. +.Pp +.Fl A +option enables Active/Active mode, otherwise Active/Passive mode is used +by default. .It Cm label -Label the given underlying device with the specified +Create multipath device with +.Dq automatic +method. +Label the first given provider with on-disk metadata using the specified .Ar name . -The kernel module -.Pa geom_multipath.ko -will be loaded if it is not loaded already. +The rest of given providers will be retasted to detect these metadata. +It reliably protects against specifying unrelated providers. +Providers with no matching metadata detected will not be added to the device. +.Pp +.Fl A +option enables Active/Active mode, otherwise Active/Passive mode is used +by default. +.It Cm add +Add the given provider as a path to the given multipath device. +Should normally be used only for devices created with +.Dq manual +method, unless you know what you are doing (you are sure that it is another +device path, but tasting its metadata in regular +.Dq automatic +way is not possible). +.It Cm remove +Remove the given provider as a path from the given multipath device. +If the last path removed, the multipath device will be destroyed. +.It Cm fail +Mark specified provider as a path of the specified multipath device as failed. +If there are other paths present, new requests will be forwarded there. +.It Cm restore +Mark specified provider as a path of the specified multipath device as +operational, allowing it to handle requests. +.It Cm rotate +Change the active provider/path in Active/Passive mode. +.It Cm getactive +Get the currently active provider(s)/path(s). +.It Cm destroy +Destroy the given multipath device clearing metadata. +.It Cm stop +Stop the given multipath device without clearing metadata. .It Cm clear -Clear metadata on the given device. +Clear metadata on the given provider. .It Cm list See .Xr geom 8 . @@ -101,14 +190,15 @@ Debug level of the GEOM class. This can be set to 0 (default) or 1 to disable or enable various forms of chattiness. +.It Va kern.geom.multipath.exclusive : No 1 +Open underlying providers exclusively, preventing individual paths access. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh MULTIPATH ARCHITECTURE .Pp -This is an active/passive -multiple path architecture with no device knowledge or presumptions other -than size matching built in. +This is a multiple path architecture with no device knowledge or +presumptions other than size matching built in. Therefore the user must exercise some care in selecting providers that do indeed represent multiple paths to the same underlying disk device. @@ -133,15 +223,16 @@ of multiple pathnames refer to the same system operator who will use tools and knowledge of their own storage subsystem to make the correct configuration selection. .Pp -As an active/passive architecture, only one path has I/O moving on it +There are Active/Passive and Active/Active operation modes supported. +In Active/Passive mode only one path has I/O moving on it at any point in time. This I/O continues until an I/O is returned with a generic I/O error or a "Nonexistent Device" error. -When this occurs, -the active device is kicked out of the -.Nm MULTIPATH -GEOM class and the next in a list is selected, the failed I/O reissued -and the system proceeds. +When this occurs, that path is marked FAIL, the next path +in a list is selected as active and the failed I/O reissued. +In Active/Active mode all paths not marked FAIL may handle I/O same time. +Requests are distributed between paths to equalize load. +For capable devices it allows to utilize bandwidth of all paths. .Pp When new devices are added to the system the .Nm MULTIPATH @@ -149,9 +240,9 @@ GEOM class is given an opportunity to ta If a new device has a .Nm MULTIPATH -label, the device is used to either create a new +on-disk metadata label, the device is used to either create a new .Nm MULTIPATH -GEOM, or to attach to the end of the list of devices for an existing +GEOM, or been added the list of paths for an existing .Nm MULTIPATH GEOM. .Pp @@ -176,7 +267,7 @@ of an RSCN event from the Fabric Domain a rescan to occur and cause the attachment and configuration of any (now) new devices to occur, causing the taste event described above. .Pp -This means that this active/passive architecture is not a one-shot path +This means that this multipath architecture is not a one-shot path failover, but can be considered to be steady state as long as failed paths are repaired (automatically or otherwise). .Pp @@ -184,7 +275,7 @@ Automatic rescanning is not a requiremen Nor is Fibre Channel. The same failover mechanisms work equally well for traditional "Parallel" -SCSI but require manual intervention with +SCSI but may require manual intervention with .Xr camcontrol 8 to cause the reattachment of repaired device links. .Sh EXAMPLES @@ -226,9 +317,9 @@ mount /dev/multipath/FREDa /mnt.... .Pp The resultant console output looks something like: .Bd -literal -offset indent -GEOM_MULTIPATH: adding da0 to Fred/b631385f-c61c-11db-b884-0011116ae789 -GEOM_MULTIPATH: da0 now active path in Fred -GEOM_MULTIPATH: adding da2 to Fred/b631385f-c61c-11db-b884-0011116ae789 +GEOM_MULTIPATH: da0 added to FRED +GEOM_MULTIPATH: da0 is now active path in FRED +GEOM_MULTIPATH: da2 added to FRED .Ed .Sh SEE ALSO .Xr geom 4 , @@ -240,24 +331,6 @@ GEOM_MULTIPATH: adding da2 to Fred/b6313 .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 -.Sh BUGS -The -.Nm -should allow for a manual method of pairing disks. -.Pp -There is currently no way for -.Pa geom_multipath.ko -to distinguish between various label instances of the same provider. -That -is devices such as -.Ar da0 -and -.Ar da0c -can be tasted and instantiated as multiple paths for the same device. -Technically, this is correct, but pretty useless. -This will be fixed soon -(I hope), but to avoid this it is a good idea to destroy any label on -the disk object prior to labelling it with -.Nm . .Sh AUTHOR .An Matthew Jacob Aq mjacob@FreeBSD.org +.An Alexander Motin Aq mav@FreeBSD.org Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 19:23:52 2012 (r229308) +++ stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 19:27:23 2012 (r229309) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2011 Alexander Motin * Copyright (c) 2006-2007 Matthew Jacob * All rights reserved. * @@ -51,6 +52,9 @@ SYSCTL_NODE(_kern_geom, OID_AUTO, multip static u_int g_multipath_debug = 0; SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, debug, CTLFLAG_RW, &g_multipath_debug, 0, "Debug level"); +static u_int g_multipath_exclusive = 1; +SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW, + &g_multipath_exclusive, 0, "Exclusively open providers"); static enum { GKT_NIL, @@ -77,6 +81,7 @@ static g_taste_t g_multipath_taste; static g_ctl_req_t g_multipath_config; static g_init_t g_multipath_init; static g_fini_t g_multipath_fini; +static g_dumpconf_t g_multipath_dumpconf; struct g_class g_multipath_class = { .name = G_MULTIPATH_CLASS_NAME, @@ -88,35 +93,144 @@ struct g_class g_multipath_class = { .fini = g_multipath_fini }; -#define MP_BAD 0x1 -#define MP_POSTED 0x2 +#define MP_FAIL 0x00000001 +#define MP_LOST 0x00000002 +#define MP_NEW 0x00000004 +#define MP_POSTED 0x00000008 +#define MP_BAD (MP_FAIL | MP_LOST | MP_NEW) +#define MP_IDLE 0x00000010 +#define MP_IDLE_MASK 0xfffffff0 + +static int +g_multipath_good(struct g_geom *gp) +{ + struct g_consumer *cp; + int n = 0; + + LIST_FOREACH(cp, &gp->consumer, consumer) { + if ((cp->index & MP_BAD) == 0) + n++; + } + return (n); +} + +static void +g_multipath_fault(struct g_consumer *cp, int cause) +{ + struct g_multipath_softc *sc; + struct g_consumer *lcp; + struct g_geom *gp; + + gp = cp->geom; + sc = gp->softc; + cp->index |= cause; + if (g_multipath_good(gp) == 0 && sc->sc_ndisks > 0) { + LIST_FOREACH(lcp, &gp->consumer, consumer) { + if (lcp->provider == NULL || + (lcp->index & (MP_LOST | MP_NEW))) + continue; + if (sc->sc_ndisks > 1 && lcp == cp) + continue; + printf("GEOM_MULTIPATH: " + "all paths in %s were marked FAIL, restore %s\n", + sc->sc_name, lcp->provider->name); + lcp->index &= ~MP_FAIL; + } + } + if (cp != sc->sc_active) + return; + sc->sc_active = NULL; + LIST_FOREACH(lcp, &gp->consumer, consumer) { + if ((lcp->index & MP_BAD) == 0) { + sc->sc_active = lcp; + break; + } + } + if (sc->sc_active == NULL) { + printf("GEOM_MULTIPATH: out of providers for %s\n", + sc->sc_name); + } else if (!sc->sc_active_active) { + printf("GEOM_MULTIPATH: %s is now active path in %s\n", + sc->sc_active->provider->name, sc->sc_name); + } +} + +static struct g_consumer * +g_multipath_choose(struct g_geom *gp) +{ + struct g_multipath_softc *sc; + struct g_consumer *best, *cp; + + sc = gp->softc; + if (!sc->sc_active_active) + return (sc->sc_active); + best = NULL; + LIST_FOREACH(cp, &gp->consumer, consumer) { + if (cp->index & MP_BAD) + continue; + cp->index += MP_IDLE; + if (best == NULL || cp->private < best->private || + (cp->private == best->private && cp->index > best->index)) + best = cp; + } + if (best != NULL) + best->index &= ~MP_IDLE_MASK; + return (best); +} static void g_mpd(void *arg, int flags __unused) { + struct g_geom *gp; + struct g_multipath_softc *sc; struct g_consumer *cp; + int w; g_topology_assert(); cp = arg; - if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + gp = cp->geom; + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) { + w = cp->acw; g_access(cp, -cp->acr, -cp->acw, -cp->ace); + if (w > 0 && cp->provider != NULL && + (cp->provider->geom->flags & G_GEOM_WITHER) == 0) { + g_post_event(g_mpd, cp, M_WAITOK, NULL); + return; + } + } + sc = gp->softc; + mtx_lock(&sc->sc_mtx); if (cp->provider) { printf("GEOM_MULTIPATH: %s removed from %s\n", - cp->provider->name, cp->geom->name); + cp->provider->name, gp->name); g_detach(cp); } g_destroy_consumer(cp); + mtx_unlock(&sc->sc_mtx); + if (LIST_EMPTY(&gp->consumer)) + g_multipath_destroy(gp); } static void g_multipath_orphan(struct g_consumer *cp) { - if ((cp->index & MP_POSTED) == 0) { + struct g_multipath_softc *sc; + uintptr_t *cnt; + + g_topology_assert(); + printf("GEOM_MULTIPATH: %s in %s was disconnected\n", + cp->provider->name, cp->geom->name); + sc = cp->geom->softc; + cnt = (uintptr_t *)&cp->private; + mtx_lock(&sc->sc_mtx); + sc->sc_ndisks--; + g_multipath_fault(cp, MP_LOST); + if (*cnt == 0 && (cp->index & MP_POSTED) == 0) { cp->index |= MP_POSTED; - printf("GEOM_MULTIPATH: %s orphaned in %s\n", - cp->provider->name, cp->geom->name); + mtx_unlock(&sc->sc_mtx); g_mpd(cp, 0); - } + } else + mtx_unlock(&sc->sc_mtx); } static void @@ -126,20 +240,29 @@ g_multipath_start(struct bio *bp) struct g_geom *gp; struct g_consumer *cp; struct bio *cbp; + uintptr_t *cnt; gp = bp->bio_to->geom; sc = gp->softc; KASSERT(sc != NULL, ("NULL sc")); - cp = sc->cp_active; - if (cp == NULL) { - g_io_deliver(bp, ENXIO); - return; - } cbp = g_clone_bio(bp); if (cbp == NULL) { g_io_deliver(bp, ENOMEM); return; } + mtx_lock(&sc->sc_mtx); + cp = g_multipath_choose(gp); + if (cp == NULL) { + mtx_unlock(&sc->sc_mtx); + g_destroy_bio(cbp); + g_io_deliver(bp, ENXIO); + return; + } + if ((uintptr_t)bp->bio_driver1 < sc->sc_ndisks) + bp->bio_driver1 = (void *)(uintptr_t)sc->sc_ndisks; + cnt = (uintptr_t *)&cp->private; + (*cnt)++; + mtx_unlock(&sc->sc_mtx); cbp->bio_done = g_multipath_done; g_io_request(cbp, cp); } @@ -147,12 +270,27 @@ g_multipath_start(struct bio *bp) static void g_multipath_done(struct bio *bp) { + struct g_multipath_softc *sc; + struct g_consumer *cp; + uintptr_t *cnt; + if (bp->bio_error == ENXIO || bp->bio_error == EIO) { mtx_lock(&gmtbq_mtx); bioq_insert_tail(&gmtbq, bp); - wakeup(&g_multipath_kt_state); mtx_unlock(&gmtbq_mtx); + wakeup(&g_multipath_kt_state); } else { + cp = bp->bio_from; + sc = cp->geom->softc; + cnt = (uintptr_t *)&cp->private; + mtx_lock(&sc->sc_mtx); + (*cnt)--; + if (*cnt == 0 && (cp->index & MP_LOST)) { + cp->index |= MP_POSTED; + mtx_unlock(&sc->sc_mtx); + g_post_event(g_mpd, cp, M_WAITOK, NULL); + } else + mtx_unlock(&sc->sc_mtx); g_std_done(bp); } } @@ -165,6 +303,7 @@ g_multipath_done_error(struct bio *bp) struct g_multipath_softc *sc; struct g_consumer *cp; struct g_provider *pp; + uintptr_t *cnt; /* * If we had a failure, we have to check first to see @@ -174,47 +313,31 @@ g_multipath_done_error(struct bio *bp) * to the next available consumer. */ - g_topology_lock(); pbp = bp->bio_parent; gp = pbp->bio_to->geom; sc = gp->softc; cp = bp->bio_from; pp = cp->provider; + cnt = (uintptr_t *)&cp->private; - cp->index |= MP_BAD; - if (cp->nend == cp->nstart && pp->nend == pp->nstart) { + mtx_lock(&sc->sc_mtx); + printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n", + bp->bio_error, pp->name, sc->sc_name); + g_multipath_fault(cp, MP_FAIL); + (*cnt)--; + if (*cnt == 0 && (cp->index & (MP_LOST | MP_POSTED)) == MP_LOST) { cp->index |= MP_POSTED; - g_post_event(g_mpd, cp, M_NOWAIT, NULL); - } - if (cp == sc->cp_active) { - struct g_consumer *lcp; - printf("GEOM_MULTIPATH: %s failed in %s\n", - pp->name, sc->sc_name); - sc->cp_active = NULL; - LIST_FOREACH(lcp, &gp->consumer, consumer) { - if ((lcp->index & MP_BAD) == 0) { - sc->cp_active = lcp; - break; - } - } - if (sc->cp_active == NULL || sc->cp_active->provider == NULL) { - printf("GEOM_MULTIPATH: out of providers for %s\n", - sc->sc_name); - g_topology_unlock(); - return; - } else { - printf("GEOM_MULTIPATH: %s now active path in %s\n", - sc->cp_active->provider->name, sc->sc_name); - } - } - g_topology_unlock(); + mtx_unlock(&sc->sc_mtx); + g_post_event(g_mpd, cp, M_WAITOK, NULL); + } else + mtx_unlock(&sc->sc_mtx); /* * If we can fruitfully restart the I/O, do so. */ - if (sc->cp_active) { + if (pbp->bio_children < (uintptr_t)pbp->bio_driver1) { + pbp->bio_inbed++; g_destroy_bio(bp); - pbp->bio_children--; g_multipath_start(pbp); } else { g_std_done(bp); @@ -252,6 +375,7 @@ g_multipath_access(struct g_provider *pp { struct g_geom *gp; struct g_consumer *cp, *badcp = NULL; + struct g_multipath_softc *sc; int error; gp = pp->geom; @@ -263,6 +387,10 @@ g_multipath_access(struct g_provider *pp goto fail; } } + sc = gp->softc; + sc->sc_opened += dr + dw + de; + if (sc->sc_stopping && sc->sc_opened == 0) + g_multipath_destroy(gp); return (0); fail: @@ -284,6 +412,9 @@ g_multipath_create(struct g_class *mp, s g_topology_assert(); LIST_FOREACH(gp, &mp->geom, geom) { + sc = gp->softc; + if (sc == NULL || sc->sc_stopping) + continue; if (strcmp(gp->name, md->md_name) == 0) { printf("GEOM_MULTIPATH: name %s already exists\n", md->md_name); @@ -293,19 +424,25 @@ g_multipath_create(struct g_class *mp, s gp = g_new_geomf(mp, md->md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); + mtx_init(&sc->sc_mtx, "multipath", NULL, MTX_DEF); + memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); + memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); + sc->sc_active_active = md->md_active_active; gp->softc = sc; gp->start = g_multipath_start; gp->orphan = g_multipath_orphan; gp->access = g_multipath_access; - memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); - memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); + gp->dumpconf = g_multipath_dumpconf; pp = g_new_providerf(gp, "multipath/%s", md->md_name); - /* limit the provider to not have it stomp on metadata */ - pp->mediasize = md->md_size - md->md_sectorsize; - pp->sectorsize = md->md_sectorsize; - sc->pp = pp; + if (md->md_size != 0) { + pp->mediasize = md->md_size - + ((md->md_uuid[0] != 0) ? md->md_sectorsize : 0); + pp->sectorsize = md->md_sectorsize; + } + sc->sc_pp = pp; g_error_provider(pp, 0); + printf("GEOM_MULTIPATH: %s created\n", gp->name); return (gp); } @@ -314,7 +451,7 @@ g_multipath_add_disk(struct g_geom *gp, { struct g_multipath_softc *sc; struct g_consumer *cp, *nxtcp; - int error; + int error, acr, acw, ace; g_topology_assert(); @@ -335,6 +472,8 @@ g_multipath_add_disk(struct g_geom *gp, } nxtcp = LIST_FIRST(&gp->consumer); cp = g_new_consumer(gp); + cp->private = NULL; + cp->index = MP_NEW; error = g_attach(cp, pp); if (error != 0) { printf("GEOM_MULTIPATH: cannot attach %s to %s", @@ -342,29 +481,51 @@ g_multipath_add_disk(struct g_geom *gp, g_destroy_consumer(cp); return (error); } - cp->private = sc; - cp->index = 0; /* * Set access permissions on new consumer to match other consumers */ - if (nxtcp && (nxtcp->acr + nxtcp->acw + nxtcp->ace)) { - error = g_access(cp, nxtcp->acr, nxtcp->acw, nxtcp->ace); - if (error) { - printf("GEOM_MULTIPATH: cannot set access in " - "attaching %s to %s/%s (%d)\n", - pp->name, sc->sc_name, sc->sc_uuid, error); - g_detach(cp); - g_destroy_consumer(cp); - return (error); - } + if (sc->sc_pp) { + acr = sc->sc_pp->acr; + acw = sc->sc_pp->acw; + ace = sc->sc_pp->ace; + } else + acr = acw = ace = 0; + if (g_multipath_exclusive) { + acr++; + acw++; + ace++; + } + error = g_access(cp, acr, acw, ace); + if (error) { + printf("GEOM_MULTIPATH: cannot set access in " + "attaching %s to %s (%d)\n", + pp->name, sc->sc_name, error); + g_detach(cp); + g_destroy_consumer(cp); + return (error); } - printf("GEOM_MULTIPATH: adding %s to %s/%s\n", - pp->name, sc->sc_name, sc->sc_uuid); - if (sc->cp_active == NULL) { - sc->cp_active = cp; - printf("GEOM_MULTIPATH: %s now active path in %s\n", - pp->name, sc->sc_name); + if (sc->sc_pp != NULL && sc->sc_pp->mediasize == 0) { + sc->sc_pp->mediasize = pp->mediasize - + ((sc->sc_uuid[0] != 0) ? pp->sectorsize : 0); + sc->sc_pp->sectorsize = pp->sectorsize; + } + if (sc->sc_pp != NULL && + sc->sc_pp->stripesize == 0 && sc->sc_pp->stripeoffset == 0) { + sc->sc_pp->stripesize = pp->stripesize; + sc->sc_pp->stripeoffset = pp->stripeoffset; + } + mtx_lock(&sc->sc_mtx); + cp->index = 0; + sc->sc_ndisks++; + mtx_unlock(&sc->sc_mtx); + printf("GEOM_MULTIPATH: %s added to %s\n", + pp->name, sc->sc_name); + if (sc->sc_active == NULL) { + sc->sc_active = cp; + if (!sc->sc_active_active) + printf("GEOM_MULTIPATH: %s is now active path in %s\n", + pp->name, sc->sc_name); } return (0); } @@ -372,17 +533,41 @@ g_multipath_add_disk(struct g_geom *gp, static int g_multipath_destroy(struct g_geom *gp) { - struct g_provider *pp; + struct g_multipath_softc *sc; + struct g_consumer *cp, *cp1; g_topology_assert(); if (gp->softc == NULL) return (ENXIO); - pp = LIST_FIRST(&gp->provider); - if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) - return (EBUSY); - printf("GEOM_MULTIPATH: destroying %s\n", gp->name); + sc = gp->softc; + if (!sc->sc_stopping) { + printf("GEOM_MULTIPATH: destroying %s\n", gp->name); + sc->sc_stopping = 1; + } + if (sc->sc_opened != 0) { + if (sc->sc_pp != NULL) { + g_wither_provider(sc->sc_pp, ENXIO); + sc->sc_pp = NULL; + } + return (EINPROGRESS); + } + LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp1) { + mtx_lock(&sc->sc_mtx); + if ((cp->index & MP_POSTED) == 0) { + cp->index |= MP_POSTED; + mtx_unlock(&sc->sc_mtx); + g_mpd(cp, 0); + if (cp1 == NULL) + return(0); /* Recursion happened. */ + } else + mtx_unlock(&sc->sc_mtx); + } + if (!LIST_EMPTY(&gp->consumer)) + return (EINPROGRESS); + mtx_destroy(&sc->sc_mtx); g_free(gp->softc); gp->softc = NULL; + printf("GEOM_MULTIPATH: %s destroyed\n", gp->name); g_wither_geom(gp, ENXIO); return (0); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 19:45:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D105C106566B; Mon, 2 Jan 2012 19:45:30 +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 BAD2B8FC16; Mon, 2 Jan 2012 19:45:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02JjUVP083208; Mon, 2 Jan 2012 19:45:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JjUhT083206; Mon, 2 Jan 2012 19:45:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021945.q02JjUhT083206@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229311 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 19:45:30 -0000 Author: mav Date: Mon Jan 2 19:45:30 2012 New Revision: 229311 URL: http://svn.freebsd.org/changeset/base/229311 Log: MFC r228305: Mention that Cold Presence Detection feature used for hot-plug detection when interface power management is enabled. Modified: stable/8/share/man/man4/ahci.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ahci.4 ============================================================================== --- stable/8/share/man/man4/ahci.4 Mon Jan 2 19:44:34 2012 (r229310) +++ stable/8/share/man/man4/ahci.4 Mon Jan 2 19:45:30 2012 (r229311) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2011 +.Dd December 6, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -91,9 +91,9 @@ Some controllers, such as ICH8, do not i Because of artificial entering latency, performance degradation in modes 4 and 5 is much smaller then in modes 2 and 3. .Pp -Note that interface Power Management is not compatible with -device presence detection. -A manual bus reset is needed on device hot-plug. +Note that interface Power Management complicates device presence detection. +A manual bus reset/rescan may be needed after device hot-plug, unless hardware +implements Cold Presence Detection. .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 22:12:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9C35106566C; Mon, 2 Jan 2012 22:12:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3BC38FC17; Mon, 2 Jan 2012 22:12:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02MCA0h089997; Mon, 2 Jan 2012 22:12:10 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MCAe3089995; Mon, 2 Jan 2012 22:12:10 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022212.q02MCAe3089995@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:12:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229321 - stable/8/share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 22:12:10 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:12:10 2012 New Revision: 229321 URL: http://svn.freebsd.org/changeset/base/229321 Log: MFC r228419: r228419: - Minor whitespace cleanup to make.conf(5) Modified: stable/8/share/man/man5/make.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/make.conf.5 ============================================================================== --- stable/8/share/man/man5/make.conf.5 Mon Jan 2 22:11:08 2012 (r229320) +++ stable/8/share/man/man5/make.conf.5 Mon Jan 2 22:12:10 2012 (r229321) @@ -479,7 +479,7 @@ rather than load the server's kernel. .Pq Vt bool Defining this and recompiling .Pa /usr/src/sys/boot/i386 -will add +will add .Xr dcons 4 console driver to .Xr loader 8 @@ -619,7 +619,7 @@ The default value is 0640. .Pq Vt str Additional maps to rebuild when using .Pa /etc/mail/Makefile . -The +The .Pa access , .Pa bitdomain , .Pa domaintable , From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 22:19:12 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AE561065680; Mon, 2 Jan 2012 22:19:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15A578FC1A; Mon, 2 Jan 2012 22:19:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02MJBK9090399; Mon, 2 Jan 2012 22:19:11 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MJBN8090397; Mon, 2 Jan 2012 22:19:11 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022219.q02MJBN8090397@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229325 - stable/8/usr.bin/hexdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 22:19:12 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:19:11 2012 New Revision: 229325 URL: http://svn.freebsd.org/changeset/base/229325 Log: MFC r209035, r228823: r209035 (uqs): - Use same table markup as in hexdump.1 r228823: - Enclose tabbed content in quotes Modified: stable/8/usr.bin/hexdump/od.1 Directory Properties: stable/8/usr.bin/hexdump/ (props changed) Modified: stable/8/usr.bin/hexdump/od.1 ============================================================================== --- stable/8/usr.bin/hexdump/od.1 Mon Jan 2 22:18:07 2012 (r229324) +++ stable/8/usr.bin/hexdump/od.1 Mon Jan 2 22:19:11 2012 (r229325) @@ -32,7 +32,7 @@ .\" @(#)od.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 18, 2010 +.Dd December 22, 2011 .Dt OD 1 .Os .Sh NAME @@ -151,11 +151,11 @@ Named characters Control characters are displayed using the following names: .Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ" .It "000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ" -.It "006 ACK 007 BEL 008 BS 009 HT 00a NL 00b VT" -.It "00c FF 00d CR 00e SO 00f SI 010 DLE 011 DC1" +.It "006 ACK 007 BEL 008 BS 009 HT 00A NL 00B VT" +.It "00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1" .It "012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB" -.It "018 CAN 019 EM 01a SUB 01b ESC 01c FS 01d GS" -.It "01e RS 01f US 020 SP 07f DEL" +.It "018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS" +.It "01E RS 01F US 020 SP 07F DEL" .El .It Cm c Characters in the default character set. From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 22:22:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D81A1065673; Mon, 2 Jan 2012 22:22:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 081D08FC20; Mon, 2 Jan 2012 22:22:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02MMJRB090606; Mon, 2 Jan 2012 22:22:19 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MMJEv090604; Mon, 2 Jan 2012 22:22:19 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022222.q02MMJEv090604@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229327 - stable/8/usr.bin/ar X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 22:22:20 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:22:19 2012 New Revision: 229327 URL: http://svn.freebsd.org/changeset/base/229327 Log: MFC r228823, r228824: r228823: - Properly escape a special character - Enclose tabbed content in quotes r228824: - Remove trailing whitespace Modified: stable/8/usr.bin/ar/ar.1 Directory Properties: stable/8/usr.bin/ar/ (props changed) Modified: stable/8/usr.bin/ar/ar.1 ============================================================================== --- stable/8/usr.bin/ar/ar.1 Mon Jan 2 22:19:55 2012 (r229326) +++ stable/8/usr.bin/ar/ar.1 Mon Jan 2 22:22:19 2012 (r229327) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2010 +.Dd December 22, 2011 .Dt AR 1 .Os .Sh NAME @@ -198,11 +198,11 @@ from the archive specified by argument The archive's symbol table, if present, is updated to reflect the new contents of the archive. .It Fl D -When used in combination with the +When used in combination with the .Fl r or .Fl q -option, insert 0's instead of the real mtime, uid and gid values +option, insert 0's instead of the real mtime, uid and gid values and 0644 instead of file mode from the members named by arguments .Ar . This ensures that checksums on the resulting archives are reproducible @@ -414,7 +414,7 @@ character. The .Dq Li * and -.Dq Li "\;" +.Dq Li "\&;" characters start a comment. Comments extend till the end of the line. .Pp @@ -531,7 +531,7 @@ using MRI librarian commands, use the fo .Bd -literal -offset indent create ex.a * specify the output archive addmod ex1.o ex2.o * add modules -save * save pending changes +save * save pending changes end * exit the utility .Ed .Sh DIAGNOSTICS From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 22:25:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FFF3106566C; Mon, 2 Jan 2012 22:25:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 698D68FC0C; Mon, 2 Jan 2012 22:25:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02MPsS1090840; Mon, 2 Jan 2012 22:25:54 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MPsH1090837; Mon, 2 Jan 2012 22:25:54 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022225.q02MPsH1090837@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229330 - stable/8/lib/libc/stdlib X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 22:25:55 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:25:54 2012 New Revision: 229330 URL: http://svn.freebsd.org/changeset/base/229330 Log: MFC r228885: r228885: - Add missing opening and closing brackets in getopt_long.3 and getsubopt.3 to make the examples reflect reality more closely. Modified: stable/8/lib/libc/stdlib/getopt_long.3 stable/8/lib/libc/stdlib/getsubopt.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdlib/getopt_long.3 ============================================================================== --- stable/8/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:25:21 2012 (r229329) +++ stable/8/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:25:54 2012 (r229330) @@ -31,7 +31,7 @@ .\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd April 1, 2000 +.Dd December 25, 2011 .Dt GETOPT_LONG 3 .Os .Sh NAME @@ -239,7 +239,7 @@ static struct option longopts[] = { }; bflag = 0; -while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) +while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) { switch (ch) { case 'b': bflag = 1; @@ -256,6 +256,7 @@ while ((ch = getopt_long(argc, argv, "bf break; default: usage(); + } } argc -= optind; argv += optind; Modified: stable/8/lib/libc/stdlib/getsubopt.3 ============================================================================== --- stable/8/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:25:21 2012 (r229329) +++ stable/8/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:25:54 2012 (r229330) @@ -28,7 +28,7 @@ .\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 25, 2011 .Dt GETSUBOPT 3 .Os .Sh NAME @@ -131,9 +131,11 @@ while ((ch = getopt(argc, argv, "ab:")) else error("missing sub option"); break; + } } break; } +} .Ed .Sh SEE ALSO .Xr getopt 3 , From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:20:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE0B3106566B; Mon, 2 Jan 2012 23:20: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 3130B8FC17; Mon, 2 Jan 2012 23:20:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02NKNwa093042; Mon, 2 Jan 2012 23:20:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NKNQO093040; Mon, 2 Jan 2012 23:20:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022320.q02NKNQO093040@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229334 - in stable/8/sys: conf dev/dc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:20:24 -0000 Author: yongari Date: Mon Jan 2 23:20:22 2012 New Revision: 229334 URL: http://svn.freebsd.org/changeset/base/229334 Log: MFC r226699: When driver is run for the first time there would be no established link such that calling dc_setcfg() right after media change would be meaningless unless controller in question is not Davicom DM9102. Ideally dc_setcfg() should be called when speed/duplex is resolved otherwise it would reprogram controller with wrong speed/duplex information. Because MII status change callback already calls dc_setcfg() I think calling dc_setcfg() in dc_init_locked() is wrong. For instance, it would take some time to establish a link after mii_mediachg(), so blindly calling dc_setcfg() right after mii_mediachg() will always yield wrong media configuration. Extend dc_ifmedia_upd() to handle media change and still allow 21143 and Davidcom controllers program speed/duplex regardless of current resolved speed/duplex of link. In theory 21143 may not need to call dc_setcfg() right after media change, but leave it as it is because there are too many variants to test that change. Probably dc(4) shall need a PHY reset in dc_ifmedia_upd() but it's hard to verify correctness of the change. This change reliably makes ULi M5263 establish a link. While I'm here correctly report media change result. Previously it always reported a success. Modified: stable/8/sys/dev/dc/if_dc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:17:45 2012 (r229333) +++ stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:20:22 2012 (r229334) @@ -253,6 +253,7 @@ static void dc_stop(struct dc_softc *); static void dc_watchdog(void *); static int dc_shutdown(device_t); static int dc_ifmedia_upd(struct ifnet *); +static int dc_ifmedia_upd_locked(struct dc_softc *); static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int dc_dma_alloc(struct dc_softc *); @@ -3604,8 +3605,7 @@ dc_init_locked(struct dc_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - mii_mediachg(mii); - dc_setcfg(sc, sc->dc_if_media); + dc_ifmedia_upd_locked(sc); /* Clear missed frames and overflow counter. */ CSR_READ_4(sc, DC_FRAMESDISCARDED); @@ -3631,25 +3631,37 @@ static int dc_ifmedia_upd(struct ifnet *ifp) { struct dc_softc *sc; - struct mii_data *mii; - struct ifmedia *ifm; + int error; sc = ifp->if_softc; - mii = device_get_softc(sc->dc_miibus); DC_LOCK(sc); - mii_mediachg(mii); - ifm = &mii->mii_media; - - if (DC_IS_INTEL(sc)) - dc_setcfg(sc, ifm->ifm_media); - else if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) - dc_setcfg(sc, ifm->ifm_media); - else - sc->dc_link = 0; + error = dc_ifmedia_upd_locked(sc); DC_UNLOCK(sc); + return (error); +} - return (0); +static int +dc_ifmedia_upd_locked(struct dc_softc *sc) +{ + struct mii_data *mii; + struct ifmedia *ifm; + int error; + + DC_LOCK_ASSERT(sc); + + sc->dc_link = 0; + mii = device_get_softc(sc->dc_miibus); + error = mii_mediachg(mii); + if (error == 0) { + ifm = &mii->mii_media; + if (DC_IS_INTEL(sc)) + dc_setcfg(sc, ifm->ifm_media); + else if (DC_IS_DAVICOM(sc) && + IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) + dc_setcfg(sc, ifm->ifm_media); + } + + return (error); } /* From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:38:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D721E1065672; Mon, 2 Jan 2012 23:38: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 C02758FC0A; Mon, 2 Jan 2012 23:38:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02Nc3u0093749; Mon, 2 Jan 2012 23:38:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Nc3gQ093746; Mon, 2 Jan 2012 23:38:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022338.q02Nc3gQ093746@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229337 - in stable/8/sys: conf dev/dc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:38:04 -0000 Author: yongari Date: Mon Jan 2 23:38:03 2012 New Revision: 229337 URL: http://svn.freebsd.org/changeset/base/229337 Log: MFC r226701: Add support for ALi/ULi, now NVIDIA, M5261/M5263 PCI FastEthernet controller which is found on ULi M1563 South Bridge & M1689 Bridge. These controllers look like a tulip clone. M5263 controller does not support MII bitbang so use DC_ROM register to access MII registers. Like other tulip variants, ULi controller uses a setup frame to configure RX filter and uses new setup frame format. It's not clear to me whether the controller supports a hash based multicast filtering so this patch uses 14 perfect multicast filter to filter multicast frames. If number of multicast addresses is greater than 14, controller is put into a mode that receives all multicast frames. Due to lack of access to M5261, this change was not tested with M5261 but it probably works. Many thanks to Marco who provided remote access to M5263. Tested by: Marco Steinbach executive-computing dot de>, Martin MATO orange dot fr> Modified: stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/if_dcreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:35:18 2012 (r229336) +++ stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:38:03 2012 (r229337) @@ -225,6 +225,10 @@ static const struct dc_type const dc_dev "Linksys PCMPC200 CardBus 10/100" }, { DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09), 0, "Linksys PCMPC200 CardBus 10/100" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261), 0, + "ULi M5261 FastEthernet" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263), 0, + "ULi M5263 FastEthernet" }, { 0, 0, NULL } }; @@ -281,6 +285,7 @@ static uint32_t dc_mchash_be(const uint8 static void dc_setfilt_21143(struct dc_softc *); static void dc_setfilt_asix(struct dc_softc *); static void dc_setfilt_admtek(struct dc_softc *); +static void dc_setfilt_uli(struct dc_softc *); static void dc_setfilt_xircom(struct dc_softc *); static void dc_setfilt(struct dc_softc *); @@ -701,6 +706,23 @@ dc_miibus_readreg(device_t dev, int phy, return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + DC_ULI_PHY_OP_READ); + for (i = 0; i < DC_TIMEOUT; i++) { + DELAY(1); + rval = CSR_READ_4(sc, DC_ROM); + if ((rval & DC_ULI_PHY_OP_DONE) != 0) { + return (rval & DC_ULI_PHY_DATA_MASK); + } + } + if (i == DC_TIMEOUT) + device_printf(dev, "phy read timed out\n"); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -766,6 +788,16 @@ dc_miibus_writereg(device_t dev, int phy return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + ((data << DC_ULI_PHY_DATA_SHIFT) & DC_ULI_PHY_DATA_MASK) | + DC_ULI_PHY_OP_WRITE); + DELAY(1); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -1149,6 +1181,97 @@ dc_setfilt_asix(struct dc_softc *sc) } static void +dc_setfilt_uli(struct dc_softc *sc) +{ + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct dc_desc *sframe; + uint32_t filter, *sp; + uint8_t *ma; + int i, mcnt; + + ifp = sc->dc_ifp; + + i = sc->dc_cdata.dc_tx_prod; + DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT); + sc->dc_cdata.dc_tx_cnt++; + sframe = &sc->dc_ldata.dc_tx_list[i]; + sp = sc->dc_cdata.dc_sbuf; + bzero(sp, DC_SFRAME_LEN); + + sframe->dc_data = htole32(DC_ADDR_LO(sc->dc_saddr)); + sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP | + DC_TXCTL_TLINK | DC_FILTER_PERFECT | DC_TXCTL_FINT); + + sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf; + + /* Set station address. */ + bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN); + *sp++ = DC_SP_MAC(eaddr[1] << 8 | eaddr[0]); + *sp++ = DC_SP_MAC(eaddr[3] << 8 | eaddr[2]); + *sp++ = DC_SP_MAC(eaddr[5] << 8 | eaddr[4]); + + /* Set broadcast address. */ + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + + /* Extract current filter configuration. */ + filter = CSR_READ_4(sc, DC_NETCFG); + filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); + + /* Now build perfect filters. */ + mcnt = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + if (mcnt >= DC_ULI_FILTER_NPERF) { + filter |= DC_NETCFG_RX_ALLMULTI; + break; + } + ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + mcnt++; + } + if_maddr_runlock(ifp); + + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + } + + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (ifp->if_flags & IFF_PROMISC) + filter |= DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) + filter |= DC_NETCFG_RX_ALLMULTI; + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, filter); + + sframe->dc_status = htole32(DC_TXSTAT_OWN); + bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); + + /* + * Wait some time... + */ + DELAY(1000); + + sc->dc_wdog_timer = 5; +} + +static void dc_setfilt_xircom(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; @@ -1236,6 +1359,9 @@ dc_setfilt(struct dc_softc *sc) if (DC_IS_ADMTEK(sc)) dc_setfilt_admtek(sc); + if (DC_IS_ULI(sc)) + dc_setfilt_uli(sc); + if (DC_IS_XIRCOM(sc)) dc_setfilt_xircom(sc); } @@ -1404,7 +1530,7 @@ dc_reset(struct dc_softc *sc) } if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) || - DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { + DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc) || DC_IS_ULI(sc)) { DELAY(10000); DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); i = 0; @@ -1616,7 +1742,7 @@ dc_read_srom(struct dc_softc *sc, int bi int size; size = DC_ROM_SIZE(bits); - sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT); + sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->dc_srom == NULL) { device_printf(sc->dc_dev, "Could not allocate SROM buffer\n"); return (ENOMEM); @@ -1910,7 +2036,8 @@ dc_attach(device_t dev) struct ifnet *ifp; struct dc_mediainfo *m; uint32_t reg, revision; - int error, mac_offset, phy, rid, tmp; + uint16_t *srom; + int error, mac_offset, n, phy, rid, tmp; uint8_t *mac; sc = device_get_softc(dev); @@ -2090,6 +2217,21 @@ dc_attach(device_t dev) if (error != 0) goto fail; break; + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261): + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263): + if (sc->dc_info->dc_devid == + DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261)) + sc->dc_type = DC_TYPE_ULI_M5261; + else + sc->dc_type = DC_TYPE_ULI_M5263; + /* TX buffers should be aligned on 4 byte boundary. */ + sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE | + DC_TX_ALIGN; + sc->dc_pmode = DC_PMODE_MII; + error = dc_read_srom(sc, sc->dc_romwidth); + if (error != 0) + goto fail; + break; default: device_printf(dev, "unknown device: %x\n", sc->dc_info->dc_devid); @@ -2187,6 +2329,33 @@ dc_attach(device_t dev) } bcopy(mac, eaddr, ETHER_ADDR_LEN); break; + case DC_TYPE_ULI_M5261: + case DC_TYPE_ULI_M5263: + srom = (uint16_t *)sc->dc_srom; + if (srom == NULL || *srom == 0xFFFF || *srom == 0) { + /* + * No valid SROM present, read station address + * from ID Table. + */ + device_printf(dev, + "Reading station address from ID Table.\n"); + CSR_WRITE_4(sc, DC_BUSCTL, 0x10000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01C0); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0010); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01B0); + mac = (uint8_t *)eaddr; + for (n = 0; n < ETHER_ADDR_LEN; n++) + mac[n] = (uint8_t)CSR_READ_4(sc, DC_10BTCTRL); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_BUSCTL, 0x0000); + DELAY(10); + } else + dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, + 0); + break; default: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; @@ -3463,7 +3632,7 @@ dc_init_locked(struct dc_softc *sc) /* * Set cache alignment and burst length. */ - if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc)) + if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc) || DC_IS_ULI(sc)) CSR_WRITE_4(sc, DC_BUSCTL, 0); else CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE); @@ -3576,6 +3745,11 @@ dc_init_locked(struct dc_softc *sc) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF); + /* Initialize TX jabber and RX watchdog timer. */ + if (DC_IS_ULI(sc)) + CSR_WRITE_4(sc, DC_WATCHDOG, DC_WDOG_JABBERCLK | + DC_WDOG_HOSTUNJAB); + /* Enable transmitter. */ DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); Modified: stable/8/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/8/sys/dev/dc/if_dcreg.h Mon Jan 2 23:35:18 2012 (r229336) +++ stable/8/sys/dev/dc/if_dcreg.h Mon Jan 2 23:38:03 2012 (r229337) @@ -78,6 +78,8 @@ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ #define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */ #define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */ +#define DC_TYPE_ULI_M5261 0xD /* ALi/ULi M5261 */ +#define DC_TYPE_ULI_M5263 0xE /* ALi/ULi M5263 */ #define DC_IS_MACRONIX(x) \ (x->dc_type == DC_TYPE_98713 || \ @@ -88,6 +90,10 @@ (x->dc_type == DC_TYPE_AL981 || \ x->dc_type == DC_TYPE_AN983) +#define DC_IS_ULI(x) \ + (x->dc_type == DC_TYPE_ULI_M5261 || \ + x->dc_type == DC_TYPE_ULI_M5263) + #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) @@ -707,6 +713,23 @@ struct dc_type { /* End of CONEXANT specific registers */ +/* + * ULi M5263 specific registers. + */ +#define DC_ULI_FILTER_NPERF 14 + +#define DC_ULI_PHY_DATA_MASK 0x0000FFFF +#define DC_ULI_PHY_REG_MASK 0x001F0000 +#define DC_ULI_PHY_ADDR_MASK 0x03E00000 +#define DC_ULI_PHY_OP_WRITE 0x04000000 +#define DC_ULI_PHY_OP_READ 0x08000000 +#define DC_ULI_PHY_OP_DONE 0x10000000 + +#define DC_ULI_PHY_DATA_SHIFT 0 +#define DC_ULI_PHY_REG_SHIFT 16 +#define DC_ULI_PHY_ADDR_SHIFT 21 + +/* End of ULi M5263 specific registers */ struct dc_softc { struct ifnet *dc_ifp; /* interface info */ @@ -1014,6 +1037,17 @@ struct dc_softc { #define DC_DEVICEID_PCMPC200_AB08 0xab08 #define DC_DEVICEID_PCMPC200_AB09 0xab09 +/* + * ULi vendor ID. + */ +#define DC_VENDORID_ULI 0x10b9 + +/* + * ULi device IDs. + */ +#define DC_DEVICEID_M5261 0x5261 +#define DC_DEVICEID_M5263 0x5263 + #define DC_DEVID(vendor, device) ((device) << 16 | (vendor)) /* From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:43:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9C0310657C7; Mon, 2 Jan 2012 23:43:26 +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 944B48FC0A; Mon, 2 Jan 2012 23:43:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02NhQJi094131; Mon, 2 Jan 2012 23:43:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NhQ13094129; Mon, 2 Jan 2012 23:43:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022343.q02NhQ13094129@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229341 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:43:26 -0000 Author: yongari Date: Mon Jan 2 23:43:26 2012 New Revision: 229341 URL: http://svn.freebsd.org/changeset/base/229341 Log: MFC 226703-226704: r226703: Add ALi/ULi M5261/M5263 to supported hardware chipets. r226704: All dc(4) controllers support VLAN over-sized frame. Xr vlan Modified: stable/8/share/man/man4/dc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/dc.4 ============================================================================== --- stable/8/share/man/man4/dc.4 Mon Jan 2 23:43:16 2012 (r229340) +++ stable/8/share/man/man4/dc.4 Mon Jan 2 23:43:26 2012 (r229341) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2011 +.Dd October 24, 2011 .Dt DC 4 .Os .Sh NAME @@ -162,6 +162,8 @@ DEC/Intel 21143 ADMtek AL981 Comet, AN985 Centaur, ADM9511 Centaur II and ADM9513 Centaur II .It +ALi/ULi M5261 and M5263 +.It ASIX Electronics AX88140A and AX88141 .It Conexant LANfinity RS7112 (miniPCI) @@ -347,6 +349,7 @@ the card should be configured correctly. .Xr netintro 4 , .Xr ng_ether 4 , .Xr polling 4 , +.Xr vlan 4 , .Xr eeprom 8 , .Xr ifconfig 8 .Rs From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:44:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED6DC1065680; Mon, 2 Jan 2012 23:44:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D78838FC0C; Mon, 2 Jan 2012 23:44:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02Ni7i0094243; Mon, 2 Jan 2012 23:44:07 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Ni7h4094240; Mon, 2 Jan 2012 23:44:07 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022344.q02Ni7h4094240@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 23:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229343 - stable/8/usr.bin/du X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:44:08 -0000 Author: gjb (doc committer) Date: Mon Jan 2 23:44:07 2012 New Revision: 229343 URL: http://svn.freebsd.org/changeset/base/229343 Log: MFC r210993, r228356: r210933 (joel): - Fix typos and spelling mistakes r228356: [3] - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements PR: 162438 [3] Modified: stable/8/usr.bin/du/du.1 stable/8/usr.bin/du/du.c Directory Properties: stable/8/usr.bin/du/ (props changed) Modified: stable/8/usr.bin/du/du.1 ============================================================================== --- stable/8/usr.bin/du/du.1 Mon Jan 2 23:43:45 2012 (r229342) +++ stable/8/usr.bin/du/du.1 Mon Jan 2 23:44:07 2012 (r229343) @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -40,15 +40,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -69,10 +67,12 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE -and gives an estimate of how much space the examined file hierachy would +and gives an estimate of how much space the examined file hierarchy would require on a filesystem with the given .Ar blocksize . Unless in @@ -83,48 +83,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -140,6 +123,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -156,25 +157,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/8/usr.bin/du/du.c ============================================================================== --- stable/8/usr.bin/du/du.c Mon Jan 2 23:43:45 2012 (r229342) +++ stable/8/usr.bin/du/du.c Mon Jan 2 23:44:07 2012 (r229343) @@ -511,9 +511,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:47:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D4A4106566B; Mon, 2 Jan 2012 23:47:51 +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 85F608FC08; Mon, 2 Jan 2012 23:47:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02Nlpoh094411; Mon, 2 Jan 2012 23:47:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NlpGB094408; Mon, 2 Jan 2012 23:47:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022347.q02NlpGB094408@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229344 - in stable/8/sys: conf dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:47:51 -0000 Author: yongari Date: Mon Jan 2 23:47:51 2012 New Revision: 229344 URL: http://svn.freebsd.org/changeset/base/229344 Log: MFC r226709: This change makes it possible to define driver specific attach handler such that driver can announce interface capabilities and can do its own MII attach. Currently all USB ethernet controllers have no way to establish a link with pause capabilities. Lack of checksum offloading support also was one of reason to bring this change in. This change adds a couple of wrappers to USB ethernet drivers (uether_ifmedia_upd, uether_init and uether_start). All exported functions in uether has prefix uether_ so I think it's more consistent to have wrappers that follow the convention. This change preserves ABI/KPI so it should be safe to merge this change to stable/8. While I'm here add missing __FBSDID and clean up headers. Modified: stable/8/sys/dev/usb/net/usb_ethernet.c stable/8/sys/dev/usb/net/usb_ethernet.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- stable/8/sys/dev/usb/net/usb_ethernet.c Mon Jan 2 23:44:07 2012 (r229343) +++ stable/8/sys/dev/usb/net/usb_ethernet.c Mon Jan 2 23:47:51 2012 (r229344) @@ -24,24 +24,32 @@ * SUCH DAMAGE. */ -#include -#include +#include +__FBSDID("$FreeBSD$"); + #include -#include -#include #include -#include #include -#include +#include +#include #include +#include +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -197,42 +205,53 @@ ue_attach_post_task(struct usb_proc_msg usb_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0); sysctl_ctx_init(&ue->ue_sysctl_ctx); + error = 0; ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(ue->ue_dev, "could not allocate ifnet\n"); - goto error; + goto fail; } ifp->if_softc = ue; if_initname(ifp, "ue", ue->ue_unit); - ifp->if_mtu = ETHERMTU; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - if (ue->ue_methods->ue_ioctl != NULL) - ifp->if_ioctl = ue->ue_methods->ue_ioctl; - else - ifp->if_ioctl = uether_ioctl; - ifp->if_start = ue_start; - ifp->if_init = ue_init; - IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); - ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; - IFQ_SET_READY(&ifp->if_snd); - ue->ue_ifp = ifp; - - if (ue->ue_methods->ue_mii_upd != NULL && - ue->ue_methods->ue_mii_sts != NULL) { - mtx_lock(&Giant); /* device_xxx() depends on this */ - error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, - ue_ifmedia_upd, ue->ue_methods->ue_mii_sts, - BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); - mtx_unlock(&Giant); - if (error) { - device_printf(ue->ue_dev, "attaching PHYs failed\n"); - goto error; + if (ue->ue_methods->ue_attach_post_sub != NULL) { + ue->ue_ifp = ifp; + error = ue->ue_methods->ue_attach_post_sub(ue); + } else { + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + if (ue->ue_methods->ue_ioctl != NULL) + ifp->if_ioctl = ue->ue_methods->ue_ioctl; + else + ifp->if_ioctl = uether_ioctl; + ifp->if_start = ue_start; + ifp->if_init = ue_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + ue->ue_ifp = ifp; + + if (ue->ue_methods->ue_mii_upd != NULL && + ue->ue_methods->ue_mii_sts != NULL) { + /* device_xxx() depends on this */ + mtx_lock(&Giant); + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + ue_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + mtx_unlock(&Giant); } } + if (error) { + device_printf(ue->ue_dev, "attaching PHYs failed\n"); + goto fail; + } + if_printf(ifp, " on %s\n", device_get_nameunit(ue->ue_dev)); ether_ifattach(ifp, ue->ue_eaddr); + /* Tell upper layer we support VLAN oversized frames. */ + if (ifp->if_capabilities & IFCAP_VLAN_MTU) + ifp->if_hdrlen = sizeof(struct ether_vlan_header); snprintf(num, sizeof(num), "%u", ue->ue_unit); ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx, @@ -246,7 +265,7 @@ ue_attach_post_task(struct usb_proc_msg UE_LOCK(ue); return; -error: +fail: free_unr(ueunit, ue->ue_unit); if (ue->ue_ifp != NULL) { if_free(ue->ue_ifp); @@ -307,6 +326,13 @@ uether_is_gone(struct usb_ether *ue) return (usb_proc_is_gone(&ue->ue_tq)); } +void +uether_init(void *arg) +{ + + ue_init(arg); +} + static void ue_init(void *arg) { @@ -352,6 +378,13 @@ ue_stop_task(struct usb_proc_msg *_task) ue->ue_methods->ue_stop(ue); } +void +uether_start(struct ifnet *ifp) +{ + + ue_start(ifp); +} + static void ue_start(struct ifnet *ifp) { @@ -385,6 +418,13 @@ ue_setmulti_task(struct usb_proc_msg *_t ue->ue_methods->ue_setmulti(ue); } +int +uether_ifmedia_upd(struct ifnet *ifp) +{ + + return (ue_ifmedia_upd(ifp)); +} + static int ue_ifmedia_upd(struct ifnet *ifp) { Modified: stable/8/sys/dev/usb/net/usb_ethernet.h ============================================================================== --- stable/8/sys/dev/usb/net/usb_ethernet.h Mon Jan 2 23:44:07 2012 (r229343) +++ stable/8/sys/dev/usb/net/usb_ethernet.h Mon Jan 2 23:47:51 2012 (r229344) @@ -22,6 +22,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #ifndef _USB_ETHERNET_H_ @@ -66,7 +68,7 @@ struct usb_ether_methods { void (*ue_mii_sts)(struct ifnet *, struct ifmediareq *); int (*ue_ioctl)(struct ifnet *, u_long, caddr_t); - + int (*ue_attach_post_sub)(struct usb_ether *); }; struct usb_ether_cfg_task { @@ -110,6 +112,8 @@ struct mii_data *uether_getmii(struct us void *uether_getsc(struct usb_ether *); int uether_ifattach(struct usb_ether *); void uether_ifdetach(struct usb_ether *); +int uether_ifmedia_upd(struct ifnet *); +void uether_init(void *); int uether_ioctl(struct ifnet *, u_long, caddr_t); struct mbuf *uether_newbuf(void); int uether_rxmbuf(struct usb_ether *, struct mbuf *, @@ -119,4 +123,5 @@ int uether_rxbuf(struct usb_ether *, unsigned int, unsigned int); void uether_rxflush(struct usb_ether *); uint8_t uether_is_gone(struct usb_ether *); +void uether_start(struct ifnet *); #endif /* _USB_ETHERNET_H_ */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:50:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36305106566C; Mon, 2 Jan 2012 23:50:33 +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 1E0988FC15; Mon, 2 Jan 2012 23:50:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02NoXFv094547; Mon, 2 Jan 2012 23:50:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NoXH4094544; Mon, 2 Jan 2012 23:50:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022350.q02NoXH4094544@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:50:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229345 - in stable/8/sys: conf dev/usb/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:50:33 -0000 Author: yongari Date: Mon Jan 2 23:50:32 2012 New Revision: 229345 URL: http://svn.freebsd.org/changeset/base/229345 Log: MFC r226743: Implement TX/RX checksum offloading support for ASIX AX88772B controller. AX88772B data sheet does not show detailed information about checksum offloading related things. It seems the controller has lots of options to support checksum offloading but I failed to understand why this feature requires so much complex controller configuration and status bits. One of major difference between AX88772B and its predecessor is AX88772B uses a new RX header format when RX checksum offloading is enabled. It also requires the received length of a frame should be multiple of 4. Controller will pad necessary bytes to make the length of received frame to be multiple of 4. It is driver's responsibility to offset this pad bytes. Note, AX88772B could be configured to get partial checksum value in in RX header. This mode uses different RX header format and currently we don't use that fature. This change makes axe(4) use driver specific MII attach handler to override uether(9)'s default MII attach and announce flow-control capability for AX88178/AX88772A/AX88772B to PHY drivers. It seems original AX88772 also supports flow-control but I didn't enable it due to lack of test/access to the controller. The flow-control threshold parameter is loaded from EEPROM and there is no way to override this value without reprogramming EEPROM. For AX88772B, TX/RX IP/TCP/UDP checksum offloading is announced to network stack. IPv6 and PPPoE checksum offloading is also supported by controller but we have no way to take advantage of these features. Driver already knows PHY address so make PHY driver know that information and remove unnecessary PHY address check used in miibus_readreg/miibus_writereg callbacks. Also announce AX88178, AX88772A and AX88772B support VLAN over-sized frame. While I'm here clean up headers and remove axe_start() in axe_init() because the link wouldn't be available right after media change. Modified: stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_axereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Mon Jan 2 23:47:51 2012 (r229344) +++ stable/8/sys/dev/usb/net/if_axe.c Mon Jan 2 23:50:32 2012 (r229345) @@ -76,24 +76,30 @@ __FBSDID("$FreeBSD$"); * http://www.asix.com.tw/FrootAttach/datasheet/AX88772_datasheet_Rev10.pdf */ -#include -#include #include -#include -#include #include -#include #include -#include +#include +#include +#include #include +#include +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -122,6 +128,8 @@ __FBSDID("$FreeBSD$"); */ #define AXE_178_MAX_FRAME_BURST 1 +#define AXE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) + #ifdef USB_DEBUG static int axe_debug = 0; @@ -186,6 +194,7 @@ static uether_fn_t axe_tick; static uether_fn_t axe_setmulti; static uether_fn_t axe_setpromisc; +static int axe_attach_post_sub(struct usb_ether *); static int axe_ifmedia_upd(struct ifnet *); static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int axe_cmd(struct axe_softc *, int, int, int, void *); @@ -195,6 +204,11 @@ static void axe_ax88772_phywake(struct a static void axe_ax88772a_init(struct axe_softc *); static void axe_ax88772b_init(struct axe_softc *); static int axe_get_phyno(struct axe_softc *, int); +static int axe_ioctl(struct ifnet *, u_long, caddr_t); +static int axe_rx_frame(struct usb_ether *, struct usb_page_cache *, int); +static int axe_rxeof(struct usb_ether *, struct usb_page_cache *, + unsigned int offset, unsigned int, struct axe_csum_hdr *); +static void axe_csum_cfg(struct usb_ether *); static const struct usb_config axe_config[AXE_N_TRANSFER] = { @@ -266,6 +280,7 @@ MODULE_VERSION(axe, 1); static const struct usb_ether_methods axe_ue_methods = { .ue_attach_post = axe_attach_post, + .ue_attach_post_sub = axe_attach_post_sub, .ue_start = axe_start, .ue_init = axe_init, .ue_stop = axe_stop, @@ -304,9 +319,6 @@ axe_miibus_readreg(device_t dev, int phy uint16_t val; int locked; - if (sc->sc_phyno != phy) - return (0); - locked = mtx_owned(&sc->sc_mtx); if (!locked) AXE_LOCK(sc); @@ -338,10 +350,6 @@ axe_miibus_writereg(device_t dev, int ph int locked; val = htole32(val); - - if (sc->sc_phyno != phy) - return (0); - locked = mtx_owned(&sc->sc_mtx); if (!locked) AXE_LOCK(sc); @@ -372,7 +380,7 @@ axe_miibus_statchg(device_t dev) if (mii == NULL || ifp == NULL || (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) goto done; - + sc->sc_flags &= ~AXE_FLAG_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { @@ -390,14 +398,23 @@ axe_miibus_statchg(device_t dev) break; } } - + /* Lost link, do nothing. */ if ((sc->sc_flags & AXE_FLAG_LINK) == 0) goto done; - + val = 0; - if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { val |= AXE_MEDIA_FULL_DUPLEX; + if (AXE_IS_178_FAMILY(sc)) { + if ((IFM_OPTIONS(mii->mii_media_active) & + IFM_ETH_TXPAUSE) != 0) + val |= AXE_178_MEDIA_TXFLOW_CONTROL_EN; + if ((IFM_OPTIONS(mii->mii_media_active) & + IFM_ETH_RXPAUSE) != 0) + val |= AXE_178_MEDIA_RXFLOW_CONTROL_EN; + } + } if (AXE_IS_178_FAMILY(sc)) { val |= AXE_178_MEDIA_RX_EN | AXE_178_MEDIA_MAGIC; if ((sc->sc_flags & AXE_FLAG_178) != 0) @@ -845,6 +862,53 @@ axe_attach_post(struct usb_ether *ue) axe_cmd(sc, AXE_CMD_READ_IPG012, 0, 0, sc->sc_ipgs); } +static int +axe_attach_post_sub(struct usb_ether *ue) +{ + struct axe_softc *sc; + struct ifnet *ifp; + u_int adv_pause; + int error; + + sc = uether_getsc(ue); + ifp = ue->ue_ifp; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = uether_start; + ifp->if_ioctl = axe_ioctl; + ifp->if_init = uether_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if (AXE_IS_178_FAMILY(sc)) + ifp->if_capabilities |= IFCAP_VLAN_MTU; + if (sc->sc_flags & AXE_FLAG_772B) { + ifp->if_capabilities |= IFCAP_TXCSUM | IFCAP_RXCSUM; + ifp->if_hwassist = AXE_CSUM_FEATURES; + /* + * Checksum offloading of AX88772B also works with VLAN + * tagged frames but there is no way to take advantage + * of the feature because vlan(4) assumes + * IFCAP_VLAN_HWTAGGING is prerequisite condition to + * support checksum offloading with VLAN. VLAN hardware + * tagging support of AX88772B is very limited so it's + * not possible to announce IFCAP_VLAN_HWTAGGING. + */ + } + ifp->if_capenable = ifp->if_capabilities; + if (sc->sc_flags & (AXE_FLAG_772A | AXE_FLAG_772B | AXE_FLAG_178)) + adv_pause = MIIF_DOPAUSE; + else + adv_pause = 0; + mtx_lock(&Giant); + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, adv_pause); + mtx_unlock(&Giant); + + return (error); +} + /* * Probe for a AX88172 chip. */ @@ -930,52 +994,15 @@ axe_bulk_read_callback(struct usb_xfer * { struct axe_softc *sc = usbd_xfer_softc(xfer); struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); - struct axe_sframe_hdr hdr; struct usb_page_cache *pc; - int err, pos, len; int actlen; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - pos = 0; - len = 0; - err = 0; - pc = usbd_xfer_get_frame(xfer, 0); - if (AXE_IS_178_FAMILY(sc)) { - while (pos < actlen) { - if ((pos + sizeof(hdr)) > actlen) { - /* too little data */ - err = EINVAL; - break; - } - usbd_copy_out(pc, pos, &hdr, sizeof(hdr)); - - if ((hdr.len ^ hdr.ilen) != 0xFFFF) { - /* we lost sync */ - err = EINVAL; - break; - } - pos += sizeof(hdr); - - len = le16toh(hdr.len); - if ((pos + len) > actlen) { - /* invalid length */ - err = EINVAL; - break; - } - uether_rxbuf(ue, pc, pos, len); - - pos += len + (len % 2); - } - } else - uether_rxbuf(ue, pc, 0, actlen); - - if (err != 0) - ifp->if_ierrors++; + axe_rx_frame(ue, pc, actlen); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -998,6 +1025,131 @@ tr_setup: } } +static int +axe_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen) +{ + struct axe_softc *sc; + struct axe_sframe_hdr hdr; + struct axe_csum_hdr csum_hdr; + int error, len, pos; + + sc = uether_getsc(ue); + pos = 0; + len = 0; + error = 0; + if ((sc->sc_flags & AXE_FLAG_STD_FRAME) != 0) { + while (pos < actlen) { + if ((pos + sizeof(hdr)) > actlen) { + /* too little data */ + error = EINVAL; + break; + } + usbd_copy_out(pc, pos, &hdr, sizeof(hdr)); + + if ((hdr.len ^ hdr.ilen) != sc->sc_lenmask) { + /* we lost sync */ + error = EINVAL; + break; + } + pos += sizeof(hdr); + len = le16toh(hdr.len); + if (pos + len > actlen) { + /* invalid length */ + error = EINVAL; + break; + } + axe_rxeof(ue, pc, pos, len, NULL); + pos += len + (len % 2); + } + } else if ((sc->sc_flags & AXE_FLAG_CSUM_FRAME) != 0) { + while (pos < actlen) { + if ((pos + sizeof(csum_hdr)) > actlen) { + /* too little data */ + error = EINVAL; + break; + } + usbd_copy_out(pc, pos, &csum_hdr, sizeof(csum_hdr)); + + csum_hdr.len = le16toh(csum_hdr.len); + csum_hdr.ilen = le16toh(csum_hdr.ilen); + csum_hdr.cstatus = le16toh(csum_hdr.cstatus); + if ((AXE_CSUM_RXBYTES(csum_hdr.len) ^ + AXE_CSUM_RXBYTES(csum_hdr.ilen)) != + sc->sc_lenmask) { + /* we lost sync */ + error = EINVAL; + break; + } + /* + * Get total transferred frame length including + * checksum header. The length should be multiple + * of 4. + */ + len = sizeof(csum_hdr) + AXE_CSUM_RXBYTES(csum_hdr.len); + len = (len + 3) & ~3; + if (pos + len > actlen) { + /* invalid length */ + error = EINVAL; + break; + } + axe_rxeof(ue, pc, pos + sizeof(csum_hdr), + AXE_CSUM_RXBYTES(csum_hdr.len), &csum_hdr); + pos += len; + } + } else + axe_rxeof(ue, pc, 0, actlen, NULL); + + if (error != 0) + ue->ue_ifp->if_ierrors++; + return (error); +} + +static int +axe_rxeof(struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset, + unsigned int len, struct axe_csum_hdr *csum_hdr) +{ + struct ifnet *ifp = ue->ue_ifp; + struct mbuf *m; + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) { + ifp->if_ierrors++; + return (EINVAL); + } + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) { + ifp->if_iqdrops++; + return (ENOMEM); + } + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, ETHER_ALIGN); + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + if (csum_hdr != NULL && csum_hdr->cstatus & AXE_CSUM_HDR_L3_TYPE_IPV4) { + if ((csum_hdr->cstatus & (AXE_CSUM_HDR_L4_CSUM_ERR | + AXE_CSUM_HDR_L3_CSUM_ERR)) == 0) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | + CSUM_IP_VALID; + if ((csum_hdr->cstatus & AXE_CSUM_HDR_L4_TYPE_MASK) == + AXE_CSUM_HDR_L4_TYPE_TCP || + (csum_hdr->cstatus & AXE_CSUM_HDR_L4_TYPE_MASK) == + AXE_CSUM_HDR_L4_TYPE_UDP) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } + } + + _IF_ENQUEUE(&ue->ue_rxq, m); + return (0); +} + #if ((AXE_BULK_BUF_SIZE >= 0x10000) || (AXE_BULK_BUF_SIZE < (MCLBYTES+4))) #error "Please update axe_bulk_write_callback()!" #endif @@ -1040,6 +1192,21 @@ tr_setup: if (AXE_IS_178_FAMILY(sc)) { hdr.len = htole16(m->m_pkthdr.len); hdr.ilen = ~hdr.len; + /* + * If upper stack computed checksum, driver + * should tell controller not to insert + * computed checksum for checksum offloading + * enabled controller. + */ + if (ifp->if_capabilities & IFCAP_TXCSUM) { + if ((m->m_pkthdr.csum_flags & + AXE_CSUM_FEATURES) != 0) + hdr.len |= htole16( + AXE_TX_CSUM_PSEUDO_HDR); + else + hdr.len |= htole16( + AXE_TX_CSUM_DIS); + } usbd_copy_in(pc, pos, &hdr, sizeof(hdr)); pos += sizeof(hdr); usbd_m_copy_in(pc, pos, m, 0, m->m_pkthdr.len); @@ -1131,6 +1298,34 @@ axe_start(struct usb_ether *ue) } static void +axe_csum_cfg(struct usb_ether *ue) +{ + struct axe_softc *sc; + struct ifnet *ifp; + uint16_t csum1, csum2; + + sc = uether_getsc(ue); + AXE_LOCK_ASSERT(sc, MA_OWNED); + + if ((sc->sc_flags & AXE_FLAG_772B) != 0) { + ifp = uether_getifp(ue); + csum1 = 0; + csum2 = 0; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + csum1 |= AXE_TXCSUM_IP | AXE_TXCSUM_TCP | + AXE_TXCSUM_UDP; + axe_cmd(sc, AXE_772B_CMD_WRITE_TXCSUM, csum2, csum1, NULL); + csum1 = 0; + csum2 = 0; + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + csum1 |= AXE_RXCSUM_IP | AXE_RXCSUM_IPVE | + AXE_RXCSUM_TCP | AXE_RXCSUM_UDP | AXE_RXCSUM_ICMP | + AXE_RXCSUM_IGMP; + axe_cmd(sc, AXE_772B_CMD_WRITE_RXCSUM, csum2, csum1, NULL); + } +} + +static void axe_init(struct usb_ether *ue) { struct axe_softc *sc = uether_getsc(ue); @@ -1147,27 +1342,40 @@ axe_init(struct usb_ether *ue) axe_reset(sc); - /* Set MAC address. */ - if (AXE_IS_178_FAMILY(sc)) + /* Set MAC address and transmitter IPG values. */ + if (AXE_IS_178_FAMILY(sc)) { axe_cmd(sc, AXE_178_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp)); - else - axe_cmd(sc, AXE_172_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp)); - - /* Set transmitter IPG values */ - if (AXE_IS_178_FAMILY(sc)) axe_cmd(sc, AXE_178_CMD_WRITE_IPG012, sc->sc_ipgs[2], (sc->sc_ipgs[1] << 8) | (sc->sc_ipgs[0]), NULL); - else { + } else { + axe_cmd(sc, AXE_172_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp)); axe_cmd(sc, AXE_172_CMD_WRITE_IPG0, 0, sc->sc_ipgs[0], NULL); axe_cmd(sc, AXE_172_CMD_WRITE_IPG1, 0, sc->sc_ipgs[1], NULL); axe_cmd(sc, AXE_172_CMD_WRITE_IPG2, 0, sc->sc_ipgs[2], NULL); } - /* AX88772B uses different maximum frame burst configuration. */ - if (sc->sc_flags & AXE_FLAG_772B) + if (AXE_IS_178_FAMILY(sc)) { + sc->sc_flags &= ~(AXE_FLAG_STD_FRAME | AXE_FLAG_CSUM_FRAME); + if ((sc->sc_flags & AXE_FLAG_772B) != 0) + sc->sc_lenmask = AXE_CSUM_HDR_LEN_MASK; + else + sc->sc_lenmask = AXE_HDR_LEN_MASK; + if ((sc->sc_flags & AXE_FLAG_772B) != 0 && + (ifp->if_capenable & IFCAP_RXCSUM) != 0) + sc->sc_flags |= AXE_FLAG_CSUM_FRAME; + else + sc->sc_flags |= AXE_FLAG_STD_FRAME; + } + + /* Configure TX/RX checksum offloading. */ + axe_csum_cfg(ue); + + if (sc->sc_flags & AXE_FLAG_772B) { + /* AX88772B uses different maximum frame burst configuration. */ axe_cmd(sc, AXE_772B_CMD_RXCTL_WRITE_CFG, ax88772b_mfb_table[AX88772B_MFB_16K].threshold, ax88772b_mfb_table[AX88772B_MFB_16K].byte_cnt, NULL); + } /* Enable receiver, set RX mode. */ rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE); @@ -1175,11 +1383,17 @@ axe_init(struct usb_ether *ue) if (sc->sc_flags & AXE_FLAG_772B) { /* * Select RX header format type 1. Aligning IP - * header on 4 byte boundary is not needed + * header on 4 byte boundary is not needed when + * checksum offloading feature is not used * because we always copy the received frame in - * RX handler. + * RX handler. When RX checksum offloading is + * active, aligning IP header is required to + * reflect actual frame length including RX + * header size. */ rxmode |= AXE_772B_RXCMD_HDR_TYPE_1; + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + rxmode |= AXE_772B_RXCMD_IPHDR_ALIGN; } else { /* * Default Rx buffer size is too small to get @@ -1208,7 +1422,6 @@ axe_init(struct usb_ether *ue) ifp->if_drv_flags |= IFF_DRV_RUNNING; /* Switch to selected media. */ axe_ifmedia_upd(ifp); - axe_start(ue); } static void @@ -1250,3 +1463,45 @@ axe_stop(struct usb_ether *ue) usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_WR]); usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_RD]); } + +static int +axe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct usb_ether *ue = ifp->if_softc; + struct axe_softc *sc; + struct ifreq *ifr; + int error, mask, reinit; + + sc = uether_getsc(ue); + ifr = (struct ifreq *)data; + error = 0; + reinit = 0; + if (cmd == SIOCSIFCAP) { + AXE_LOCK(sc); + mask = ifr->ifr_reqcap ^ ifp->if_capenable; + 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 |= AXE_CSUM_FEATURES; + else + ifp->if_hwassist &= ~AXE_CSUM_FEATURES; + reinit++; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_RXCSUM; + reinit++; + } + if (reinit > 0 && ifp->if_drv_flags & IFF_DRV_RUNNING) + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + else + reinit = 0; + AXE_UNLOCK(sc); + if (reinit > 0) + uether_init(ue); + } else + error = uether_ioctl(ifp, cmd, data); + + return (error); +} Modified: stable/8/sys/dev/usb/net/if_axereg.h ============================================================================== --- stable/8/sys/dev/usb/net/if_axereg.h Mon Jan 2 23:47:51 2012 (r229344) +++ stable/8/sys/dev/usb/net/if_axereg.h Mon Jan 2 23:50:32 2012 (r229345) @@ -97,6 +97,10 @@ #define AXE_CMD_WRITE_VLAN_CTRL 0x4028 #define AXE_772B_CMD_RXCTL_WRITE_CFG 0x012A +#define AXE_772B_CMD_READ_RXCSUM 0x002B +#define AXE_772B_CMD_WRITE_RXCSUM 0x012C +#define AXE_772B_CMD_READ_TXCSUM 0x002D +#define AXE_772B_CMD_WRITE_TXCSUM 0x012E #define AXE_SW_RESET_CLEAR 0x00 #define AXE_SW_RESET_RR 0x01 @@ -199,6 +203,40 @@ #define AXE_VLAN_CTRL_VID1_MASK 0x00000FFF #define AXE_VLAN_CTRL_VID2_MASK 0x0FFF0000 +#define AXE_RXCSUM_IP 0x0001 +#define AXE_RXCSUM_IPVE 0x0002 +#define AXE_RXCSUM_IPV6E 0x0004 +#define AXE_RXCSUM_TCP 0x0008 +#define AXE_RXCSUM_UDP 0x0010 +#define AXE_RXCSUM_ICMP 0x0020 +#define AXE_RXCSUM_IGMP 0x0040 +#define AXE_RXCSUM_ICMP6 0x0080 +#define AXE_RXCSUM_TCPV6 0x0100 +#define AXE_RXCSUM_UDPV6 0x0200 +#define AXE_RXCSUM_ICMPV6 0x0400 +#define AXE_RXCSUM_IGMPV6 0x0800 +#define AXE_RXCSUM_ICMP6V6 0x1000 +#define AXE_RXCSUM_FOPC 0x8000 + +#define AXE_RXCSUM_64TE 0x0100 +#define AXE_RXCSUM_PPPOE 0x0200 +#define AXE_RXCSUM_RPCE 0x8000 + +#define AXE_TXCSUM_IP 0x0001 +#define AXE_TXCSUM_TCP 0x0002 +#define AXE_TXCSUM_UDP 0x0004 +#define AXE_TXCSUM_ICMP 0x0008 +#define AXE_TXCSUM_IGMP 0x0010 +#define AXE_TXCSUM_ICMP6 0x0020 +#define AXE_TXCSUM_TCPV6 0x0100 +#define AXE_TXCSUM_UDPV6 0x0200 +#define AXE_TXCSUM_ICMPV6 0x0400 +#define AXE_TXCSUM_IGMPV6 0x0800 +#define AXE_TXCSUM_ICMP6V6 0x1000 + +#define AXE_TXCSUM_64TE 0x0001 +#define AXE_TXCSUM_PPPOE 0x0002 + #define AXE_BULK_BUF_SIZE 16384 /* bytes */ #define AXE_CTL_READ 0x01 @@ -227,9 +265,62 @@ struct ax88772b_mfb { struct axe_sframe_hdr { uint16_t len; +#define AXE_HDR_LEN_MASK 0xFFFF + uint16_t ilen; +} __packed; + +#define AXE_TX_CSUM_PSEUDO_HDR 0x4000 +#define AXE_TX_CSUM_DIS 0x8000 + +/* + * When RX checksum offloading is enabled, AX88772B uses new RX header + * format and it's not compatible with previous RX header format. In + * addition, IP header align option should be enabled to get correct + * frame size including RX header. Total transferred size including + * the RX header is multiple of 4 and controller will pad necessary + * bytes if the length is not multiple of 4. + * This driver does not enable partial checksum feature which will + * compute 16bit checksum from 14th byte to the end of the frame. If + * this feature is enabled, computed checksum value is embedded into + * RX header which in turn means it uses different RX header format. + */ +struct axe_csum_hdr { + uint16_t len; +#define AXE_CSUM_HDR_LEN_MASK 0x07FF +#define AXE_CSUM_HDR_CRC_ERR 0x1000 +#define AXE_CSUM_HDR_MII_ERR 0x2000 +#define AXE_CSUM_HDR_RUNT 0x4000 +#define AXE_CSUM_HDR_BMCAST 0x8000 uint16_t ilen; + uint16_t cstatus; +#define AXE_CSUM_HDR_VLAN_MASK 0x0007 +#define AXE_CSUM_HDR_VLAN_STRIP 0x0008 +#define AXE_CSUM_HDR_VLAN_PRI_MASK 0x0070 +#define AXE_CSUM_HDR_L4_CSUM_ERR 0x0100 +#define AXE_CSUM_HDR_L3_CSUM_ERR 0x0200 +#define AXE_CSUM_HDR_L4_TYPE_UDP 0x0400 +#define AXE_CSUM_HDR_L4_TYPE_ICMP 0x0800 +#define AXE_CSUM_HDR_L4_TYPE_IGMP 0x0C00 +#define AXE_CSUM_HDR_L4_TYPE_TCP 0x1000 +#define AXE_CSUM_HDR_L4_TYPE_TCPV6 0x1400 +#define AXE_CSUM_HDR_L4_TYPE_MASK 0x1C00 +#define AXE_CSUM_HDR_L3_TYPE_IPV4 0x2000 +#define AXE_CSUM_HDR_L3_TYPE_IPV6 0x4000 + +#ifdef AXE_APPEND_PARTIAL_CSUM + /* + * These members present only when partial checksum + * offloading is enabled. The checksum value is simple + * 16bit sum of received frame starting at offset 14 of + * the frame to the end of the frame excluding FCS bytes. + */ + uint16_t csum_value; + uint16_t dummy; +#endif } __packed; +#define AXE_CSUM_RXBYTES(x) ((x) & AXE_CSUM_HDR_LEN_MASK) + #define GET_MII(sc) uether_getmii(&(sc)->sc_ue) /* The interrupt endpoint is currently unused by the ASIX part. */ @@ -247,6 +338,8 @@ struct axe_softc { int sc_flags; #define AXE_FLAG_LINK 0x0001 +#define AXE_FLAG_STD_FRAME 0x0010 +#define AXE_FLAG_CSUM_FRAME 0x0020 #define AXE_FLAG_772 0x1000 /* AX88772 */ #define AXE_FLAG_772A 0x2000 /* AX88772A */ #define AXE_FLAG_772B 0x4000 /* AX88772B */ @@ -255,6 +348,7 @@ struct axe_softc { uint8_t sc_ipgs[3]; uint8_t sc_phyaddrs[2]; uint16_t sc_pwrcfg; + uint16_t sc_lenmask; int sc_tx_bufsz; }; From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:52:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 557C110656F0; Mon, 2 Jan 2012 23:52:33 +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 3FC638FC13; Mon, 2 Jan 2012 23:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02NqX95094701; Mon, 2 Jan 2012 23:52:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NqXjD094699; Mon, 2 Jan 2012 23:52:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022352.q02NqXjD094699@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229347 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:52:33 -0000 Author: yongari Date: Mon Jan 2 23:52:32 2012 New Revision: 229347 URL: http://svn.freebsd.org/changeset/base/229347 Log: MFC r226744: AX88178/AX88772A/AX88772B supports VLAN over-sized frame. Xr vlan. Modified: stable/8/share/man/man4/axe.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/axe.4 ============================================================================== --- stable/8/share/man/man4/axe.4 Mon Jan 2 23:52:20 2012 (r229346) +++ stable/8/share/man/man4/axe.4 Mon Jan 2 23:52:32 2012 (r229347) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2011 +.Dd October 25, 2011 .Dt AXE 4 .Os .Sh NAME @@ -238,6 +238,7 @@ The driver failed to allocate an mbuf fo .Xr netintro 4 , .Xr ng_ether 4 , .Xr rgephy 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Rs .%T "ASIX AX88x7x and AX88760 data sheets" From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 2 23:53:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCB03106568D; Mon, 2 Jan 2012 23:53:36 +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 B6A878FC1C; Mon, 2 Jan 2012 23:53:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q02Nrag2094825; Mon, 2 Jan 2012 23:53:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NraE7094823; Mon, 2 Jan 2012 23:53:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022353.q02NraE7094823@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:53:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229349 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 23:53:36 -0000 Author: yongari Date: Mon Jan 2 23:53:36 2012 New Revision: 229349 URL: http://svn.freebsd.org/changeset/base/229349 Log: MFC r226745: axe(4) got VLAN over-sized frame support. Add axe(4) to the list of interfaces that support VLAN over-sized frame. Modified: stable/8/share/man/man4/vlan.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/vlan.4 ============================================================================== --- stable/8/share/man/man4/vlan.4 Mon Jan 2 23:53:26 2012 (r229348) +++ stable/8/share/man/man4/vlan.4 Mon Jan 2 23:53:36 2012 (r229349) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2010 +.Dd October 25, 2011 .Dt VLAN 4 .Os .Sh NAME @@ -166,6 +166,7 @@ filtering that breaks the Path MTU Disco The following interfaces support long frames for .Nm natively: +.Xr axe 4 , .Xr bfe 4 , .Xr cas 4 , .Xr dc 4 , From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 00:10:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F40F8106566C; Tue, 3 Jan 2012 00:10:30 +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 D90A18FC1A; Tue, 3 Jan 2012 00:10:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q030AU2M095724; Tue, 3 Jan 2012 00:10:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030AUEq095721; Tue, 3 Jan 2012 00:10:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030010.q030AUEq095721@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229351 - in stable/8/sys: conf dev/bge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 00:10:31 -0000 Author: yongari Date: Tue Jan 3 00:10:30 2012 New Revision: 229351 URL: http://svn.freebsd.org/changeset/base/229351 Log: MFC r226749,226770,226804-226807: r226749: Whitespace nits. r226770: Fix long standing bge_sysctl_debug_info() issues. o Protect bge(4) status block access and register dump with driver lock. o Add missing bus_dmamap_sync() before dumping status block. o Use minimum status block size, 32 bytes, for status block dump on most controllers except BCM5700 AX/BX. While I'm here, make the handler show 5717 Plus in hardware flags. r226804: Make CPMU handle GPHY power down control on controllers that have CPMU capability. r226805: It is known that all Broadcom controllers have 4GB boundary DMA bug. Apply workaround to all controllers. r226806: Broadcom says BCM5755 or higher and BCM5906 have short DMA bug. Apply workaround to these controllers. r226807: BCM5719 cannot handle DMA requests for DMA segments that have larger than 4KB in size. However the maximum DMA segment size created in DMA tag is 4KB, so we wouldn't encounter the issue here. Just record this issue such that let developers not to create a DMA segment that is larger than 4KB for BCM5719. It's possible to split a DMA segment into multiple smaller ones in run time but I believe it's not worth to implement that. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:07:49 2012 (r229350) +++ stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:10:30 2012 (r229351) @@ -2828,7 +2828,6 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2863,8 +2862,6 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; @@ -2918,15 +2915,26 @@ bge_attach(device_t dev) sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; /* - * All controllers that are not 5755 or higher have 4GB - * boundary DMA bug. + * All Broadcom controllers have 4GB boundary DMA bug. * Whenever an address crosses a multiple of the 4GB boundary * (including 4GB, 8Gb, 12Gb, etc.) and makes the transition * from 0xX_FFFF_FFFF to 0x(X+1)_0000_0000 an internal DMA * state machine will lockup and cause the device to hang. */ - if (BGE_IS_5755_PLUS(sc) == 0) - sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + + /* BCM5755 or higher and BCM5906 have short DMA bug. */ + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + + /* + * BCM5719 cannot handle DMA requests for DMA segments that + * have larger than 4KB in size. However the maximum DMA + * segment size created in DMA tag is 4KB for TSO, so we + * wouldn't encounter the issue here. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG; misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { @@ -2985,9 +2993,9 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_TSO; } - /* + /* * Check if this is a PCI-X or PCI Express device. - */ + */ if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { /* * Found a PCI Express capabilities register, this @@ -3446,7 +3454,8 @@ bge_reset(struct bge_softc *sc) * Set GPHY Power Down Override to leave GPHY * powered up in D0 uninitialized. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc) && + (sc->bge_flags & BGE_FLAG_CPMU_PRESENT) == 0) reset |= BGE_MISCCFG_GPHY_PD_OVERRIDE; /* Issue global reset */ @@ -3995,7 +4004,7 @@ bge_intr_task(void *arg, int pending) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } BGE_UNLOCK(sc); @@ -4112,7 +4121,7 @@ bge_tick(void *xsc) /* Synchronize with possible callout reset/stop. */ if (callout_pending(&sc->bge_stat_ch) || !callout_active(&sc->bge_stat_ch)) - return; + return; if (BGE_IS_5705_PLUS(sc)) bge_stats_update_regs(sc); @@ -5036,7 +5045,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm break; } } else if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) { - error = EINVAL; + error = EINVAL; break; } BGE_LOCK(sc); @@ -5797,8 +5806,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG { struct bge_softc *sc; uint16_t *sbdata; - int error; - int result; + int error, result, sbsz; int i, j; result = -1; @@ -5809,14 +5817,21 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG if (result == 1) { sc = (struct bge_softc *)arg1; + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; sbdata = (uint16_t *)sc->bge_ldata.bge_status_block; printf("Status Block:\n"); - for (i = 0x0; i < (BGE_STATUS_BLK_SZ / 4); ) { + BGE_LOCK(sc); + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + for (i = 0x0; i < sbsz / sizeof(uint16_t); ) { printf("%06x:", i); - for (j = 0; j < 8; j++) { - printf(" %04x", sbdata[i]); - i += 4; - } + for (j = 0; j < 8; j++) + printf(" %04x", sbdata[i++]); printf("\n"); } @@ -5829,8 +5844,11 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG } printf("\n"); } + BGE_UNLOCK(sc); printf("Hardware Flags:\n"); + if (BGE_IS_5717_PLUS(sc)) + printf(" - 5717 Plus\n"); if (BGE_IS_5755_PLUS(sc)) printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:07:49 2012 (r229350) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:10:30 2012 (r229351) @@ -2797,6 +2797,7 @@ struct bge_softc { #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 #define BGE_FLAG_SHORT_DMA_BUG 0x08000000 +#define BGE_FLAG_4K_RDMA_BUG 0x10000000 uint32_t bge_phy_flags; #define BGE_PHY_NO_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 00:24:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C68E9106566B; Tue, 3 Jan 2012 00:24:44 +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 AED578FC0C; Tue, 3 Jan 2012 00:24:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q030OiJb096596; Tue, 3 Jan 2012 00:24:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030Oiub096593; Tue, 3 Jan 2012 00:24:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030024.q030Oiub096593@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229355 - in stable/8/sys: conf dev/bge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 00:24:44 -0000 Author: yongari Date: Tue Jan 3 00:24:44 2012 New Revision: 229355 URL: http://svn.freebsd.org/changeset/base/229355 Log: MFC r226814-226815,226820-226821,226864,226866-226867: r226814: Rename definition of BGE_SOFTWARE_GENCOMM_* to more readable ones. The origin of GENCOMM seems to come from Alteon Tigon Host/NIC interface definition where it defines general communications region which is active when firmware is loaded and running. This region was used in communication between the host and processor internal to the Tigon chip. Broadcom data sheet also defines the region as 'Software Gencomm' in NetXtreme memory map but lacks detailed description of its interface so it was hard to know which ones are used for which interface. This change shall slightly enhance readability. No functional changes. r226815: Define MAC address mail box and use it instead of using hard-coded value. r226820: Offset 0x6810 is RX-RISC event register. Rename BGE_CPU_EVENT with BGE_RX_CPU_EVENT for readability. Additionally define BGE_TX_CPU_EVENT for TX-RSIC event register(BCM570[0-4] only). r226821: SRAM offset 0x0C04 is used by driver to inform the IPMI/ASF firmware about the various driver events like load, unload, reset, suspend, restart, and ioctl operations. Define driver's event rather than using hard-coded values. We don't still send suspend/resume event to firmware. Previously bge(4) used BGE_SDI_STATUS to send events. Because driver has to access firmware mail box to inform current state, using BGE_SDI_STATUS register was wrong. The end result was the same as BGE_SDI_STATUS is 0x0C04. No functional changes. r226864: Rename BGE_FW_DRV_ALIVE/BGE_FW_PAUSE to BGE_FW_CMD_DRV_ALIVE/BGE_FW_CMD_PAUSE. Also add more firmware commands(not used yet). No functional changes. r226866: Rename hard-coded value 1 << 14 with BGE_RX_CPU_DRV_EVENT. This bit(SW event 7 in publicly available data sheet) is used to make RX CPU handle a firmware command and the bit is automatically cleared after RX CPU completed the command. Generally firmware command takes the following steps. 1. Write BGE_SRAM_FW_CMD_MB with a command. 2. Write BGE_SRAM_FW_CMD_LEN_MB with the length of the command in bytes. 3. Write BGE_SRAM_FW_CMD_DATA_MB with actual command data. 4. Generate BGE_RX_CPU_EVENT and let firmware handle the command. 5. Wait for the ACK of the firmware command. No functional changes. r226867: Define BGE_FW_HB_TIMEOUT_SEC and remove one more magic value. bge(4) sends BGE_FW_CMD_DRV_ALIVE command to firmware every 2 seconds. BGE_FW_CMD_DRV_ALIVE command requires 4 bytes data. This data contains timeout value in seconds until the next BGE_FW_CMD_DRV_ALIVE command. Broadcom recommends driver set the value 3 times longer than the interval that it sends BGE_FW_CMD_DRV_ALIVE. Currently bge(4) uses 3 seconds so probably we have to increase it in future and use different ALIVE command(e.g. BGE_FW_CMD_DRV_ALIVE3). No functional changes. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:22:57 2012 (r229354) +++ stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:24:44 2012 (r229355) @@ -1309,15 +1309,17 @@ bge_sig_pre_reset(struct bge_softc *sc, * Some chips don't like this so only do this if ASF is enabled */ if (sc->bge_asf_mode) - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1330,11 +1332,13 @@ bge_sig_post_reset(struct bge_softc *sc, if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START_DONE); /* START DONE */ break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD_DONE); break; } } @@ -1347,10 +1351,12 @@ bge_sig_legacy(struct bge_softc *sc, int if (sc->bge_asf_mode) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1362,12 +1368,13 @@ bge_stop_fw(struct bge_softc *sc) int i; if (sc->bge_asf_mode) { - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, BGE_FW_CMD_PAUSE); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | BGE_RX_CPU_DRV_EVENT); for (i = 0; i < 100; i++ ) { - if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14))) + if (!(CSR_READ_4(sc, BGE_RX_CPU_EVENT) & + BGE_RX_CPU_DRV_EVENT)) break; DELAY(10); } @@ -3081,9 +3088,9 @@ bge_attach(device_t dev) } sc->bge_asf_mode = 0; - if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) - == BGE_MAGIC_NUMBER)) { - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG) + if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == + BGE_SRAM_DATA_SIG_MAGIC)) { + if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; @@ -3197,8 +3204,8 @@ bge_attach(device_t dev) * by its PCI subsystem ID, as we do below for the SysKonnect * SK-9D41. */ - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) - hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); + if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC) + hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG); else if ((sc->bge_flags & BGE_FLAG_EADDR) && (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, @@ -3433,9 +3440,9 @@ bge_reset(struct bge_softc *sc) /* * Write the magic number to SRAM at offset 0xB50. * When firmware finishes its initialization it will - * write ~BGE_MAGIC_NUMBER to the same location. + * write ~BGE_SRAM_FW_MB_MAGIC to the same location. */ - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); reset = BGE_MISCCFG_RESET_CORE_CLOCKS | BGE_32BITTIME_66MHZ; @@ -3560,8 +3567,8 @@ bge_reset(struct bge_softc *sc) */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) + val = bge_readmem_ind(sc, BGE_SRAM_FW_MB); + if (val == ~BGE_SRAM_FW_MB_MAGIC) break; } @@ -4100,12 +4107,14 @@ bge_asf_driver_up(struct bge_softc *sc) sc->bge_asf_count --; else { sc->bge_asf_count = 2; - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, - BGE_FW_DRV_ALIVE); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_DATA, 3); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, + BGE_FW_CMD_DRV_ALIVE); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB, + BGE_FW_HB_TIMEOUT_SEC); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | + BGE_RX_CPU_DRV_EVENT); } } } @@ -5938,11 +5947,11 @@ bge_get_eaddr_mem(struct bge_softc *sc, { uint32_t mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c14); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_HIGH_MB); if ((mac_addr >> 16) == 0x484b) { ether_addr[0] = (uint8_t)(mac_addr >> 8); ether_addr[1] = (uint8_t)mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c18); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_LOW_MB); ether_addr[2] = (uint8_t)(mac_addr >> 24); ether_addr[3] = (uint8_t)(mac_addr >> 16); ether_addr[4] = (uint8_t)(mac_addr >> 8); Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:22:57 2012 (r229354) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:24:44 2012 (r229355) @@ -71,12 +71,15 @@ #define BGE_STATS_BLOCK_END 0x00000AFF #define BGE_STATUS_BLOCK 0x00000B00 #define BGE_STATUS_BLOCK_END 0x00000B4F -#define BGE_SOFTWARE_GENCOMM 0x00000B50 -#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54 -#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58 -#define BGE_SOFTWARE_GENCOMM_FW 0x00000B78 -#define BGE_SOFTWARE_GENNCOMM_FW_LEN 0x00000B7C -#define BGE_SOFTWARE_GENNCOMM_FW_DATA 0x00000B80 +#define BGE_SRAM_FW_MB 0x00000B50 +#define BGE_SRAM_DATA_SIG 0x00000B54 +#define BGE_SRAM_DATA_CFG 0x00000B58 +#define BGE_SRAM_FW_CMD_MB 0x00000B78 +#define BGE_SRAM_FW_CMD_LEN_MB 0x00000B7C +#define BGE_SRAM_FW_CMD_DATA_MB 0x00000B80 +#define BGE_SRAM_FW_DRV_STATE_MB 0x00000C04 +#define BGE_SRAM_MAC_ADDR_HIGH_MB 0x00000C14 +#define BGE_SRAM_MAC_ADDR_LOW_MB 0x00000C18 #define BGE_SOFTWARE_GENCOMM_END 0x00000FFF #define BGE_UNMAPPED 0x00001000 #define BGE_UNMAPPED_END 0x00001FFF @@ -87,8 +90,24 @@ #define BGE_SEND_RING_1_TO_4_END 0x00005FFF /* Firmware interface */ -#define BGE_FW_DRV_ALIVE 0x00000001 -#define BGE_FW_PAUSE 0x00000002 +#define BGE_SRAM_DATA_SIG_MAGIC 0x4B657654 /* 'KevT' */ + +#define BGE_FW_CMD_DRV_ALIVE 0x00000001 +#define BGE_FW_CMD_PAUSE 0x00000002 +#define BGE_FW_CMD_IPV4_ADDR_CHANGE 0x00000003 +#define BGE_FW_CMD_IPV6_ADDR_CHANGE 0x00000004 +#define BGE_FW_CMD_LINK_UPDATE 0x0000000C +#define BGE_FW_CMD_DRV_ALIVE2 0x0000000D +#define BGE_FW_CMD_DRV_ALIVE3 0x0000000E + +#define BGE_FW_HB_TIMEOUT_SEC 3 + +#define BGE_FW_DRV_STATE_START 0x00000001 +#define BGE_FW_DRV_STATE_START_DONE 0x80000001 +#define BGE_FW_DRV_STATE_UNLOAD 0x00000002 +#define BGE_FW_DRV_STATE_UNLOAD_DONE 0x80000002 +#define BGE_FW_DRV_STATE_WOL 0x00000003 +#define BGE_FW_DRV_STATE_SUSPEND 0x00000004 /* Mappings for internal memory configuration */ #define BGE_STD_RX_RINGS 0x00006000 @@ -1875,7 +1894,8 @@ #define BGE_MODE_CTL 0x6800 #define BGE_MISC_CFG 0x6804 #define BGE_MISC_LOCAL_CTL 0x6808 -#define BGE_CPU_EVENT 0x6810 +#define BGE_RX_CPU_EVENT 0x6810 +#define BGE_TX_CPU_EVENT 0x6820 #define BGE_EE_ADDR 0x6838 #define BGE_EE_DATA 0x683C #define BGE_EE_CTL 0x6840 @@ -1883,6 +1903,8 @@ #define BGE_EE_DELAY 0x6848 #define BGE_FASTBOOT_PC 0x6894 +#define BGE_RX_CPU_DRV_EVENT 0x00004000 + /* * NVRAM Control registers */ @@ -2052,10 +2074,10 @@ * This magic number is written to the firmware mailbox at 0xb50 * before a software reset is issued. After the internal firmware * has completed its initialization it will write the opposite of - * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the - * driver to synchronize with the firmware. + * this value, ~BGE_SRAM_FW_MB_MAGIC, to the same location, + * allowing the driver to synchronize with the firmware. */ -#define BGE_MAGIC_NUMBER 0x4B657654 +#define BGE_SRAM_FW_MB_MAGIC 0x4B657654 typedef struct { uint32_t bge_addr_hi; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 00:47:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B6951065672; Tue, 3 Jan 2012 00:47:54 +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 755128FC08; Tue, 3 Jan 2012 00:47:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q030lsWe097493; Tue, 3 Jan 2012 00:47:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030lsF8097490; Tue, 3 Jan 2012 00:47:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030047.q030lsF8097490@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229358 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 00:47:54 -0000 Author: yongari Date: Tue Jan 3 00:47:54 2012 New Revision: 229358 URL: http://svn.freebsd.org/changeset/base/229358 Log: Recognize BCM5720C PHY. This is a direct commit to stable/8. Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/miidevs Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Tue Jan 3 00:45:14 2012 (r229357) +++ stable/8/sys/dev/mii/brgphy.c Tue Jan 3 00:47:54 2012 (r229358) @@ -143,6 +143,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5719C), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5720C), MII_PHY_DESC(xxBROADCOM_ALT2, BCM57765), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Tue Jan 3 00:45:14 2012 (r229357) +++ stable/8/sys/dev/mii/miidevs Tue Jan 3 00:47:54 2012 (r229358) @@ -160,6 +160,7 @@ model xxBROADCOM_ALT1 BCM5709S 0x003f BC model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model xxBROADCOM_ALT2 BCM5719C 0x0022 BCM5719C 10/100/1000baseTX PHY model xxBROADCOM_ALT2 BCM57765 0x0024 BCM57765 10/100/1000baseTX PHY +model xxBROADCOM_ALT2 BCM5720C 0x0036 BCM5720C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 01:02:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3CED1065687; Tue, 3 Jan 2012 01:02:26 +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 89D1A8FC15; Tue, 3 Jan 2012 01:02:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0312Q0f098192; Tue, 3 Jan 2012 01:02:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0312Q2u098189; Tue, 3 Jan 2012 01:02:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030102.q0312Q2u098189@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 01:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229361 - in stable/8/sys: conf dev/bge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 01:02:26 -0000 Author: yongari Date: Tue Jan 3 01:02:26 2012 New Revision: 229361 URL: http://svn.freebsd.org/changeset/base/229361 Log: MFC r226871-226872: r226871: Add initial BCM5720 support. Many thanks to Broadcom for continuing support of FreeBSD. Submitted by: Geans Pin at Broadcom (initial version) H/W donated by: Broadcom r226872: Disable updating InputDiscards counter for BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 and add comment why driver does not try to read it. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:56:05 2012 (r229360) +++ stable/8/sys/dev/bge/if_bge.c Tue Jan 3 01:02:26 2012 (r229361) @@ -301,6 +301,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5719_A0, "BCM5719 A0" }, + { BGE_CHIPID_BCM5720_A0, "BCM5720 A0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -349,6 +350,7 @@ static const struct bge_revision const b { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { BGE_ASICREV_BCM5719, "unknown BCM5719" }, + { BGE_ASICREV_BCM5720, "unknown BCM5720" }, { 0, NULL } }; @@ -437,6 +439,7 @@ static int bge_init_tx_ring(struct bge_s static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); +static uint32_t bge_dma_swap_options(struct bge_softc *); static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); @@ -1381,13 +1384,31 @@ bge_stop_fw(struct bge_softc *sc) } } +static uint32_t +bge_dma_swap_options(struct bge_softc *sc) +{ + uint32_t dma_options; + + dma_options = BGE_MODECTL_WORDSWAP_NONFRAME | + BGE_MODECTL_BYTESWAP_DATA | BGE_MODECTL_WORDSWAP_DATA; +#if BYTE_ORDER == BIG_ENDIAN + dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME; +#endif + if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720) + dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA | + BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE | + BGE_MODECTL_HTX2B_ENABLE; + + return (dma_options); +} + /* * Do endian, PCI and DMA initialization. */ static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl, misc_ctl; + uint32_t dma_rw_ctl, misc_ctl, mode_ctl; uint16_t val; int i; @@ -1505,9 +1526,8 @@ bge_chipinit(struct bge_softc *sc) /* * Set up general mode register. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS | - BGE_MODECTL_TX_NO_PHDR_CSUM); + mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR | + BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM; /* * BCM5701 B5 have a bug causing data corruption when using @@ -1517,13 +1537,15 @@ bge_chipinit(struct bge_softc *sc) */ if (sc->bge_asicrev == BGE_ASICREV_BCM5701 && sc->bge_chipid == BGE_CHIPID_BCM5701_B5) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32); + mode_ctl |= BGE_MODECTL_FORCE_PCI32; /* * Tell the firmware the driver is running */ if (sc->bge_asf_mode & ASF_STACKUP) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); + mode_ctl |= BGE_MODECTL_STACKUP; + + CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl); /* * Disable memory write invalidate. Apparently it is not supported @@ -1583,8 +1605,7 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM57765) { + if (BGE_IS_5717_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); if (sc->bge_ifp->if_mtu > ETHERMTU) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); @@ -1719,7 +1740,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_STD_RX_RINGS; @@ -1752,7 +1774,8 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; @@ -1841,7 +1864,8 @@ bge_blockinit(struct bge_softc *sc) RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); else RCB_WRITE_4(sc, vrcb, bge_nicaddr, @@ -1855,7 +1879,8 @@ bge_blockinit(struct bge_softc *sc) * return ring control blocks, located in NIC memory. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { /* Should be 17, use 16 until we get an SRAM map. */ limit = 16; } else if (!BGE_IS_5705_PLUS(sc)) @@ -1899,7 +1924,11 @@ bge_blockinit(struct bge_softc *sc) BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ - CSR_WRITE_4(sc, BGE_TX_LENGTHS, 0x2620); + val = 0x2620; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_TX_LENGTHS) & + (BGE_TXLEN_JMB_FRM_LEN_MSK | BGE_TXLEN_CNT_DN_VAL_MSK); + CSR_WRITE_4(sc, BGE_TX_LENGTHS, val); /* * Specify which ring to use for packets that don't match @@ -2054,6 +2083,11 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_RDMA_MODE) & + BGE_RDMAMODE_H2BNC_VLAN_DET; + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || @@ -2064,7 +2098,8 @@ bge_blockinit(struct bge_softc *sc) * Adjust tx margin to prevent TX data corruption and * fix internal FIFO overflow. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK | BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK | BGE_RDMA_RSRVCTRL_TXMRGN_MASK); @@ -2081,7 +2116,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); } - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K | @@ -2240,6 +2276,7 @@ bge_probe(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: id = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2764,6 +2801,7 @@ bge_attach(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: sc->bge_chipid = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2795,12 +2833,14 @@ bge_attach(device_t dev) * BCM5704 | 1 | X | 1 | X | * BCM5717 | 1 | 8 | 2 | 9 | * BCM5719 | 1 | 8 | 2 | 9 | + * BCM5720 | 1 | 8 | 2 | 9 | * * Other addresses may respond but they are not * IEEE compliant PHYs and should be ignored. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { f = pci_get_function(dev); if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { if (CSR_READ_4(sc, BGE_SGDIG_STS) & @@ -2835,6 +2875,7 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: + case BGE_ASICREV_BCM5720: case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2890,6 +2931,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5719 && + sc->bge_asicrev != BGE_ASICREV_BCM5720 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57765 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { @@ -3010,7 +3052,8 @@ bge_attach(device_t dev) */ sc->bge_flags |= BGE_FLAG_PCIE; sc->bge_expcap = reg; - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) pci_set_max_read_req(dev, 2048); else if (pci_get_max_read_req(dev) != 4096) pci_set_max_read_req(dev, 4096); @@ -3596,8 +3639,7 @@ bge_reset(struct bge_softc *sc) } /* Fix up byte swapping. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_BYTESWAP_DATA); + CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); /* Tell the ASF firmware we are up */ if (sc->bge_asf_mode & ASF_STACKUP) @@ -3628,6 +3670,10 @@ bge_reset(struct bge_softc *sc) } DELAY(10000); + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE, + CPMU_CLCK_ORIDE_MAC_ORIDE_EN); + return (0); } @@ -4245,8 +4291,30 @@ bge_stats_update_regs(struct bge_softc * CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); stats->NoMoreRxBDs += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - stats->InputDiscards += - CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + /* + * XXX + * Unlike other controllers, BGE_RXLP_LOCSTAT_IFIN_DROPS + * counter of BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 + * includes number of unwanted multicast frames. This comes + * from silicon bug and known workaround to get rough(not + * exact) counter is to enable interrupt on MBUF low water + * attention. This can be accomplished by setting + * BGE_HCCMODE_ATTN bit of BGE_HCC_MODE, + * BGE_BMANMODE_LOMBUF_ATTN bit of BGE_BMAN_MODE and + * BGE_MODECTL_FLOWCTL_ATTN_INTR bit of BGE_MODE_CTL. + * However that change would generate more interrupts and + * there are still possibilities of losing multiple frames + * during BGE_MODECTL_FLOWCTL_ATTN_INTR interrupt handling. + * Given that the workaround still would not get correct + * counter I don't think it's worth to implement it. So + * ignore reading the counter on controllers that have the + * silicon bug. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5717 && + sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5720_A0) + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); stats->InputErrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); stats->RecvThresholdHit += @@ -4842,6 +4910,11 @@ bge_init_locked(struct bge_softc *sc) mode = CSR_READ_4(sc, BGE_TX_MODE); if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + mode &= ~(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + mode |= CSR_READ_4(sc, BGE_TX_MODE) & + (BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + } /* Turn on transmitter. */ CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:56:05 2012 (r229360) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 01:02:26 2012 (r229361) @@ -258,15 +258,6 @@ #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) -#if BYTE_ORDER == LITTLE_ENDIAN -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#else -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#endif #define BGE_INIT \ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ @@ -339,6 +330,7 @@ #define BGE_CHIPID_BCM5717_A0 0x05717000 #define BGE_CHIPID_BCM5717_B0 0x05717100 #define BGE_CHIPID_BCM5719_A0 0x05719000 +#define BGE_CHIPID_BCM5720_A0 0x05720000 #define BGE_CHIPID_BCM57765_A0 0x57785000 #define BGE_CHIPID_BCM57765_B0 0x57785100 @@ -363,6 +355,7 @@ /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ #define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5719 0x5719 +#define BGE_ASICREV_BCM5720 0x5720 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -807,6 +800,8 @@ #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 #define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 +#define BGE_TXMODE_JMB_FRM_LEN 0x00400000 +#define BGE_TXMODE_CNT_DN_MODE 0x00800000 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 @@ -820,6 +815,8 @@ #define BGE_TXLEN_SLOTTIME 0x000000FF #define BGE_TXLEN_IPG 0x00000F00 #define BGE_TXLEN_CRS 0x00003000 +#define BGE_TXLEN_JMB_FRM_LEN_MSK 0x00FF0000 +#define BGE_TXLEN_CNT_DN_VAL_MSK 0xFF000000 /* Receive MAC mode register */ #define BGE_RXMODE_RESET 0x00000001 @@ -1277,6 +1274,7 @@ #define BGE_CPMU_LSPD_1000MB_CLK 0x360C #define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 #define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_ORIDE 0x3624 #define BGE_CPMU_CLCK_STAT 0x3630 #define BGE_CPMU_MUTEX_REQ 0x365C #define BGE_CPMU_MUTEX_GNT 0x3660 @@ -1304,6 +1302,9 @@ #define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 #define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 +/* Clock Speed Override Policy register */ +#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 + /* CPMU Clock Status register */ #define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 #define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 @@ -1551,6 +1552,7 @@ #define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 +#define BGE_RDMAMODE_H2BNC_VLAN_DET 0x20000000 /* Read DMA status register */ #define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 @@ -1961,14 +1963,18 @@ #define BGE_MODECTL_WORDSWAP_NONFRAME 0x00000004 #define BGE_MODECTL_BYTESWAP_DATA 0x00000010 #define BGE_MODECTL_WORDSWAP_DATA 0x00000020 +#define BGE_MODECTL_BYTESWAP_B2HRX_DATA 0x00000040 +#define BGE_MODECTL_WORDSWAP_B2HRX_DATA 0x00000080 #define BGE_MODECTL_NO_FRAME_CRACKING 0x00000200 #define BGE_MODECTL_NO_RX_CRC 0x00000400 #define BGE_MODECTL_RX_BADFRAMES 0x00000800 #define BGE_MODECTL_NO_TX_INTR 0x00002000 #define BGE_MODECTL_NO_RX_INTR 0x00004000 #define BGE_MODECTL_FORCE_PCI32 0x00008000 +#define BGE_MODECTL_B2HRX_ENABLE 0x00008000 #define BGE_MODECTL_STACKUP 0x00010000 #define BGE_MODECTL_HOST_SEND_BDS 0x00020000 +#define BGE_MODECTL_HTX2B_ENABLE 0x00040000 #define BGE_MODECTL_TX_NO_PHDR_CSUM 0x00100000 #define BGE_MODECTL_RX_NO_PHDR_CSUM 0x00800000 #define BGE_MODECTL_TX_ATTN_INTR 0x01000000 @@ -2298,7 +2304,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5717 0x1655 #define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5719 0x1657 -#define BCOM_DEVICEID_BCM5720 0x1658 +#define BCOM_DEVICEID_BCM5720_PP 0x1658 /* Not released to public. */ +#define BCOM_DEVICEID_BCM5720 0x165F #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A #define BCOM_DEVICEID_BCM5723 0x165B From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 04:12:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38684106566C; Tue, 3 Jan 2012 04:12:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21D058FC0C; Tue, 3 Jan 2012 04:12:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q034CfJL004507; Tue, 3 Jan 2012 04:12:41 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q034Cf4m004504; Tue, 3 Jan 2012 04:12:41 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201030412.q034Cf4m004504@svn.freebsd.org> From: Rick Macklem Date: Tue, 3 Jan 2012 04:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229365 - in stable/8/sys: conf fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 04:12:41 -0000 Author: rmacklem Date: Tue Jan 3 04:12:40 2012 New Revision: 229365 URL: http://svn.freebsd.org/changeset/base/229365 Log: MFC: r227543 Modify the new NFS client so that nfs_fsync() only calls ncl_flush() for regular files. Since other file types don't write into the buffer cache, calling ncl_flush() is almost a no-op. However, it does clear the NMODIFIED flag and this shouldn't be done by nfs_fsync() for directories. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 3 03:38:50 2012 (r229364) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 3 04:12:40 2012 (r229365) @@ -2516,6 +2516,16 @@ nfs_strategy(struct vop_strategy_args *a static int nfs_fsync(struct vop_fsync_args *ap) { + + if (ap->a_vp->v_type != VREG) { + /* + * For NFS, metadata is changed synchronously on the server, + * so there is nothing to flush. Also, ncl_flush() clears + * the NMODIFIED flag and that shouldn't be done here for + * directories. + */ + return (0); + } return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0)); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 09:15:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13BE71065670; Tue, 3 Jan 2012 09:15:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2B388FC0A; Tue, 3 Jan 2012 09:15:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q039FsiQ014182; Tue, 3 Jan 2012 09:15:54 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039Fs1m014168; Tue, 3 Jan 2012 09:15:54 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201030915.q039Fs1m014168@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 3 Jan 2012 09:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229370 - in stable/8/sys: conf dev/usb dev/usb/controller mips/atheros mips/cavium/usb mips/rmi modules/usb modules/usb/avr32dci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 09:15:55 -0000 Author: hselasky Date: Tue Jan 3 09:15:54 2012 New Revision: 229370 URL: http://svn.freebsd.org/changeset/base/229370 Log: MFC r228483, r228640, r228709, r228711, r228723 and r229086: - Implement better support for USB controller suspend and resume. - Add code to wait for USB shutdown to be executed at system shutdown. - Add sysctl which can be used to skip this waiting. NOTE: All USB controller drivers needs to be re-compiled after this change due to changes in some USB controller only structures. Added: stable/8/sys/modules/usb/avr32dci/ - copied from r228483, head/sys/modules/usb/avr32dci/ Modified: stable/8/sys/dev/usb/controller/at91dci.c stable/8/sys/dev/usb/controller/at91dci.h stable/8/sys/dev/usb/controller/at91dci_atmelarm.c stable/8/sys/dev/usb/controller/atmegadci.c stable/8/sys/dev/usb/controller/atmegadci.h stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c stable/8/sys/dev/usb/controller/avr32dci.c stable/8/sys/dev/usb/controller/avr32dci.h stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/controller/ehci.h stable/8/sys/dev/usb/controller/ehci_ixp4xx.c stable/8/sys/dev/usb/controller/ehci_pci.c stable/8/sys/dev/usb/controller/musb_otg.c stable/8/sys/dev/usb/controller/musb_otg.h stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c stable/8/sys/dev/usb/controller/ohci.c stable/8/sys/dev/usb/controller/ohci.h stable/8/sys/dev/usb/controller/ohci_atmelarm.c stable/8/sys/dev/usb/controller/ohci_pci.c stable/8/sys/dev/usb/controller/uhci.c stable/8/sys/dev/usb/controller/uhci.h stable/8/sys/dev/usb/controller/uhci_pci.c stable/8/sys/dev/usb/controller/usb_controller.c stable/8/sys/dev/usb/controller/uss820dci.c stable/8/sys/dev/usb/controller/uss820dci.h stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c stable/8/sys/dev/usb/controller/xhci.c stable/8/sys/dev/usb/controller/xhci.h stable/8/sys/dev/usb/controller/xhci_pci.c stable/8/sys/dev/usb/usb_bus.h stable/8/sys/dev/usb/usb_controller.h stable/8/sys/dev/usb/usb_if.m stable/8/sys/mips/atheros/ar71xx_ehci.c stable/8/sys/mips/atheros/ar71xx_ohci.c stable/8/sys/mips/cavium/usb/octusb.c stable/8/sys/mips/cavium/usb/octusb.h stable/8/sys/mips/cavium/usb/octusb_octeon.c stable/8/sys/mips/rmi/xls_ehci.c stable/8/sys/modules/usb/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/at91dci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -1461,16 +1461,16 @@ at91dci_uninit(struct at91dci_softc *sc) USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void at91dci_suspend(struct at91dci_softc *sc) { - return; + /* TODO */ } -void +static void at91dci_resume(struct at91dci_softc *sc) { - return; + /* TODO */ } static void @@ -2306,6 +2306,26 @@ at91dci_ep_init(struct usb_device *udev, } } +static void +at91dci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + at91dci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + at91dci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + at91dci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods at91dci_bus_methods = { .endpoint_init = &at91dci_ep_init, @@ -2316,4 +2336,5 @@ struct usb_bus_methods at91dci_bus_metho .clear_stall = &at91dci_clear_stall, .roothub_exec = &at91dci_roothub_exec, .xfer_poll = &at91dci_do_poll, + .set_hw_power_sleep = &at91dci_set_hw_power_sleep, }; Modified: stable/8/sys/dev/usb/controller/at91dci.h ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/at91dci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -235,8 +235,6 @@ struct at91dci_softc { usb_error_t at91dci_init(struct at91dci_softc *sc); void at91dci_uninit(struct at91dci_softc *sc); -void at91dci_suspend(struct at91dci_softc *sc); -void at91dci_resume(struct at91dci_softc *sc); void at91dci_interrupt(struct at91dci_softc *sc); void at91dci_vbus_interrupt(struct at91dci_softc *sc, uint8_t is_on); Modified: stable/8/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci_atmelarm.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/at91dci_atmelarm.c Tue Jan 3 09:15:54 2012 (r229370) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t at91_udp_probe; static device_attach_t at91_udp_attach; static device_detach_t at91_udp_detach; -static device_shutdown_t at91_udp_shutdown; struct at91_udp_softc { struct at91dci_softc sc_dci; /* must be first */ @@ -324,27 +323,14 @@ at91_udp_detach(device_t dev) return (0); } -static int -at91_udp_shutdown(device_t dev) -{ - struct at91_udp_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - at91dci_uninit(&sc->sc_dci); - - return (0); -} - static device_method_t at91_udp_methods[] = { /* Device interface */ DEVMETHOD(device_probe, at91_udp_probe), DEVMETHOD(device_attach, at91_udp_attach), DEVMETHOD(device_detach, at91_udp_detach), - DEVMETHOD(device_shutdown, at91_udp_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), @@ -353,9 +339,9 @@ static device_method_t at91_udp_methods[ }; static driver_t at91_udp_driver = { - "at91_udp", - at91_udp_methods, - sizeof(struct at91_udp_softc), + .name = "at91_udp", + .methods = at91_udp_methods, + .size = sizeof(struct at91_udp_softc), }; static devclass_t at91_udp_devclass; Modified: stable/8/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/atmegadci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -1351,16 +1351,16 @@ atmegadci_uninit(struct atmegadci_softc USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void atmegadci_suspend(struct atmegadci_softc *sc) { - return; + /* TODO */ } -void +static void atmegadci_resume(struct atmegadci_softc *sc) { - return; + /* TODO */ } static void @@ -2125,6 +2125,26 @@ atmegadci_ep_init(struct usb_device *ude } } +static void +atmegadci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct atmegadci_softc *sc = ATMEGA_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + atmegadci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + atmegadci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + atmegadci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods atmegadci_bus_methods = { .endpoint_init = &atmegadci_ep_init, @@ -2135,4 +2155,5 @@ struct usb_bus_methods atmegadci_bus_met .clear_stall = &atmegadci_clear_stall, .roothub_exec = &atmegadci_roothub_exec, .xfer_poll = &atmegadci_do_poll, + .set_hw_power_sleep = &atmegadci_set_hw_power_sleep, }; Modified: stable/8/sys/dev/usb/controller/atmegadci.h ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/atmegadci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -278,8 +278,6 @@ struct atmegadci_softc { usb_error_t atmegadci_init(struct atmegadci_softc *sc); void atmegadci_uninit(struct atmegadci_softc *sc); -void atmegadci_suspend(struct atmegadci_softc *sc); -void atmegadci_resume(struct atmegadci_softc *sc); void atmegadci_interrupt(struct atmegadci_softc *sc); #endif /* _ATMEGADCI_H_ */ Modified: stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c Tue Jan 3 09:15:54 2012 (r229370) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t atmegadci_probe; static device_attach_t atmegadci_attach; static device_detach_t atmegadci_detach; -static device_shutdown_t atmegadci_shutdown; struct atmegadci_super_softc { struct atmegadci_softc sc_otg; /* must be first */ @@ -193,27 +192,14 @@ atmegadci_detach(device_t dev) return (0); } -static int -atmegadci_shutdown(device_t dev) -{ - struct atmegadci_super_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - atmegadci_uninit(&sc->sc_otg); - - return (0); -} - static device_method_t atmegadci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, atmegadci_probe), DEVMETHOD(device_attach, atmegadci_attach), DEVMETHOD(device_detach, atmegadci_detach), - DEVMETHOD(device_shutdown, atmegadci_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), @@ -222,9 +208,9 @@ static device_method_t atmegadci_methods }; static driver_t atmegadci_driver = { - "atmegadci", - atmegadci_methods, - sizeof(struct atmegadci_super_softc), + .name = "atmegadci", + .methods = atmegadci_methods, + .size = sizeof(struct atmegadci_super_softc), }; static devclass_t atmegadci_devclass; Modified: stable/8/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/avr32dci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -265,7 +265,7 @@ avr32dci_set_address(struct avr32dci_sof { DPRINTFN(5, "addr=%d\n", addr); - avr32dci_mod_ctrl(sc, AVR32_UDADDR_ADDEN | addr, 0); + avr32dci_mod_ctrl(sc, AVR32_CTRL_DEV_FADDR_EN | addr, 0); } static uint8_t @@ -501,7 +501,7 @@ repeat: } /* allocate FIFO bank */ - AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(td->ep_no), AVR32_EPTSTA_TX_BK_RDY); + AVR32_WRITE_4(sc, AVR32_EPTCTL(td->ep_no), AVR32_EPTCTL_TX_PK_RDY); /* check remainder */ if (td->remainder == 0) { @@ -754,7 +754,7 @@ avr32dci_setup_standard_chain(struct usb uint8_t need_sync; DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", - xfer->address, UE_GET_ADDR(xfer->endpoint), + xfer->address, UE_GET_ADDR(xfer->endpointno), xfer->sumlen, usbd_get_speed(xfer->xroot->udev)); temp.max_frame_size = xfer->max_frame_size; @@ -773,7 +773,7 @@ avr32dci_setup_standard_chain(struct usb temp.did_stall = !xfer->flags_int.control_stall; sc = AVR32_BUS2SC(xfer->xroot->bus); - ep_no = (xfer->endpoint & UE_ADDR); + ep_no = (xfer->endpointno & UE_ADDR); /* check if we should prepend a setup message */ @@ -798,7 +798,7 @@ avr32dci_setup_standard_chain(struct usb } if (x != xfer->nframes) { - if (xfer->endpoint & UE_DIR_IN) { + if (xfer->endpointno & UE_DIR_IN) { temp.func = &avr32dci_data_tx; need_sync = 1; } else { @@ -872,7 +872,7 @@ avr32dci_setup_standard_chain(struct usb * Send a DATA1 message and invert the current * endpoint direction. */ - if (xfer->endpoint & UE_DIR_IN) { + if (xfer->endpointno & UE_DIR_IN) { temp.func = &avr32dci_data_rx; need_sync = 0; } else { @@ -913,7 +913,8 @@ avr32dci_start_standard_chain(struct usb /* poll one time - will turn on interrupts */ if (avr32dci_xfer_do_fifo(xfer)) { - uint8_t ep_no = xfer->endpoint & UE_ADDR_MASK; + uint8_t ep_no = xfer->endpointno & UE_ADDR; + struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); avr32dci_mod_ien(sc, AVR32_INT_EPT_INT(ep_no), 0); @@ -1012,7 +1013,7 @@ avr32dci_standard_done(struct usb_xfer * usb_error_t err = 0; DPRINTFN(13, "xfer=%p pipe=%p transfer done\n", - xfer, xfer->pipe); + xfer, xfer->endpoint); /* reset scanner */ @@ -1064,10 +1065,10 @@ avr32dci_device_done(struct usb_xfer *xf USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n", - xfer, xfer->pipe, error); + xfer, xfer->endpoint, error); if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { - ep_no = (xfer->endpoint & UE_ADDR); + ep_no = (xfer->endpointno & UE_ADDR); /* disable endpoint interrupt */ avr32dci_mod_ien(sc, 0, AVR32_INT_EPT_INT(ep_no)); @@ -1080,7 +1081,7 @@ avr32dci_device_done(struct usb_xfer *xf static void avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep, uint8_t *did_stall) + struct usb_endpoint *pipe, uint8_t *did_stall) { struct avr32dci_softc *sc; uint8_t ep_no; @@ -1166,7 +1167,7 @@ avr32dci_clear_stall_sub(struct avr32dci } static void -avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep) +avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *pipe) { struct avr32dci_softc *sc; struct usb_endpoint_descriptor *ed; @@ -1226,8 +1227,7 @@ avr32dci_init(struct avr32dci_softc *sc) AVR32_INT_ENDRESET, 0); /* reset all endpoints */ -/**INDENT** Warning@1207: Extra ) */ - AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1)); + AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1); /* disable all endpoints */ for (n = 0; n != AVR32_EP_MAX; n++) { @@ -1262,8 +1262,7 @@ avr32dci_uninit(struct avr32dci_softc *s avr32dci_mod_ien(sc, 0, 0xFFFFFFFF); /* reset all endpoints */ -/**INDENT** Warning@1242: Extra ) */ - AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1)); + AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1); /* disable all endpoints */ for (n = 0; n != AVR32_EP_MAX; n++) { @@ -1284,16 +1283,16 @@ avr32dci_uninit(struct avr32dci_softc *s USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void avr32dci_suspend(struct avr32dci_softc *sc) { - return; + /* TODO */ } -void +static void avr32dci_resume(struct avr32dci_softc *sc) { - return; + /* TODO */ } static void @@ -1369,10 +1368,10 @@ avr32dci_device_isoc_fs_enter(struct usb uint8_t ep_no; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", - xfer, xfer->pipe->isoc_next, xfer->nframes); + xfer, xfer->endpoint->isoc_next, xfer->nframes); /* get the current frame index */ - ep_no = xfer->endpoint & UE_ADDR_MASK; + ep_no = xfer->endpointno & UE_ADDR; nframes = (AVR32_READ_4(sc, AVR32_FNUM) / 8); nframes &= AVR32_FRAME_MASK; @@ -1381,9 +1380,9 @@ avr32dci_device_isoc_fs_enter(struct usb * check if the frame index is within the window where the frames * will be inserted */ - temp = (nframes - xfer->pipe->isoc_next) & AVR32_FRAME_MASK; + temp = (nframes - xfer->endpoint->isoc_next) & AVR32_FRAME_MASK; - if ((xfer->pipe->is_synced == 0) || + if ((xfer->endpoint->is_synced == 0) || (temp < xfer->nframes)) { /* * If there is data underflow or the pipe queue is @@ -1391,15 +1390,15 @@ avr32dci_device_isoc_fs_enter(struct usb * of the current frame position. Else two isochronous * transfers might overlap. */ - xfer->pipe->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; - xfer->pipe->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next); + xfer->endpoint->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; + xfer->endpoint->is_synced = 1; + DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); } /* * compute how many milliseconds the insertion is ahead of the * current frame position: */ - temp = (xfer->pipe->isoc_next - nframes) & AVR32_FRAME_MASK; + temp = (xfer->endpoint->isoc_next - nframes) & AVR32_FRAME_MASK; /* * pre-compute when the isochronous transfer will be finished: @@ -1409,7 +1408,7 @@ avr32dci_device_isoc_fs_enter(struct usb xfer->nframes; /* compute frame number for next insertion */ - xfer->pipe->isoc_next += xfer->nframes; + xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ avr32dci_setup_standard_chain(xfer); @@ -1832,7 +1831,7 @@ tr_handle_clear_port_feature: AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(0), AVR32_EPTSTA_FRCESTALL); /* configure */ - AVR32_WRITE_4(sc, AVR32_EPTCFG(0), AVR32_EPTCFG_TYPE_CONTROL | + AVR32_WRITE_4(sc, AVR32_EPTCFG(0), AVR32_EPTCFG_TYPE_CTRL | AVR32_EPTCFG_NBANK(1) | AVR32_EPTCFG_EPSIZE(6)); temp = AVR32_READ_4(sc, AVR32_EPTCFG(0)); @@ -1974,7 +1973,7 @@ avr32dci_xfer_setup(struct usb_setup_par /* * compute maximum number of TDs */ - if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { + if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; @@ -1997,7 +1996,7 @@ avr32dci_xfer_setup(struct usb_setup_par /* * get profile stuff */ - ep_no = xfer->endpoint & UE_ADDR; + ep_no = xfer->endpointno & UE_ADDR; avr32dci_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { @@ -2045,7 +2044,7 @@ avr32dci_xfer_unsetup(struct usb_xfer *x static void avr32dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, - struct usb_endpoint *ep) + struct usb_endpoint *pipe) { struct avr32dci_softc *sc = AVR32_BUS2SC(udev->bus); @@ -2072,6 +2071,26 @@ avr32dci_ep_init(struct usb_device *udev } } +static void +avr32dci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct avr32dci_softc *sc = AVR32_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + avr32dci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + avr32dci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + avr32dci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods avr32dci_bus_methods = { .endpoint_init = &avr32dci_ep_init, @@ -2082,4 +2101,5 @@ struct usb_bus_methods avr32dci_bus_meth .clear_stall = &avr32dci_clear_stall, .roothub_exec = &avr32dci_roothub_exec, .xfer_poll = &avr32dci_do_poll, + .set_hw_power_sleep = &avr32dci_set_hw_power_sleep, }; Modified: stable/8/sys/dev/usb/controller/avr32dci.h ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/avr32dci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -166,6 +166,7 @@ struct avr32dci_td { uint32_t offset; uint32_t remainder; uint16_t max_packet_size; + uint8_t bank_shift; uint8_t error:1; uint8_t alt_next:1; uint8_t short_pkt:1; @@ -246,8 +247,6 @@ struct avr32dci_softc { usb_error_t avr32dci_init(struct avr32dci_softc *sc); void avr32dci_uninit(struct avr32dci_softc *sc); -void avr32dci_suspend(struct avr32dci_softc *sc); -void avr32dci_resume(struct avr32dci_softc *sc); void avr32dci_interrupt(struct avr32dci_softc *sc); void avr32dci_vbus_interrupt(struct avr32dci_softc *sc, uint8_t is_on); Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -188,7 +188,7 @@ ehci_reset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); + usb_pause_mtx(NULL, hz / 128); hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET; if (!hcr) { if (sc->sc_flags & (EHCI_SCFLG_SETMODE | EHCI_SCFLG_BIGEMMIO)) { @@ -212,7 +212,7 @@ ehci_reset(ehci_softc_t *sc) return (0); } } - device_printf(sc->sc_bus.bdev, "reset timeout\n"); + device_printf(sc->sc_bus.bdev, "Reset timeout\n"); return (USB_ERR_IOERROR); } @@ -224,7 +224,7 @@ ehci_hcreset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); + usb_pause_mtx(NULL, hz / 128); hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; if (hcr) break; @@ -237,7 +237,60 @@ ehci_hcreset(ehci_softc_t *sc) */ device_printf(sc->sc_bus.bdev, "stop timeout\n"); - return ehci_reset(sc); + return (ehci_reset(sc)); +} + +static int +ehci_init_sub(struct ehci_softc *sc) +{ + struct usb_page_search buf_res; + uint32_t cparams; + uint32_t hcr; + uint8_t i; + + cparams = EREAD4(sc, EHCI_HCCPARAMS); + + DPRINTF("cparams=0x%x\n", cparams); + + if (EHCI_HCC_64BIT(cparams)) { + DPRINTF("HCC uses 64-bit structures\n"); + + /* MUST clear segment register if 64 bit capable */ + EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); + } + + usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); + EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); + + usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); + EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); + + /* enable interrupts */ + EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); + + /* turn on controller */ + EOWRITE4(sc, EHCI_USBCMD, + EHCI_CMD_ITC_1 | /* 1 microframes interrupt delay */ + (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) | + EHCI_CMD_ASE | + EHCI_CMD_PSE | + EHCI_CMD_RS); + + /* Take over port ownership */ + EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); + + for (i = 0; i < 100; i++) { + usb_pause_mtx(NULL, hz / 128); + hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; + if (!hcr) { + break; + } + } + if (hcr) { + device_printf(sc->sc_bus.bdev, "Run timeout\n"); + return (USB_ERR_IOERROR); + } + return (USB_ERR_NORMAL_COMPLETION); } usb_error_t @@ -246,8 +299,6 @@ ehci_init(ehci_softc_t *sc) struct usb_page_search buf_res; uint32_t version; uint32_t sparams; - uint32_t cparams; - uint32_t hcr; uint16_t i; uint16_t x; uint16_t y; @@ -279,15 +330,6 @@ ehci_init(ehci_softc_t *sc) DPRINTF("sparams=0x%x\n", sparams); sc->sc_noport = EHCI_HCS_N_PORTS(sparams); - cparams = EREAD4(sc, EHCI_HCCPARAMS); - DPRINTF("cparams=0x%x\n", cparams); - - if (EHCI_HCC_64BIT(cparams)) { - DPRINTF("HCC uses 64-bit structures\n"); - - /* MUST clear segment register if 64 bit capable */ - EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); - } sc->sc_bus.usbrev = USB_REV_2_0; /* Reset the controller */ @@ -464,9 +506,6 @@ ehci_init(ehci_softc_t *sc) [i & (EHCI_VIRTUAL_FRAMELIST_COUNT - 1)]->itd_self; } } - /* setup sync list pointer */ - EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); - usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); if (1) { @@ -511,35 +550,8 @@ ehci_init(ehci_softc_t *sc) } #endif - /* setup async list pointer */ - EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); - - - /* enable interrupts */ - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - - /* turn on controller */ - EOWRITE4(sc, EHCI_USBCMD, - EHCI_CMD_ITC_1 | /* 1 microframes interrupt delay */ - (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) | - EHCI_CMD_ASE | - EHCI_CMD_PSE | - EHCI_CMD_RS); - - /* Take over port ownership */ - EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); - - for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (!hcr) { - break; - } - } - if (hcr) { - device_printf(sc->sc_bus.bdev, "run timeout\n"); - return (USB_ERR_IOERROR); - } + /* finial setup */ + err = ehci_init_sub(sc); if (!err) { /* catch any lost interrupts */ @@ -573,137 +585,28 @@ ehci_detach(ehci_softc_t *sc) usb_callout_drain(&sc->sc_tmo_poll); } -void +static void ehci_suspend(ehci_softc_t *sc) { - uint32_t cmd; - uint32_t hcr; - uint8_t i; - - USB_BUS_LOCK(&sc->sc_bus); - - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_PE) == EHCI_PS_PE)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd | EHCI_PS_SUSP); - } - } - - sc->sc_cmd = EOREAD4(sc, EHCI_USBCMD); - - cmd = sc->sc_cmd & ~(EHCI_CMD_ASE | EHCI_CMD_PSE); - EOWRITE4(sc, EHCI_USBCMD, cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & - (EHCI_STS_ASS | EHCI_STS_PSS); - - if (hcr == 0) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } - - if (hcr != 0) { - device_printf(sc->sc_bus.bdev, "reset timeout\n"); - } - cmd &= ~EHCI_CMD_RS; - EOWRITE4(sc, EHCI_USBCMD, cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (hcr == EHCI_STS_HCH) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } + DPRINTF("stopping the HC\n"); - if (hcr != EHCI_STS_HCH) { - device_printf(sc->sc_bus.bdev, - "config timeout\n"); - } - USB_BUS_UNLOCK(&sc->sc_bus); + /* reset HC */ + ehci_hcreset(sc); } -void +static void ehci_resume(ehci_softc_t *sc) { - struct usb_page_search buf_res; - uint32_t cmd; - uint32_t hcr; - uint8_t i; - - USB_BUS_LOCK(&sc->sc_bus); + /* reset HC */ + ehci_hcreset(sc); - /* restore things in case the bios doesn't */ - EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); - - usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); - EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); - - usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); - EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); - - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - - hcr = 0; - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd | EHCI_PS_FPR); - hcr = 1; - } - } - - if (hcr) { - usb_pause_mtx(&sc->sc_bus.bus_mtx, - USB_MS_TO_TICKS(USB_RESUME_WAIT)); - - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd & ~EHCI_PS_FPR); - } - } - } - EOWRITE4(sc, EHCI_USBCMD, sc->sc_cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (hcr != EHCI_STS_HCH) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } - if (hcr == EHCI_STS_HCH) { - device_printf(sc->sc_bus.bdev, "config timeout\n"); - } - - USB_BUS_UNLOCK(&sc->sc_bus); - - usb_pause_mtx(NULL, - USB_MS_TO_TICKS(USB_RESUME_WAIT)); + /* setup HC */ + ehci_init_sub(sc); /* catch any lost interrupts */ ehci_do_poll(&sc->sc_bus); } -void -ehci_shutdown(ehci_softc_t *sc) -{ - DPRINTF("stopping the HC\n"); - - if (ehci_hcreset(sc)) { - DPRINTF("reset failed!\n"); - } -} - #ifdef USB_DEBUG static void ehci_dump_regs(ehci_softc_t *sc) @@ -3908,8 +3811,24 @@ ehci_device_suspend(struct usb_device *u } USB_BUS_UNLOCK(udev->bus); +} - return; +static void +ehci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct ehci_softc *sc = EHCI_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + case USB_HW_POWER_SHUTDOWN: + ehci_suspend(sc); + break; + case USB_HW_POWER_RESUME: + ehci_resume(sc); + break; + default: + break; + } } static void @@ -3955,6 +3874,7 @@ struct usb_bus_methods ehci_bus_methods .device_resume = ehci_device_resume, .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, + .set_hw_power_sleep = ehci_set_hw_power_sleep, .roothub_exec = ehci_roothub_exec, .xfer_poll = ehci_do_poll, }; Modified: stable/8/sys/dev/usb/controller/ehci.h ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -333,8 +333,6 @@ typedef struct ehci_softc { uint32_t sc_terminate_self; /* TD short packet termination pointer */ uint32_t sc_eintrs; - uint32_t sc_cmd; /* shadow of cmd register during - * suspend */ uint16_t sc_intr_stat[EHCI_VIRTUAL_FRAMELIST_COUNT]; uint16_t sc_id_vendor; /* vendor ID for root hub */ @@ -445,9 +443,6 @@ usb_bus_mem_cb_t ehci_iterate_hw_softc; usb_error_t ehci_reset(ehci_softc_t *sc); usb_error_t ehci_init(ehci_softc_t *sc); void ehci_detach(struct ehci_softc *sc); -void ehci_suspend(struct ehci_softc *sc); -void ehci_resume(struct ehci_softc *sc); -void ehci_shutdown(ehci_softc_t *sc); void ehci_interrupt(ehci_softc_t *sc); #endif /* _EHCI_H_ */ Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Tue Jan 3 09:15:54 2012 (r229370) @@ -78,9 +78,6 @@ struct ixp_ehci_softc { static device_attach_t ehci_ixp_attach; static device_detach_t ehci_ixp_detach; -static device_shutdown_t ehci_ixp_shutdown; -static device_suspend_t ehci_ixp_suspend; -static device_resume_t ehci_ixp_resume; static uint8_t ehci_bs_r_1(void *, bus_space_handle_t, bus_size_t); static void ehci_bs_w_1(void *, bus_space_handle_t, bus_size_t, u_int8_t); @@ -90,45 +87,6 @@ static uint32_t ehci_bs_r_4(void *, bus_ static void ehci_bs_w_4(void *, bus_space_handle_t, bus_size_t, uint32_t); static int -ehci_ixp_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ehci_ixp_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ehci_ixp_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} - -static int ehci_ixp_probe(device_t self) { @@ -335,9 +293,9 @@ static device_method_t ehci_methods[] = DEVMETHOD(device_probe, ehci_ixp_probe), DEVMETHOD(device_attach, ehci_ixp_attach), DEVMETHOD(device_detach, ehci_ixp_detach), - DEVMETHOD(device_suspend, ehci_ixp_suspend), - DEVMETHOD(device_resume, ehci_ixp_resume), - DEVMETHOD(device_shutdown, ehci_ixp_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), Modified: stable/8/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_pci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci_pci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "usb_if.h" #define PCI_EHCI_VENDORID_ACERLABS 0x10b9 #define PCI_EHCI_VENDORID_AMD 0x1022 @@ -92,54 +93,10 @@ __FBSDID("$FreeBSD$"); #define PCI_EHCI_VENDORID_NVIDIA2 0x10DE #define PCI_EHCI_VENDORID_VIA 0x1106 -static void ehci_pci_takecontroller(device_t self); - static device_probe_t ehci_pci_probe; static device_attach_t ehci_pci_attach; static device_detach_t ehci_pci_detach; -static device_suspend_t ehci_pci_suspend; -static device_resume_t ehci_pci_resume; -static device_shutdown_t ehci_pci_shutdown; - -static int -ehci_pci_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 09:17:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44F13106564A; Tue, 3 Jan 2012 09:17:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 326E78FC26; Tue, 3 Jan 2012 09:17:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q039HoTi014287; Tue, 3 Jan 2012 09:17:50 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039Houk014285; Tue, 3 Jan 2012 09:17:50 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201030917.q039Houk014285@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 3 Jan 2012 09:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229371 - in stable/8/sys: conf dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 09:17:51 -0000 Author: hselasky Date: Tue Jan 3 09:17:50 2012 New Revision: 229371 URL: http://svn.freebsd.org/changeset/base/229371 Log: MFC r228758: - Fix for race against user-space applications trying to change the configuration on USB HUBs. PR: kern/163091 Modified: stable/8/sys/dev/usb/usb_hub.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Tue Jan 3 09:15:54 2012 (r229370) +++ stable/8/sys/dev/usb/usb_hub.c Tue Jan 3 09:17:50 2012 (r229371) @@ -707,6 +707,13 @@ uhub_explore(struct usb_device *udev) DPRINTF("Device is suspended!\n"); return (0); } + + /* + * Make sure we don't race against user-space applications + * like LibUSB: + */ + usbd_enum_lock(udev); + for (x = 0; x != hub->nports; x++) { up = hub->ports + x; portno = x + 1; @@ -784,6 +791,8 @@ uhub_explore(struct usb_device *udev) up->restartcnt = 0; } + usbd_enum_unlock(udev); + /* initial status checked */ sc->sc_flags |= UHUB_FLAG_DID_EXPLORE; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 10:22:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E35211065677; Tue, 3 Jan 2012 10:22:10 +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 B5ECC8FC1A; Tue, 3 Jan 2012 10:22:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03AMAb5019151; Tue, 3 Jan 2012 10:22:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03AMADJ019148; Tue, 3 Jan 2012 10:22:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201201031022.q03AMADJ019148@svn.freebsd.org> From: Xin LI Date: Tue, 3 Jan 2012 10:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229381 - in stable: 8/etc/defaults 8/etc/periodic/daily 9/etc/defaults 9/etc/periodic/daily X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 10:22:11 -0000 Author: delphij Date: Tue Jan 3 10:22:09 2012 New Revision: 229381 URL: http://svn.freebsd.org/changeset/base/229381 Log: MFC r226471 (se): Add missing default values for daily/800.scrub-zfs for documentation purposes. No functional change, since all parameters are set to their default values. MFC r226865 (delphij): Increase default scrub threshold from 30 days to 5 weeks. Using whole weeks makes it easier to predicate when the scrub would happen. Requested by: gjb Modified: stable/8/etc/defaults/periodic.conf stable/8/etc/periodic/daily/800.scrub-zfs Directory Properties: stable/8/etc/ (props changed) Changes in other areas also in this revision: Modified: stable/9/etc/defaults/periodic.conf stable/9/etc/periodic/daily/800.scrub-zfs Directory Properties: stable/9/etc/ (props changed) Modified: stable/8/etc/defaults/periodic.conf ============================================================================== --- stable/8/etc/defaults/periodic.conf Tue Jan 3 10:02:44 2012 (r229380) +++ stable/8/etc/defaults/periodic.conf Tue Jan 3 10:22:09 2012 (r229381) @@ -144,6 +144,12 @@ daily_status_ntpd_enable="NO" # Check daily_queuerun_enable="YES" # Run mail queue daily_submit_queuerun="YES" # Also submit queue +# 800.scrub-zfs +daily_scrub_zfs_enable="NO" +daily_scrub_zfs_pools="" # empty string selects all pools +daily_scrub_zfs_default_threshold="35" # days between scrubs +#daily_scrub_zfs_${poolname}_threshold="35" # pool specific threshold + # 999.local daily_local="/etc/daily.local" # Local scripts Modified: stable/8/etc/periodic/daily/800.scrub-zfs ============================================================================== --- stable/8/etc/periodic/daily/800.scrub-zfs Tue Jan 3 10:02:44 2012 (r229380) +++ stable/8/etc/periodic/daily/800.scrub-zfs Tue Jan 3 10:22:09 2012 (r229381) @@ -15,7 +15,7 @@ then source_periodic_confs fi -: ${daily_scrub_zfs_default_threshold=30} +: ${daily_scrub_zfs_default_threshold=35} case "$daily_scrub_zfs_enable" in [Yy][Ee][Ss]) From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 13:13:32 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71EF6106564A; Tue, 3 Jan 2012 13:13:32 +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 45DD18FC1D; Tue, 3 Jan 2012 13:13:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03DDWDi025304; Tue, 3 Jan 2012 13:13:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03DDW7o025300; Tue, 3 Jan 2012 13:13:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201031313.q03DDW7o025300@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Jan 2012 13:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229388 - stable/8/lib/libusbhid X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 13:13:32 -0000 Author: mav Date: Tue Jan 3 13:13:31 2012 New Revision: 229388 URL: http://svn.freebsd.org/changeset/base/229388 Log: MFC r213920 (by hselasky): - Add support for libusbhid in 32-bit compatibility mode. - Add missing check for ugd_actlen being too small. - Add missing inclusion guard to usbvar.h header file. Modified: stable/8/lib/libusbhid/Makefile stable/8/lib/libusbhid/descr.c stable/8/lib/libusbhid/usbvar.h Directory Properties: stable/8/lib/libusbhid/ (props changed) Modified: stable/8/lib/libusbhid/Makefile ============================================================================== --- stable/8/lib/libusbhid/Makefile Tue Jan 3 12:47:55 2012 (r229387) +++ stable/8/lib/libusbhid/Makefile Tue Jan 3 13:13:31 2012 (r229388) @@ -19,4 +19,8 @@ SRCS= descr.c descr_compat.c parse.c usa INCS= usbhid.h +.if defined(COMPAT_32BIT) +CFLAGS+= -DCOMPAT_32BIT +.endif + .include Modified: stable/8/lib/libusbhid/descr.c ============================================================================== --- stable/8/lib/libusbhid/descr.c Tue Jan 3 12:47:55 2012 (r229387) +++ stable/8/lib/libusbhid/descr.c Tue Jan 3 13:13:31 2012 (r229388) @@ -103,7 +103,7 @@ hid_get_report_desc(int fd) memset(&ugd, 0, sizeof(ugd)); /* get actual length first */ - ugd.ugd_data = NULL; + ugd.ugd_data = hid_pass_ptr(NULL); ugd.ugd_maxlen = 65535; if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { #ifdef HID_COMPAT7 @@ -124,7 +124,7 @@ hid_get_report_desc(int fd) return (NULL); /* fetch actual descriptor */ - ugd.ugd_data = data; + ugd.ugd_data = hid_pass_ptr(data); ugd.ugd_maxlen = ugd.ugd_actlen; if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { /* could not read descriptor */ @@ -132,8 +132,15 @@ hid_get_report_desc(int fd) return (NULL); } + /* sanity check */ + if (ugd.ugd_actlen < 1) { + /* invalid report descriptor */ + free(data); + return (NULL); + } + /* check END_COLLECTION */ - if (((unsigned char *)ugd.ugd_data)[ugd.ugd_actlen -1] != 0xC0) { + if (((unsigned char *)data)[ugd.ugd_actlen -1] != 0xC0) { /* invalid end byte */ free(data); return (NULL); Modified: stable/8/lib/libusbhid/usbvar.h ============================================================================== --- stable/8/lib/libusbhid/usbvar.h Tue Jan 3 12:47:55 2012 (r229387) +++ stable/8/lib/libusbhid/usbvar.h Tue Jan 3 13:13:31 2012 (r229388) @@ -29,6 +29,9 @@ * */ +#ifndef _USBVAR_H_ +#define _USBVAR_H_ + struct report_desc { uint32_t size; uint8_t data[1]; @@ -41,3 +44,11 @@ int hid_set_immed_compat7(int fd, int en int hid_get_report_id_compat7(int fd); report_desc_t hid_get_report_desc_compat7(int fd); #endif + +#ifdef COMPAT_32BIT +#define hid_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) +#else +#define hid_pass_ptr(ptr) (ptr) +#endif + +#endif /* _USBVAR_H_ */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 13:16:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C07A9106564A; Tue, 3 Jan 2012 13:16: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 ABF9D8FC13; Tue, 3 Jan 2012 13:16:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03DGlDX025483; Tue, 3 Jan 2012 13:16:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03DGl0D025473; Tue, 3 Jan 2012 13:16:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201031316.q03DGl0D025473@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Jan 2012 13:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229389 - in stable/8: lib/libusbhid sys/conf sys/dev/usb/input usr.bin/usbhidaction usr.bin/usbhidctl X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 13:16:47 -0000 Author: mav Date: Tue Jan 3 13:16:47 2012 New Revision: 229389 URL: http://svn.freebsd.org/changeset/base/229389 Log: MFC r225839: Import the rest of HID improvements from the branch: - improve report descriptor parser in libusbhid to handle several kinds of reports same time; - add to the libusbhid API two functions wrapping respective kernel IOCTLs for reading and writing reports; - tune uhid IOCTL interface to allow reading and writing arbitrary report, when multiple supported by the device; - teach usbhidctl to set output and feature reports; - make usbhidaction support all the same item names as bhidctl. Sponsored by: iXsystems, inc. Modified: stable/8/lib/libusbhid/data.c stable/8/lib/libusbhid/parse.c stable/8/lib/libusbhid/usbhid.3 stable/8/lib/libusbhid/usbhid.h stable/8/sys/dev/usb/input/uhid.c stable/8/usr.bin/usbhidaction/usbhidaction.1 stable/8/usr.bin/usbhidaction/usbhidaction.c stable/8/usr.bin/usbhidctl/usbhid.c stable/8/usr.bin/usbhidctl/usbhidctl.1 Directory Properties: stable/8/lib/libusbhid/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/usr.bin/usbhidaction/ (props changed) stable/8/usr.bin/usbhidctl/ (props changed) Modified: stable/8/lib/libusbhid/data.c ============================================================================== --- stable/8/lib/libusbhid/data.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/data.c Tue Jan 3 13:16:47 2012 (r229389) @@ -32,7 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "usbhid.h" +#include "usbvar.h" int32_t hid_get_data(const void *p, const hid_item_t *h) @@ -114,3 +117,27 @@ hid_set_data(void *p, const hid_item_t * buf[offs + i] = (buf[offs + i] & (mask >> (i*8))) | ((data >> (i*8)) & 0xff); } + +int +hid_get_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + return (ioctl(fd, USB_GET_REPORT, &ugd)); +} + +int +hid_set_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + return (ioctl(fd, USB_SET_REPORT, &ugd)); +} Modified: stable/8/lib/libusbhid/parse.c ============================================================================== --- stable/8/lib/libusbhid/parse.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/parse.c Tue Jan 3 13:16:47 2012 (r229389) @@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$"); #define MAXUSAGE 100 #define MAXPUSH 4 #define MAXID 64 +#define ITEMTYPES 3 struct hid_pos_data { int32_t rid; - uint32_t pos; + uint32_t pos[ITEMTYPES]; }; struct hid_data { @@ -55,6 +56,7 @@ struct hid_data { const uint8_t *p; struct hid_item cur[MAXPUSH]; struct hid_pos_data last_pos[MAXID]; + uint32_t pos[ITEMTYPES]; int32_t usages_min[MAXUSAGE]; int32_t usages_max[MAXUSAGE]; int32_t usage_last; /* last seen usage */ @@ -92,7 +94,7 @@ hid_clear_local(hid_item_t *c) static void hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) { - uint8_t i; + uint8_t i, j; /* check for same report ID - optimise */ @@ -113,7 +115,8 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = c->report_ID; - s->last_pos[i].pos = c->pos; + for (j = 0; j < ITEMTYPES; j++) + s->last_pos[i].pos[j] = s->pos[j]; } /* store next report ID */ @@ -134,9 +137,12 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = next_rID; - c->pos = s->last_pos[i].pos; - } else - c->pos = 0; /* Out of RID entries. */ + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = s->last_pos[i].pos[j]; + } else { + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = 0; /* Out of RID entries. */ + } } /*------------------------------------------------------------------------* @@ -206,7 +212,6 @@ hid_get_item(hid_data_t s, hid_item_t *h { hid_item_t *c; unsigned int bTag, bType, bSize; - uint32_t oldpos; int32_t mask; int32_t dval; @@ -240,7 +245,8 @@ hid_get_item(hid_data_t s, hid_item_t *h */ if (s->kindset & (1 << c->kind)) { *h = *c; - c->pos += c->report_size * c->report_count; + h->pos = s->pos[c->kind]; + s->pos[c->kind] += c->report_size * c->report_count; return (1); } } @@ -406,14 +412,10 @@ hid_get_item(hid_data_t s, hid_item_t *h case 11: /* Pop */ s->pushlevel --; if (s->pushlevel < MAXPUSH) { - /* preserve position */ - oldpos = c->pos; c = &s->cur[s->pushlevel]; /* restore size and count */ s->loc_size = c->report_size; s->loc_count = c->report_count; - /* set default item location */ - c->pos = oldpos; c->report_size = 0; c->report_count = 0; } Modified: stable/8/lib/libusbhid/usbhid.3 ============================================================================== --- stable/8/lib/libusbhid/usbhid.3 Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/usbhid.3 Tue Jan 3 13:16:47 2012 (r229389) @@ -44,7 +44,9 @@ .Nm hid_usage_in_page , .Nm hid_init , .Nm hid_get_data , -.Nm hid_set_data +.Nm hid_set_data , +.Nm hid_get_report , +.Nm hid_set_report .Nd USB HID access routines .Sh LIBRARY .Lb libusbhid @@ -84,6 +86,10 @@ .Fn hid_get_data "const void *data" "const hid_item_t *h" .Ft void .Fn hid_set_data "void *buf" "const hid_item_t *h" "int data" +.Ft int +.Fn hid_get_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" +.Ft int +.Fn hid_set_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" .Sh DESCRIPTION The .Nm @@ -105,6 +111,14 @@ Synchronous HID operation can be enabled If the second argument is zero synchronous HID operation is disabled. Else synchronous HID operation is enabled. The function returns a negative value on failure. +.Pp +.Fn hid_get_report +and +.Fn hid_set_report +functions allow to synchronously get and set specific report if device +supports it. +For devices with multiple report IDs, wanted ID should be provided in the +first byte of the buffer for both get and set. .Ss Descriptor Functions The report descriptor ID can be obtained by calling .Fn hid_get_report_id . Modified: stable/8/lib/libusbhid/usbhid.h ============================================================================== --- stable/8/lib/libusbhid/usbhid.h Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/usbhid.h Tue Jan 3 13:16:47 2012 (r229389) @@ -77,6 +77,7 @@ typedef struct hid_item { #define HID_PAGE(u) (((u) >> 16) & 0xffff) #define HID_USAGE(u) ((u) & 0xffff) +#define HID_HAS_GET_SET_REPORT 1 __BEGIN_DECLS @@ -105,5 +106,9 @@ int hid_parse_usage_page(const char *nam /* Extracting/insertion of data, data.c: */ int32_t hid_get_data(const void *p, const hid_item_t *h); void hid_set_data(void *p, const hid_item_t *h, int32_t data); +int hid_get_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); +int hid_set_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); __END_DECLS Modified: stable/8/sys/dev/usb/input/uhid.c ============================================================================== --- stable/8/sys/dev/usb/input/uhid.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/sys/dev/usb/input/uhid.c Tue Jan 3 13:16:47 2012 (r229389) @@ -566,8 +566,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_get_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_SET_REPORT: @@ -592,8 +594,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_set_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_GET_REPORT_ID: Modified: stable/8/usr.bin/usbhidaction/usbhidaction.1 ============================================================================== --- stable/8/usr.bin/usbhidaction/usbhidaction.1 Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidaction/usbhidaction.1 Tue Jan 3 13:16:47 2012 (r229389) @@ -106,8 +106,7 @@ a debounce value, and an action. There must be whitespace between the parts. .Pp The item names are similar to those used by -.Xr usbhidctl 1 , -but each part must be prefixed by its page name. +.Xr usbhidctl 1 . .Pp The value is simply a numeric value. When the item reports this value, Modified: stable/8/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- stable/8/usr.bin/usbhidaction/usbhidaction.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidaction/usbhidaction.c Tue Jan 3 13:16:47 2012 (r229389) @@ -286,12 +286,11 @@ parse_conf(const char *conf, report_desc char *p; int line; char buf[SIZE], name[SIZE], value[SIZE], debounce[SIZE], action[SIZE]; - char usbuf[SIZE], coll[SIZE]; + char usbuf[SIZE], coll[SIZE], *tmp; struct command *cmd, *cmds; struct hid_data *d; struct hid_item h; - int u, lo, hi, range; - + int inst, cinst, u, lo, hi, range, t; f = fopen(conf, "r"); if (f == NULL) @@ -323,6 +322,12 @@ parse_conf(const char *conf, report_desc ", syntax error: %s", conf, line, buf); } } + tmp = strchr(name, '#'); + if (tmp != NULL) { + *tmp = 0; + inst = atoi(tmp + 1); + } else + inst = 0; cmd = malloc(sizeof *cmd); if (cmd == NULL) @@ -367,6 +372,7 @@ parse_conf(const char *conf, report_desc } coll[0] = 0; + cinst = 0; for (d = hid_start_parse(repd, 1 << hid_input, reportid); hid_get_item(d, &h); ) { if (verbose > 2) @@ -386,24 +392,29 @@ parse_conf(const char *conf, report_desc range = 0; } for (u = lo; u <= hi; u++) { - snprintf(usbuf, sizeof usbuf, "%s:%s", - hid_usage_page(HID_PAGE(u)), - hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; if (coll[0]) { snprintf(usbuf, sizeof usbuf, "%s.%s:%s", coll+1, - hid_usage_page(HID_PAGE(u)), + hid_usage_page(HID_PAGE(u)), + hid_usage_in_page(u)); + } else { + snprintf(usbuf, sizeof usbuf, + "%s:%s", + hid_usage_page(HID_PAGE(u)), hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", - usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; } + if (verbose > 2) + printf("usage %s\n", usbuf); + t = strlen(usbuf) - strlen(name); + if (t > 0) { + if (strcmp(usbuf + t, name)) + continue; + if (usbuf[t - 1] != '.') + continue; + } else if (strcmp(usbuf, name)) + continue; + if (inst == cinst++) + goto foundhid; } break; case hid_collection: Modified: stable/8/usr.bin/usbhidctl/usbhid.c ============================================================================== --- stable/8/usr.bin/usbhidctl/usbhid.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidctl/usbhid.c Tue Jan 3 13:16:47 2012 (r229389) @@ -49,45 +49,141 @@ #include #include +struct variable { + char *name; + int instance; + int val; + struct hid_item h; + struct variable *next; +} *vars; + int verbose = 0; -int all = 0; int noname = 0; int hexdump = 0; +int wflag = 0; +int zflag = 0; -char **names; -int nnames; - -void prbits(int bits, char **strs, int n); -void usage(void); -void dumpitem(const char *label, struct hid_item *h); -void dumpitems(report_desc_t r); -void rev(struct hid_item **p); -void prdata(u_char *buf, struct hid_item *h); -void dumpdata(int f, report_desc_t r, int loop); -int gotname(char *n); +static void usage(void); +static void dumpitem(const char *label, struct hid_item *h); +static void dumpitems(report_desc_t r); +static void prdata(u_char *buf, struct hid_item *h); +static void dumpdata(int f, report_desc_t r, int loop); +static void writedata(int f, report_desc_t r); -int -gotname(char *n) +static void +parceargs(report_desc_t r, int all, int nnames, char **names) { - int i; - - for (i = 0; i < nnames; i++) - if (strcmp(names[i], n) == 0) - return 1; - return 0; -} - -void -prbits(int bits, char **strs, int n) -{ - int i; - - for(i = 0; i < n; i++, bits >>= 1) - if (strs[i*2]) - printf("%s%s", i == 0 ? "" : ", ", strs[i*2 + (bits&1)]); + struct hid_data *d; + struct hid_item h; + char colls[1000]; + char hname[1000], *tmp1, *tmp2; + struct variable *var, **pnext; + int i, instance, cp, t; + + pnext = &vars; + if (all) { + if (wflag) + errx(1, "Must not specify -w to read variables"); + cp = 0; + for (d = hid_start_parse(r, + 1<name, "%s%s%s:%s", + colls, colls[0] != 0 ? "." : "", + hid_usage_page(HID_PAGE(h.usage)), + hid_usage_in_page(h.usage)); + var->h = h; + *pnext = var; + pnext = &var->next; + } + hid_end_parse(d); + return; + } + for (i = 0; i < nnames; i++) { + var = malloc(sizeof(*var)); + memset(var, 0, sizeof(*var)); + tmp1 = tmp2 = strdup(names[i]); + strsep(&tmp2, "="); + var->name = strsep(&tmp1, "#"); + if (tmp1 != NULL) + var->instance = atoi(tmp1); + if (tmp2 != NULL) { + if (!wflag) + errx(1, "Must specify -w to write variables"); + var->val = atoi(tmp2); + } else + if (wflag) + errx(1, "Must not specify -w to read variables"); + *pnext = var; + pnext = &var->next; + + instance = 0; + cp = 0; + for (d = hid_start_parse(r, + 1<name); + if (t > 0) { + if (strcmp(hname + t, var->name) != 0) + continue; + if (hname[t - 1] != '.') + continue; + } else if (strcmp(hname, var->name) != 0) + continue; + if (var->instance != instance++) + continue; + var->h = h; + break; + } + hid_end_parse(d); + if (var->h.usage == 0) + errx(1, "Unknown item '%s'", var->name); + } } -void +static void usage(void) { @@ -99,10 +195,14 @@ usage(void) " %s -f device " "[-l] [-n] [-r] [-t tablefile] [-v] [-x] -a\n", getprogname()); + fprintf(stderr, + " %s -f device " + "[-t tablefile] [-v] [-z] -w name=value\n", + getprogname()); exit(1); } -void +static void dumpitem(const char *label, struct hid_item *h) { if ((h->flags & HIO_CONST) && !verbose) @@ -141,7 +241,7 @@ hid_collection_type(int32_t type) return (num); } -void +static void dumpitems(report_desc_t r) { struct hid_data *d; @@ -181,23 +281,7 @@ dumpitems(report_desc_t r) printf("Total feature size %d bytes\n", size); } -void -rev(struct hid_item **p) -{ - struct hid_item *cur, *prev, *next; - - prev = 0; - cur = *p; - while(cur != 0) { - next = cur->next; - cur->next = prev; - prev = cur; - cur = next; - } - *p = prev; -} - -void +static void prdata(u_char *buf, struct hid_item *h) { u_int data; @@ -219,82 +303,162 @@ prdata(u_char *buf, struct hid_item *h) h->pos = pos; } -void +static void dumpdata(int f, report_desc_t rd, int loop) { - struct hid_data *d; - struct hid_item h, *hids, *n; - int r, dlen; + struct variable *var; + int dlen, havedata, i, match, r, rid, use_rid; u_char *dbuf; - u_int32_t colls[100]; - int sp = 0; - char namebuf[10000], *namep; - - hids = 0; - for (d = hid_start_parse(rd, 1<= 256) { + rid = 0; + kind++; + } + if (kind >= 3) + rid = -1; + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && + kind == var->h.kind) + break; + } + if (var == NULL) + continue; + } + dlen = hid_report_size(rd, kind < 3 ? kind : hid_input, rid); + if (dlen <= 0) continue; - h.next = hids; - h.collection = colls[sp]; - hids = malloc(sizeof *hids); - *hids = h; - } - hid_end_parse(d); - rev(&hids); - dlen = hid_report_size(rd, hid_input, -1); - dbuf = malloc(dlen); - if (!loop) - if (hid_set_immed(f, 1) < 0) { - if (errno == EOPNOTSUPP) - warnx("device does not support immediate mode, only changes reported."); - else - err(1, "USB_SET_IMMED"); + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + if (kind < 3) { + dbuf[0] = rid; + r = hid_get_report(f, kind, dbuf, dlen); + if (r < 0) + warn("hid_get_report(rid %d)", rid); + havedata = !r && (rid == 0 || dbuf[0] == rid); + if (rid != 0) + dbuf[0] = rid; + } else { + r = read(f, dbuf, dlen); + if (r < 1) + err(1, "read error"); + havedata = 1; } - do { - r = read(f, dbuf, dlen); - if (r < 1) { - err(1, "read error"); + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + use_rid ? dbuf[0] : 0, dlen); + if (havedata) { + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); + } + printf("\n"); } - for (n = hids; n; n = n->next) { - if (n->report_ID != 0 && dbuf[0] != n->report_ID) + match = 0; + for (var = vars; var; var = var->next) { + if ((kind < 3 ? kind : hid_input) != var->h.kind) continue; - namep = namebuf; - namep += sprintf(namep, "%s:%s.", - hid_usage_page(HID_PAGE(n->collection)), - hid_usage_in_page(n->collection)); - namep += sprintf(namep, "%s:%s", - hid_usage_page(HID_PAGE(n->usage)), - hid_usage_in_page(n->usage)); - if (all || gotname(namebuf)) { - if (!noname) - printf("%s=", namebuf); - prdata(dbuf, n); + if (var->h.report_ID != 0 && + dbuf[0] != var->h.report_ID) + continue; + match = 1; + if (!noname) + printf("%s=", var->name); + if (havedata) + prdata(dbuf, &var->h); + printf("\n"); + } + if (match) + printf("\n"); + free(dbuf); + } while (loop || kind < 3); +} + +static void +writedata(int f, report_desc_t rd) +{ + struct variable *var; + int dlen, i, r, rid; + u_char *dbuf; + enum hid_kind kind; + + kind = 0; + rid = 0; + for (kind = 0; kind < 3; kind ++) { + for (rid = 0; rid < 256; rid ++) { + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && kind == var->h.kind) + break; + } + if (var == NULL) + continue; + dlen = hid_report_size(rd, kind, rid); + if (dlen <= 0) + continue; + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + dbuf[0] = rid; + if (!zflag && hid_get_report(f, kind, dbuf, dlen) == 0) { + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); } + } else if (!zflag) { + warn("hid_get_report(rid %d)", rid); + if (verbose) { + printf("Can't get %s report %d (%d bytes). " + "Will be initialized with zeros.\n", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + } } - if (loop) + for (var = vars; var; var = var->next) { + if (rid != var->h.report_ID || kind != var->h.kind) + continue; + hid_set_data(dbuf, &var->h, var->val); + } + if (verbose) { + printf("Setting %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); - } while (loop); - free(dbuf); + } + r = hid_set_report(f, kind, dbuf, dlen); + if (r != 0) + warn("hid_set_report(rid %d)", rid); + free(dbuf); + } + } } int main(int argc, char **argv) { - int f; report_desc_t r; - char devnam[100], *dev = 0; + char *table = 0; + char devnam[100], *dev = NULL; + int f; + int all = 0; int ch; int repdump = 0; int loop = 0; - char *table = 0; - while ((ch = getopt(argc, argv, "af:lnrt:vx")) != -1) { + while ((ch = getopt(argc, argv, "af:lnrt:vwxz")) != -1) { switch(ch) { case 'a': all++; @@ -317,9 +481,15 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'w': + wflag = 1; + break; case 'x': hexdump = 1; break; + case 'z': + zflag = 1; + break; case '?': default: usage(); @@ -327,12 +497,10 @@ main(int argc, char **argv) } argc -= optind; argv += optind; - if (dev == 0) + if (dev == NULL) usage(); - names = argv; - nnames = argc; - if (nnames == 0 && !all && !repdump) + if (argc == 0 && !all && !repdump) usage(); if (dev[0] != '/') { @@ -357,8 +525,13 @@ main(int argc, char **argv) printf("Report descriptor:\n"); dumpitems(r); } - if (nnames != 0 || all) - dumpdata(f, r, loop); + if (argc != 0 || all) { + parceargs(r, all, argc, argv); + if (wflag) + writedata(f, r); + else + dumpdata(f, r, loop); + } hid_dispose_report_desc(r); exit(0); Modified: stable/8/usr.bin/usbhidctl/usbhidctl.1 ============================================================================== --- stable/8/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 3 13:16:47 2012 (r229389) @@ -35,7 +35,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 23, 2006 +.Dd August 01, 2011 .Dt USBHIDCTL 1 .Os .Sh NAME @@ -43,27 +43,51 @@ .Nd manipulate USB HID devices .Sh SYNOPSIS .Nm -.Op Fl a .Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl x +.Fl r +.Nm +.Fl f Ar device +.Op Fl t Ar table .Op Fl l -.Op Fl n -.Op Fl r +.Op Fl v +.Op Fl x +.Fl a +.Nm +.Fl f Ar device .Op Fl t Ar table +.Op Fl l +.Op Fl n .Op Fl v .Op Fl x -.Op Ar item ... +.Ar item ... +.Nm +.Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl z +.Fl w +.Ar item=value ... .Sh DESCRIPTION The .Nm -utility can be used to dump the state of a USB HID (Human Interface Device). +utility can be used to dump and modify the state of a USB HID (Human +Interface Device). Each named .Ar item is printed. +If the +.Fl w +flag is specified +.Nm +attempts to set the specified items to the given values. .Pp The options are as follows: .Bl -tag -width Ds .It Fl a -Show all items. +Show all items and their current values if device returns. .It Fl f Ar device Specify a path name for the device to operate on. .It Fl l @@ -76,9 +100,47 @@ Dump the report descriptor. Specify a path name for the HID usage table file. .It Fl v Be verbose. +.It Fl w +Change item values. +Only 'output' and 'feature' kinds can be set with this option. .It Fl x Dump data in hexadecimal as well as decimal. +.It Fl z +Reset reports to zero before processing +.Fl w +arguments. If not specified, current values will be requested from device. .El +.Sh SYNTAX +.Nm +compares the names of items specified on the command line against the human +interface items reported by the USB device. +Each human interface item is mapped from its native form to a human readable +name, using the HID usage table file. +Command line items are compared with the generated item names, +and the USB HID device is operated on when a match is found. +.Pp +Each human interface item is named by the +.Qq page +it appears in, the +.Qq usage +within that page, and the list of +.Qq collections +containing the item. +Each collection in turn is also identified by page, and +the usage within that page. +.Pp +On the +.Nm +command line the page name is separated from the usage name with the character +.Sq Cm \&: . +The collections are separated by the character +.Sq Cm \&. . +.Pp +Some devices give the same name to more than one item. +.Nm +supports isolating each item by appending a +.Sq Cm \&# . +character and a decimal item instance number, starting at zero. .Sh FILES .Pa /usr/share/misc/usb_hid_usages The default HID usage table. @@ -91,7 +153,3 @@ The .Nm command appeared in .Nx 1.4 . -.Sh BUGS -The -.Nm -utility cannot show nor set output and feature items. From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 16:54:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68E6E106564A; Tue, 3 Jan 2012 16:54:48 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56FB68FC17; Tue, 3 Jan 2012 16:54:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03GsmBo032704; Tue, 3 Jan 2012 16:54:48 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Gsmbn032702; Tue, 3 Jan 2012 16:54:48 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031654.q03Gsmbn032702@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 16:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229394 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 16:54:48 -0000 Author: fabient Date: Tue Jan 3 16:54:47 2012 New Revision: 229394 URL: http://svn.freebsd.org/changeset/base/229394 Log: MFC r228198: Update Westmere uncore event exception list. Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 16:41:38 2012 (r229393) +++ stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 16:54:47 2012 (r229394) @@ -1479,6 +1479,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0. */ + case PMC_EV_IAP_EVENT_60H_01H: + case PMC_EV_IAP_EVENT_60H_02H: + case PMC_EV_IAP_EVENT_60H_04H: + case PMC_EV_IAP_EVENT_60H_08H: case PMC_EV_IAP_EVENT_B3H_01H: case PMC_EV_IAP_EVENT_B3H_02H: case PMC_EV_IAP_EVENT_B3H_04H: @@ -1488,6 +1492,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0, 1. */ + case PMC_EV_IAP_EVENT_4CH_01H: + case PMC_EV_IAP_EVENT_4EH_01H: + case PMC_EV_IAP_EVENT_4EH_02H: + case PMC_EV_IAP_EVENT_4EH_04H: case PMC_EV_IAP_EVENT_51H_01H: case PMC_EV_IAP_EVENT_51H_02H: case PMC_EV_IAP_EVENT_51H_04H: From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 17:17:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69E561065673; Tue, 3 Jan 2012 17:17:31 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 582D58FC12; Tue, 3 Jan 2012 17:17:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03HHVGw033682; Tue, 3 Jan 2012 17:17:31 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03HHVmr033680; Tue, 3 Jan 2012 17:17:31 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031717.q03HHVmr033680@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 17:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229398 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 17:17:31 -0000 Author: fabient Date: Tue Jan 3 17:17:30 2012 New Revision: 229398 URL: http://svn.freebsd.org/changeset/base/229398 Log: MFC r228438: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:15:27 2012 (r229397) +++ stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:17:30 2012 (r229398) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define CORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* + * A small number of events are not supported in all the + * processors based on a given microarchitecture. + */ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 19:00:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A12A106566B; Tue, 3 Jan 2012 19:00:30 +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 EAA648FC14; Tue, 3 Jan 2012 19:00:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03J0TiR037465; Tue, 3 Jan 2012 19:00:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03J0T0V037462; Tue, 3 Jan 2012 19:00:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201031900.q03J0T0V037462@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 19:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229405 - in stable/8/sys: conf dev/ti X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 19:00:30 -0000 Author: yongari Date: Tue Jan 3 19:00:29 2012 New Revision: 229405 URL: http://svn.freebsd.org/changeset/base/229405 Log: MFC r227086-227089: r227086: Use ANSI function definations. r227087: No functional changes. r227088: Make ti(4) build with 'options TI_PRIVATE_JUMBOS'. This was broken in r175872. We have a UMA backed jumbo allocator and that is much better implementation than having a local jumbo buffer allocator in driver. This local allocator would be removed in near future but fixing build before removal wouldn't be a bad idea. r227089: s/u_intXX_t/uintXX_t/g Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 18:58:20 2012 (r229404) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 19:00:29 2012 (r229405) @@ -140,7 +140,6 @@ typedef enum { TI_SWAP_NTOH } ti_swap_type; - /* * Various supported device vendors/types and their names. */ @@ -199,20 +198,21 @@ static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int); -static u_int8_t ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *); +static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); +static uint8_t ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *); static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int); static void ti_add_mcast(struct ti_softc *, struct ether_addr *); static void ti_del_mcast(struct ti_softc *, struct ether_addr *); static void ti_setmulti(struct ti_softc *); -static void ti_mem_read(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_write(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_zero(struct ti_softc *, u_int32_t, u_int32_t); -static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int, int); -static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, - int, int, int); +static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_write(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_zero(struct ti_softc *, uint32_t, uint32_t); +static int ti_copy_mem(struct ti_softc *, uint32_t, uint32_t, caddr_t, int, + int); +static int ti_copy_scratch(struct ti_softc *, uint32_t, uint32_t, caddr_t, + int, int, int); static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type); static void ti_loadfw(struct ti_softc *); static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); @@ -242,8 +242,8 @@ static int ti_chipinit(struct ti_softc * static int ti_gibinit(struct ti_softc *); #ifdef TI_JUMBO_HDRSPLIT -static __inline void ti_hdr_split (struct mbuf *top, int hdr_len, - int pkt_len, int idx); +static __inline void ti_hdr_split(struct mbuf *top, int hdr_len, int pkt_len, + int idx); #endif /* TI_JUMBO_HDRSPLIT */ static device_method_t ti_methods[] = { @@ -270,11 +270,10 @@ MODULE_DEPEND(ti, ether, 1, 1, 1); /* * Send an instruction or address to the EEPROM, check for ACK. */ -static u_int32_t ti_eeprom_putbyte(sc, byte) - struct ti_softc *sc; - int byte; +static uint32_t +ti_eeprom_putbyte(struct ti_softc *sc, int byte) { - int i, ack = 0; + int i, ack = 0; /* * Make sure we're in TX mode. @@ -316,13 +315,11 @@ static u_int32_t ti_eeprom_putbyte(sc, b * We have to send two address bytes since the EEPROM can hold * more than 256 bytes of data. */ -static u_int8_t ti_eeprom_getbyte(sc, addr, dest) - struct ti_softc *sc; - int addr; - u_int8_t *dest; +static uint8_t +ti_eeprom_getbyte(struct ti_softc *sc, int addr, uint8_t *dest) { - int i; - u_int8_t byte = 0; + int i; + uint8_t byte = 0; EEPROM_START; @@ -393,14 +390,10 @@ static u_int8_t ti_eeprom_getbyte(sc, ad * Read a sequence of bytes from the EEPROM. */ static int -ti_read_eeprom(sc, dest, off, cnt) - struct ti_softc *sc; - caddr_t dest; - int off; - int cnt; +ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt) { - int err = 0, i; - u_int8_t byte = 0; + int err = 0, i; + uint8_t byte = 0; for (i = 0; i < cnt; i++) { err = ti_eeprom_getbyte(sc, off + i, &byte); @@ -417,13 +410,10 @@ ti_read_eeprom(sc, dest, off, cnt) * Can be used to copy data from NIC local memory. */ static void -ti_mem_read(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_read(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -436,7 +426,7 @@ ti_mem_read(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -450,13 +440,10 @@ ti_mem_read(sc, addr, len, buf) * Can be used to copy data into NIC local memory. */ static void -ti_mem_write(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_write(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -469,7 +456,7 @@ ti_mem_write(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -482,11 +469,9 @@ ti_mem_write(sc, addr, len, buf) * Can be used to clear a section of NIC local memory. */ static void -ti_mem_zero(sc, addr, len) - struct ti_softc *sc; - u_int32_t addr, len; +ti_mem_zero(struct ti_softc *sc, uint32_t addr, uint32_t len) { - int segptr, segsize, cnt; + int segptr, segsize, cnt; segptr = addr; cnt = len; @@ -505,18 +490,15 @@ ti_mem_zero(sc, addr, len) } static int -ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; -{ - int segptr, segsize, cnt; - caddr_t ptr; - u_int32_t origwin; - u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; - int resid, segresid; - int first_pass; +ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata) +{ + int segptr, segsize, cnt; + caddr_t ptr; + uint32_t origwin; + uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; + int resid, segresid; + int first_pass; TI_LOCK_ASSERT(sc); @@ -577,7 +559,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); if (useraddr) { /* @@ -624,7 +606,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); } segptr += segsize; @@ -636,7 +618,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - u_int32_t tmpval, tmpval2; + uint32_t tmpval, tmpval2; bus_size_t ti_offset; /* @@ -704,17 +686,13 @@ ti_copy_mem(sc, tigon_addr, len, buf, us } static int -ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; - int cpu; -{ - u_int32_t segptr; - int cnt; - u_int32_t tmpval, tmpval2; - caddr_t ptr; +ti_copy_scratch(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata, int cpu) +{ + uint32_t segptr; + int cnt; + uint32_t tmpval, tmpval2; + caddr_t ptr; TI_LOCK_ASSERT(sc); @@ -802,14 +780,10 @@ ti_copy_scratch(sc, tigon_addr, len, buf } static int -ti_bcopy_swap(src, dst, len, swap_type) - const void *src; - void *dst; - size_t len; - ti_swap_type swap_type; +ti_bcopy_swap(const void *src, void *dst, size_t len, ti_swap_type swap_type) { - const u_int8_t *tmpsrc; - u_int8_t *tmpdst; + const uint8_t *tmpsrc; + uint8_t *tmpdst; size_t tmplen; if (len & 0x3) { @@ -824,11 +798,11 @@ ti_bcopy_swap(src, dst, len, swap_type) while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(u_int32_t *)tmpdst = - ntohl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + ntohl(*(const uint32_t *)tmpsrc); else - *(u_int32_t *)tmpdst = - htonl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; @@ -844,8 +818,7 @@ ti_bcopy_swap(src, dst, len, swap_type) * Tigon 2. */ static void -ti_loadfw(sc) - struct ti_softc *sc; +ti_loadfw(struct ti_softc *sc) { TI_LOCK_ASSERT(sc); @@ -902,14 +875,12 @@ ti_loadfw(sc) * Send the NIC a command via the command ring. */ static void -ti_cmd(sc, cmd) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; +ti_cmd(struct ti_softc *sc, struct ti_cmd_desc *cmd) { - int index; + int index; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); sc->ti_cmd_saved_prodidx = index; @@ -920,21 +891,17 @@ ti_cmd(sc, cmd) * number of command slots to include after the initial command. */ static void -ti_cmd_ext(sc, cmd, arg, len) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; - caddr_t arg; - int len; +ti_cmd_ext(struct ti_softc *sc, struct ti_cmd_desc *cmd, caddr_t arg, int len) { - int index; - int i; + int index; + int i; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); for (i = 0; i < len; i++) { CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), - *(u_int32_t *)(&arg[i * 4])); + *(uint32_t *)(&arg[i * 4])); TI_INC(index, TI_CMD_RING_CNT); } CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); @@ -945,10 +912,9 @@ ti_cmd_ext(sc, cmd, arg, len) * Handle events that have triggered interrupts. */ static void -ti_handle_events(sc) - struct ti_softc *sc; +ti_handle_events(struct ti_softc *sc) { - struct ti_event_desc *e; + struct ti_event_desc *e; if (sc->ti_rdata->ti_event_ring == NULL) return; @@ -1089,12 +1055,11 @@ ti_free_dmamaps(struct ti_softc *sc) */ static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { - caddr_t ptr; - int i; - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; + caddr_t ptr; + int i; /* * Grab a big chunk o' storage. Since we are chopping this pool up @@ -1152,10 +1117,9 @@ ti_alloc_jumbo_mem(sc) /* * Allocate a jumbo buffer. */ -static void *ti_jalloc(sc) - struct ti_softc *sc; +static void *ti_jalloc(struct ti_softc *sc) { - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; entry = SLIST_FIRST(&sc->ti_jfree_listhead); @@ -1173,13 +1137,11 @@ static void *ti_jalloc(sc) * Release a jumbo buffer. */ static void -ti_jfree(buf, args) - void *buf; - void *args; -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; +ti_jfree(void *buf, void *args) +{ + struct ti_softc *sc; + int i; + struct ti_jpool_entry *entry; /* Extract the softc struct pointer. */ sc = (struct ti_softc *)args; @@ -1205,8 +1167,7 @@ ti_jfree(buf, args) #else static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { /* @@ -1237,16 +1198,13 @@ ti_alloc_jumbo_mem(sc) * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + bus_dma_segment_t segs; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1292,16 +1250,13 @@ ti_newbuf_std(sc, i, m) * the Tigon 2. */ static int -ti_newbuf_mini(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dma_segment_t segs; - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dma_segment_t segs; + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1344,19 +1299,16 @@ ti_newbuf_mini(sc, i, m) * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; + bus_dma_segment_t segs; if (m == NULL) { - caddr_t *buf = NULL; + caddr_t *buf = NULL; /* Allocate the mbuf. */ MGETHDR(m_new, M_DONTWAIT, MT_DATA); @@ -1376,7 +1328,7 @@ ti_newbuf_jumbo(sc, i, m) /* Attach the buffer to the mbuf. */ m_new->m_data = (void *) buf; m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, + MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, (struct ti_softc *)sc, 0, EXT_NET_DRV); } else { m_new = m; @@ -1417,30 +1369,26 @@ ti_newbuf_jumbo(sc, i, m) #define TCP_HDR_LEN (52 + sizeof(struct ether_header)) #define UDP_HDR_LEN (28 + sizeof(struct ether_header)) #define NFS_HDR_LEN (UDP_HDR_LEN) -static int HDR_LEN = TCP_HDR_LEN; - +static int HDR_LEN = TCP_HDR_LEN; /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, idx, m_old) - struct ti_softc *sc; - int idx; - struct mbuf *m_old; -{ - bus_dmamap_t map; - struct mbuf *cur, *m_new = NULL; - struct mbuf *m[3] = {NULL, NULL, NULL}; - struct ti_rx_desc_ext *r; - vm_page_t frame; - static int color; - /* 1 extra buf to make nobufs easy*/ - struct sf_buf *sf[3] = {NULL, NULL, NULL}; - int i; - bus_dma_segment_t segs[4]; - int nsegs; +ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) +{ + bus_dmamap_t map; + struct mbuf *cur, *m_new = NULL; + struct mbuf *m[3] = {NULL, NULL, NULL}; + struct ti_rx_desc_ext *r; + vm_page_t frame; + static int color; + /* 1 extra buf to make nobufs easy*/ + struct sf_buf *sf[3] = {NULL, NULL, NULL}; + int i; + bus_dma_segment_t segs[4]; + int nsegs; if (m_old != NULL) { m_new = m_old; @@ -1575,8 +1523,6 @@ nobufs: } #endif - - /* * The standard receive ring has 512 entries in it. At 2K per mbuf cluster, * that's 1MB or memory, which is a lot. For now, we fill only the first @@ -1584,11 +1530,10 @@ nobufs: * the NIC. */ static int -ti_init_rx_ring_std(sc) - struct ti_softc *sc; +ti_init_rx_ring_std(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + int i; + struct ti_cmd_desc cmd; for (i = 0; i < TI_SSLOTS; i++) { if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) @@ -1602,11 +1547,10 @@ ti_init_rx_ring_std(sc) } static void -ti_free_rx_ring_std(sc) - struct ti_softc *sc; +ti_free_rx_ring_std(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { @@ -1623,11 +1567,10 @@ ti_free_rx_ring_std(sc) } static int -ti_init_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_init_rx_ring_jumbo(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + struct ti_cmd_desc cmd; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) @@ -1641,11 +1584,10 @@ ti_init_rx_ring_jumbo(sc) } static void -ti_free_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_free_rx_ring_jumbo(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { @@ -1662,10 +1604,9 @@ ti_free_rx_ring_jumbo(sc) } static int -ti_init_rx_ring_mini(sc) - struct ti_softc *sc; +ti_init_rx_ring_mini(struct ti_softc *sc) { - int i; + int i; for (i = 0; i < TI_MSLOTS; i++) { if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) @@ -1679,11 +1620,10 @@ ti_init_rx_ring_mini(sc) } static void -ti_free_rx_ring_mini(sc) - struct ti_softc *sc; +ti_free_rx_ring_mini(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { @@ -1700,11 +1640,10 @@ ti_free_rx_ring_mini(sc) } static void -ti_free_tx_ring(sc) - struct ti_softc *sc; +ti_free_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; if (sc->ti_rdata->ti_tx_ring == NULL) return; @@ -1724,11 +1663,10 @@ ti_free_tx_ring(sc) } static int -ti_init_tx_ring(sc) - struct ti_softc *sc; +ti_init_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; STAILQ_INIT(&sc->ti_cdata.ti_txfreeq); STAILQ_INIT(&sc->ti_cdata.ti_txbusyq); @@ -1749,15 +1687,13 @@ ti_init_tx_ring(sc) * work. */ static void -ti_add_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1777,15 +1713,13 @@ ti_add_mcast(sc, addr) } static void -ti_del_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1819,14 +1753,13 @@ ti_del_mcast(sc, addr) * any given time. */ static void -ti_setmulti(sc) - struct ti_softc *sc; +ti_setmulti(struct ti_softc *sc) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - struct ti_cmd_desc cmd; - struct ti_mc_entry *mc; - u_int32_t intrs; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct ti_cmd_desc cmd; + struct ti_mc_entry *mc; + uint32_t intrs; TI_LOCK_ASSERT(sc); @@ -1879,9 +1812,9 @@ ti_setmulti(sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(sc) - struct ti_softc *sc; +static int ti_64bitslot_war(struct ti_softc *sc) { + if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { CSR_WRITE_4(sc, 0x600, 0); CSR_WRITE_4(sc, 0x604, 0); @@ -1905,12 +1838,11 @@ static int ti_64bitslot_war(sc) * self-test results. */ static int -ti_chipinit(sc) - struct ti_softc *sc; +ti_chipinit(struct ti_softc *sc) { - u_int32_t cacheline; - u_int32_t pci_writemax = 0; - u_int32_t hdrsplit; + uint32_t cacheline; + uint32_t pci_writemax = 0; + uint32_t hdrsplit; /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; @@ -2059,13 +1991,12 @@ ti_chipinit(sc) * start the CPU(s) running. */ static int -ti_gibinit(sc) - struct ti_softc *sc; +ti_gibinit(struct ti_softc *sc) { - struct ti_rcb *rcb; - int i; - struct ifnet *ifp; - uint32_t rdphys; + struct ifnet *ifp; + struct ti_rcb *rcb; + uint32_t rdphys; + int i; TI_LOCK_ASSERT(sc); @@ -2246,16 +2177,15 @@ ti_rdata_cb(void *arg, bus_dma_segment_t sc->ti_rdata_phys = segs[0].ds_addr; return; } - + /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. */ static int -ti_probe(dev) - device_t dev; +ti_probe(device_t dev) { - const struct ti_type *t; + const struct ti_type *t; t = ti_devs; @@ -2272,13 +2202,12 @@ ti_probe(dev) } static int -ti_attach(dev) - device_t dev; +ti_attach(device_t dev) { - struct ifnet *ifp; - struct ti_softc *sc; - int error = 0, rid; - u_char eaddr[6]; + struct ifnet *ifp; + struct ti_softc *sc; + int error = 0, rid; + u_char eaddr[6]; sc = device_get_softc(dev); sc->ti_unit = device_get_unit(dev); @@ -2561,11 +2490,10 @@ fail: * allocated. */ static int -ti_detach(dev) - device_t dev; +ti_detach(device_t dev) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = device_get_softc(dev); if (sc->dev) @@ -2688,23 +2616,22 @@ ti_hdr_split(struct mbuf *top, int hdr_l */ static void -ti_rxeof(sc) - struct ti_softc *sc; +ti_rxeof(struct ti_softc *sc) { - bus_dmamap_t map; - struct ifnet *ifp; - struct ti_cmd_desc cmd; + struct ifnet *ifp; + bus_dmamap_t map; + struct ti_cmd_desc cmd; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { - struct ti_rx_desc *cur_rx; - u_int32_t rxidx; - struct mbuf *m = NULL; - u_int16_t vlan_tag = 0; - int have_tag = 0; + struct ti_rx_desc *cur_rx; + struct mbuf *m = NULL; + uint32_t rxidx; + uint16_t vlan_tag = 0; + int have_tag = 0; cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; @@ -2822,14 +2749,13 @@ ti_rxeof(sc) } static void -ti_txeof(sc) - struct ti_softc *sc; +ti_txeof(struct ti_softc *sc) { - struct ti_txdesc *txd; - struct ti_tx_desc txdesc; - struct ti_tx_desc *cur_tx = NULL; - struct ifnet *ifp; - int idx; + struct ti_txdesc *txd; + struct ti_tx_desc txdesc; + struct ti_tx_desc *cur_tx = NULL; + struct ifnet *ifp; + int idx; ifp = sc->ti_ifp; @@ -2869,11 +2795,10 @@ ti_txeof(sc) } static void -ti_intr(xsc) - void *xsc; +ti_intr(void *xsc) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = xsc; TI_LOCK(sc); @@ -2912,10 +2837,9 @@ ti_intr(xsc) } static void -ti_stats_update(sc) - struct ti_softc *sc; +ti_stats_update(struct ti_softc *sc) { - struct ifnet *ifp; + struct ifnet *ifp; ifp = sc->ti_ifp; @@ -2938,17 +2862,15 @@ ti_stats_update(sc) * pointers to descriptors. */ static int -ti_encap(sc, m_head) - struct ti_softc *sc; - struct mbuf **m_head; -{ - struct ti_txdesc *txd; - struct ti_tx_desc *f; - struct ti_tx_desc txdesc; - struct mbuf *m; - bus_dma_segment_t txsegs[TI_MAXTXSEGS]; - u_int16_t csum_flags; - int error, frag, i, nseg; +ti_encap(struct ti_softc *sc, struct mbuf **m_head) +{ + struct ti_txdesc *txd; + struct ti_tx_desc *f; + struct ti_tx_desc txdesc; + struct mbuf *m; + bus_dma_segment_t txsegs[TI_MAXTXSEGS]; + uint16_t csum_flags; + int error, frag, i, nseg; if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL) return (ENOBUFS); @@ -3043,10 +2965,9 @@ ti_encap(sc, m_head) } static void -ti_start(ifp) - struct ifnet *ifp; +ti_start(struct ifnet *ifp) { - struct ti_softc *sc; + struct ti_softc *sc; sc = ifp->if_softc; TI_LOCK(sc); @@ -3059,12 +2980,11 @@ ti_start(ifp) * to the mbuf data regions directly in the transmit descriptors. */ static void -ti_start_locked(ifp) - struct ifnet *ifp; +ti_start_locked(struct ifnet *ifp) { - struct ti_softc *sc; - struct mbuf *m_head = NULL; - int enq = 0; + struct ti_softc *sc; + struct mbuf *m_head = NULL; + int enq = 0; sc = ifp->if_softc; @@ -3125,10 +3045,9 @@ ti_start_locked(ifp) } static void -ti_init(xsc) - void *xsc; +ti_init(void *xsc) { - struct ti_softc *sc; + struct ti_softc *sc; sc = xsc; TI_LOCK(sc); @@ -3137,10 +3056,9 @@ ti_init(xsc) } static void -ti_init_locked(xsc) - void *xsc; +ti_init_locked(void *xsc) { - struct ti_softc *sc = xsc; + struct ti_softc *sc = xsc; /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3152,14 +3070,13 @@ ti_init_locked(xsc) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 20:26:28 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83C73106568B; Tue, 3 Jan 2012 20:26:28 +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 714628FC17; Tue, 3 Jan 2012 20:26:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03KQS1Q041141; Tue, 3 Jan 2012 20:26:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KQSiF041139; Tue, 3 Jan 2012 20:26:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032026.q03KQSiF041139@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229418 - in stable/8/sys: conf dev/ti X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 20:26:28 -0000 Author: yongari Date: Tue Jan 3 20:26:28 2012 New Revision: 229418 URL: http://svn.freebsd.org/changeset/base/229418 Log: MFC r227091-227095,227098-227099: r227091: Make sure to unload loaded DMA area(descriptor, command, event ring). r227092: Announce IFCAP_LINKSTATE capability and let network stack know link state changes. Hide superfluous link up/down message under bootverbose since if_link_state_change(9) shows that information. While I'm here, change baudrate with the resolved speed of the established link instead of blindly setting it 1G. Unfortunately, it seems there is no way to differentiate 10/100Mbps from non-gigabit link so just assume we established a 100Mbps link if current link is not a gigabit link. r227093: Introduce ti_ifmedia_upd_locked() to use in driver initialization and add missing driver lock for both ti_ifmedia_upd() and ti_ifmedia_sts(). r227094: Don't clear upper 4bits from VLAN tag information. It's responsibility of vlan(4) to extract VLAN id from the tag information and vlan(4) correctly handles it. r227095: Don't abuse if_hwassist and make sure enabling corresponding TX/RX checksum offloading and VLAN hardware tag insertion/stripping from the currently enabled hardware offloading capabilities. Previously if_hwassist, which was initialized to TX/RX checksum offloading, was blindly used to enable both TX and RX checksum offloading such that disabling either TX or RX checksum offloading was not possible. ti(4) controllers support TX/RX checksum offloading with VLAN tagging so announce TX/RX checksum offloading capability over VLAN to vlan(4). Make VLAN hardware tag insertion/stripping honors currently enabled interface capability instead of blindly enabling VLAN hardware tagging. This change allows disabling hardware support of VLAN tag. Because ti(4) supports VLAN oversized frames, make network stack know the capability by setting if_hdrlen. While I'm here, rewrite SIOCSIFCAP handler and make sure to reinitialize controller whenever TX/RX checksum offloading and VLAN hardware tagging option is changed. The requirement of controller reinitialization comes from the limitation of Tigon I/II firmware. Tigon I/II firmware requires all related RCBs should be reinitialized whenever any of its hardware offloading capabilities change. vlan(4) is also notified whenever the parent interface's capability changes such that it can correctly handle TX/RX checksum offloading based on parent interface's enabled offloading capabilities. RX checksum offloading handler was changed to make upper stack use controller computed partial checksum value. Previously, ti(4) just set the computed value for any frames(IPv4, IPv6) and the value was not used in upper stack because driver didn't set CSUM_DATA_VALID such that upper network stack had to recompute checksum of TCP/UDP packets. I have no idea how this was not noticed for a long time. With this change, upper network stack does not have to fully recompute the checksum such that calculating pseudo checksum based on partial checksum is sufficient to know whether received packet's checksum is correct or not. However, I don't know why ti(4) does not have controller compute pseudo checksum as controller has ability to do it. I'm just guessing enabling that feature could trigger a firmware bug or could be slower than computing it on host side so just leave it as it was. In order not to produce false positives, ti(4) now checks whether controller actually computed IP or TCP/UDP checksum by checking ti_flags field. r227098: Because ti(4) drops a driver lock in RX handler, check whether driver is still running before re-enabling interrupts. r227099: Implement altq(4) support. While I'm here fix a logic error in r227098 where it didn't re-enable interrupts when TX queue is empty. Modified: stable/8/sys/dev/ti/if_ti.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:24:56 2012 (r229417) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:26:28 2012 (r229418) @@ -196,6 +196,7 @@ static void ti_stop(struct ti_softc *); static void ti_watchdog(void *); static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); +static int ti_ifmedia_upd_locked(struct ti_softc *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); @@ -924,12 +925,26 @@ ti_handle_events(struct ti_softc *sc) switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); - if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) - device_printf(sc->ti_dev, "10/100 link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) - device_printf(sc->ti_dev, "gigabit link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) - device_printf(sc->ti_dev, "link down\n"); + if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Mbps(100); + if (bootverbose) + device_printf(sc->ti_dev, + "10/100 link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Gbps(1UL); + if (bootverbose) + device_printf(sc->ti_dev, + "gigabit link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + if_link_state_change(sc->ti_ifp, + LINK_STATE_DOWN); + sc->ti_ifp->if_baudrate = 0; + if (bootverbose) + device_printf(sc->ti_dev, + "link down\n"); + } break; case TI_EV_ERROR: if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) @@ -1237,7 +1252,7 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1284,7 +1299,7 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1350,7 +1365,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1494,7 +1509,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM; r->ti_idx = idx; @@ -1847,11 +1862,6 @@ ti_chipinit(struct ti_softc *sc) /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; - if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM) - sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; - else - sc->ti_ifp->if_hwassist = 0; - /* Set endianness before we access any non-PCI registers. */ #if 0 && BYTE_ORDER == BIG_ENDIAN CSR_WRITE_4(sc, TI_MISC_HOST_CTL, @@ -1970,7 +1980,7 @@ ti_chipinit(struct ti_softc *sc) * the firmware racks up lots of nicDmaReadRingFull * errors. This is not compatible with hardware checksums. */ - if (sc->ti_ifp->if_hwassist == 0) + if ((sc->ti_ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_RXCSUM)) == 0) TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE); /* Recommended settings from Tigon manual. */ @@ -2057,10 +2067,11 @@ ti_gibinit(struct ti_softc *sc) TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; @@ -2073,10 +2084,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_max_len = PAGE_SIZE; rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD; #endif - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the mini ring. Only activated on the @@ -2090,10 +2102,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; else rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the receive return ring. @@ -2122,8 +2135,9 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = 0; else rcb->ti_flags = TI_RCB_FLAG_HOST_RING; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_TXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; @@ -2223,8 +2237,8 @@ ti_attach(device_t dev) error = ENOSPC; goto fail; } - sc->ti_ifp->if_capabilities = IFCAP_HWCSUM | - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; + sc->ti_ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_RXCSUM; sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities; /* @@ -2419,8 +2433,10 @@ ti_attach(device_t dev) ifp->if_ioctl = ti_ioctl; ifp->if_start = ti_start; ifp->if_init = ti_init; - ifp->if_baudrate = 1000000000; - ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; + ifp->if_baudrate = IF_Gbps(1UL); + ifp->if_snd.ifq_drv_maxlen = TI_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); /* Set up ifmedia support. */ if (sc->ti_copper) { @@ -2466,6 +2482,17 @@ ti_attach(device_t dev) */ ether_ifattach(ifp, eaddr); + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | + IFCAP_VLAN_HWTAGGING; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer we support VLAN over-sized frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + + /* Driver supports link state tracking. */ + ifp->if_capabilities |= IFCAP_LINKSTATE; + ifp->if_capenable |= IFCAP_LINKSTATE; + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE, NULL, ti_intr, sc, &sc->ti_intrhand); @@ -2524,6 +2551,8 @@ ti_detach(device_t dev) bus_dma_tag_destroy(sc->ti_mbuftx_dmat); if (sc->ti_mbufrx_dmat) bus_dma_tag_destroy(sc->ti_mbufrx_dmat); + if (sc->ti_rdata && sc->ti_rdata_dmamap) + bus_dmamap_unload(sc->ti_rdata_dmat, sc->ti_rdata_dmamap); if (sc->ti_rdata) bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata, sc->ti_rdata_dmamap); @@ -2640,7 +2669,7 @@ ti_rxeof(struct ti_softc *sc) if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { have_tag = 1; - vlan_tag = cur_rx->ti_vlan_tag & 0xfff; + vlan_tag = cur_rx->ti_vlan_tag; } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { @@ -2717,12 +2746,17 @@ ti_rxeof(struct ti_softc *sc) ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; - if (ifp->if_hwassist) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | - CSUM_DATA_VALID; - if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum; + if (ifp->if_capenable & IFCAP_RXCSUM) { + if (cur_rx->ti_flags & TI_BDFLAG_IP_CKSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->ti_flags & TI_BDFLAG_TCP_UDP_CKSUM) { + m->m_pkthdr.csum_data = + cur_rx->ti_tcp_udp_cksum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + } } /* @@ -2826,12 +2860,12 @@ ti_intr(void *xsc) ti_handle_events(sc); - /* Re-enable interrupts. */ - CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_snd.ifq_head != NULL) - ti_start_locked(ifp); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* Re-enable interrupts. */ + CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + ti_start_locked(ifp); + } TI_UNLOCK(sc); } @@ -2935,7 +2969,7 @@ ti_encap(struct ti_softc *sc, struct mbu f->ti_flags = csum_flags; if (m->m_flags & M_VLANTAG) { f->ti_flags |= TI_BDFLAG_VLAN_TAG; - f->ti_vlan_tag = m->m_pkthdr.ether_vtag & 0xfff; + f->ti_vlan_tag = m->m_pkthdr.ether_vtag; } else { f->ti_vlan_tag = 0; } @@ -2988,9 +3022,9 @@ ti_start_locked(struct ifnet *ifp) sc = ifp->if_softc; - for (; ifp->if_snd.ifq_head != NULL && + for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && sc->ti_txcnt < (TI_TX_RING_CNT - 16);) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -3006,7 +3040,7 @@ ti_start_locked(struct ifnet *ifp) m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { if ((TI_TX_RING_CNT - sc->ti_txcnt) < m_head->m_pkthdr.csum_data + 16) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3020,7 +3054,7 @@ ti_start_locked(struct ifnet *ifp) if (ti_encap(sc, &m_head)) { if (m_head == NULL) break; - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3152,7 +3186,7 @@ static void ti_init2(struct ti_softc *sc ifm = &sc->ifmedia; tmp = ifm->ifm_media; ifm->ifm_media = ifm->ifm_cur->ifm_media; - ti_ifmedia_upd(ifp); + ti_ifmedia_upd_locked(sc); ifm->ifm_media = tmp; } @@ -3163,11 +3197,23 @@ static int ti_ifmedia_upd(struct ifnet *ifp) { struct ti_softc *sc; + int error; + + sc = ifp->if_softc; + TI_LOCK(sc); + error = ti_ifmedia_upd(ifp); + TI_UNLOCK(sc); + + return (error); +} + +static int +ti_ifmedia_upd_locked(struct ti_softc *sc) +{ struct ifmedia *ifm; struct ti_cmd_desc cmd; uint32_t flowctl; - sc = ifp->if_softc; ifm = &sc->ifmedia; if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) @@ -3268,11 +3314,15 @@ ti_ifmedia_sts(struct ifnet *ifp, struct sc = ifp->if_softc; + TI_LOCK(sc); + ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) + if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + TI_UNLOCK(sc); return; + } ifmr->ifm_status |= IFM_ACTIVE; @@ -3304,6 +3354,7 @@ ti_ifmedia_sts(struct ifnet *ifp, struct if (media & TI_LNK_HALF_DUPLEX) ifmr->ifm_active |= IFM_HDX; } + TI_UNLOCK(sc); } static int @@ -3370,15 +3421,32 @@ ti_ioctl(struct ifnet *ifp, u_long comma case SIOCSIFCAP: TI_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_HWCSUM) { - if (IFCAP_HWCSUM & ifp->if_capenable) - ifp->if_capenable &= ~IFCAP_HWCSUM; - else - ifp->if_capenable |= IFCAP_HWCSUM; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + 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 |= TI_CSUM_FEATURES; + else + ifp->if_hwassist &= ~TI_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if ((mask & IFCAP_VLAN_HWCSUM) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & (IFCAP_TXCSUM | IFCAP_RXCSUM | + IFCAP_VLAN_HWTAGGING)) != 0) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); + } } TI_UNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: error = ether_ioctl(ifp, command, data); From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 20:50:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C66CB106564A; Tue, 3 Jan 2012 20:50:48 +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 B3DF98FC1B; Tue, 3 Jan 2012 20:50:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03KomUh042363; Tue, 3 Jan 2012 20:50:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Komjg042360; Tue, 3 Jan 2012 20:50:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032050.q03Komjg042360@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229422 - in stable/8/sys: conf dev/ti X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 20:50:48 -0000 Author: yongari Date: Tue Jan 3 20:50:48 2012 New Revision: 229422 URL: http://svn.freebsd.org/changeset/base/229422 Log: MFC r227311-227312,227318-227319,227322-227324: r227311: Remove ti_unit member variable in softc. While I'm here use PCIR_BAR macro. r227312: o Remove unnecessary controller reinitialization. o Do not blindly UP controller when MTU is changed. Reinitialize controller only if driver is running. o Remove useless ti_stop() in ti_watchdog() since ti_init_locked() always invokes ti_stop(). r227318: Track which ring was updated in RX handler and update only modified ring. This should reduce unnecessary register accesses. r227319: Mini ring is not available on Tigon 1 so do not create DMA maps for mini ring on Tigon 1 to save resources. r227322: Show RX buffer allocation failure and do not blindly send alive message to firmware. Probably the correct way for this error is to send a TI_CMD_CODE_STACK_DOWN message to firmware and let firmware handle the rest. r227323: If ti_chipinit() fails in ti_stop(), ignore the error and release all allocated TX/RX buffer resources. If the interface is brought to up again after the error, we will leak allocated TX/RX buffers. r227324: Do not allow changing MTU to be less than the minimum. Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:48:28 2012 (r229421) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:50:48 2012 (r229422) @@ -998,6 +998,11 @@ ti_alloc_dmamaps(struct ti_softc *sc) &sc->ti_cdata.ti_rx_jumbo_maps[i])) return (ENOBUFS); } + + /* Mini ring is not available on Tigon 1. */ + if (sc->ti_hwrev == TI_HWREV_TIGON) + return (0); + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, &sc->ti_cdata.ti_rx_mini_maps[i])) @@ -2224,7 +2229,6 @@ ti_attach(device_t dev) u_char eaddr[6]; sc = device_get_softc(dev); - sc->ti_unit = device_get_unit(dev); sc->ti_dev = dev; mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, @@ -2246,7 +2250,7 @@ ti_attach(device_t dev) */ pci_enable_busmaster(dev); - rid = TI_PCI_LOMEM; + rid = PCIR_BAR(0); sc->ti_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -2473,8 +2477,8 @@ ti_attach(device_t dev) */ /* Register the device */ - sc->dev = make_dev(&ti_cdevsw, sc->ti_unit, UID_ROOT, GID_OPERATOR, - 0600, "ti%d", sc->ti_unit); + sc->dev = make_dev(&ti_cdevsw, device_get_unit(dev), UID_ROOT, + GID_OPERATOR, 0600, "ti%d", device_get_unit(dev)); sc->dev->si_drv1 = sc; /* @@ -2565,7 +2569,7 @@ ti_detach(device_t dev) if (sc->ti_irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq); if (sc->ti_res) { - bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM, + bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->ti_res); } if (ifp) @@ -2650,15 +2654,17 @@ ti_rxeof(struct ti_softc *sc) struct ifnet *ifp; bus_dmamap_t map; struct ti_cmd_desc cmd; + int jumbocnt, minicnt, stdcnt; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; + jumbocnt = minicnt = stdcnt = 0; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { struct ti_rx_desc *cur_rx; - struct mbuf *m = NULL; uint32_t rxidx; + struct mbuf *m = NULL; uint16_t vlan_tag = 0; int have_tag = 0; @@ -2673,7 +2679,7 @@ ti_rxeof(struct ti_softc *sc) } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { - + jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; @@ -2703,6 +2709,7 @@ ti_rxeof(struct ti_softc *sc) m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); #endif /* TI_PRIVATE_JUMBOS */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { + minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; @@ -2722,6 +2729,7 @@ ti_rxeof(struct ti_softc *sc) } m->m_len = cur_rx->ti_len; } else { + stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; @@ -2777,9 +2785,12 @@ ti_rxeof(struct ti_softc *sc) CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, sc->ti_rx_saved_considx); - TI_UPDATE_STDPROD(sc, sc->ti_std); - TI_UPDATE_MINIPROD(sc, sc->ti_mini); - TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); + if (stdcnt > 0) + TI_UPDATE_STDPROD(sc, sc->ti_std); + if (minicnt > 0) + TI_UPDATE_MINIPROD(sc, sc->ti_mini); + if (jumbocnt > 0) + TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); } static void @@ -3094,6 +3105,9 @@ ti_init_locked(void *xsc) { struct ti_softc *sc = xsc; + if (sc->ti_ifp->if_drv_flags & IFF_DRV_RUNNING) + return; + /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3117,7 +3131,7 @@ static void ti_init2(struct ti_softc *sc ifp = sc->ti_ifp; /* Specify MTU and interface index. */ - CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->ti_unit); + CSR_WRITE_4(sc, TI_GCR_IFINDEX, device_get_unit(sc->ti_dev)); CSR_WRITE_4(sc, TI_GCR_IFMTU, ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN); TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0); @@ -3148,18 +3162,34 @@ static void ti_init2(struct ti_softc *sc } /* Init RX ring. */ - ti_init_rx_ring_std(sc); + if (ti_init_rx_ring_std(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, "no memory for std Rx buffers.\n"); + return; + } /* Init jumbo RX ring. */ - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) - ti_init_rx_ring_jumbo(sc); + if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) { + if (ti_init_rx_ring_jumbo(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for jumbo Rx buffers.\n"); + return; + } + } /* * If this is a Tigon 2, we can also configure the * mini ring. */ - if (sc->ti_hwrev == TI_HWREV_TIGON_II) - ti_init_rx_ring_mini(sc); + if (sc->ti_hwrev == TI_HWREV_TIGON_II) { + if (ti_init_rx_ring_mini(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for mini Rx buffers.\n"); + return; + } + } CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, 0); sc->ti_rx_saved_considx = 0; @@ -3368,11 +3398,14 @@ ti_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFMTU: TI_LOCK(sc); - if (ifr->ifr_mtu > TI_JUMBO_MTU) + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > TI_JUMBO_MTU) error = EINVAL; else { ifp->if_mtu = ifr->ifr_mtu; - ti_init_locked(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ti_init_locked(sc); + } } TI_UNLOCK(sc); break; @@ -3786,7 +3819,7 @@ ti_watchdog(void *arg) ifp = sc->ti_ifp; if_printf(ifp, "watchdog timeout -- resetting\n"); - ti_stop(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); ifp->if_oerrors++; @@ -3814,11 +3847,11 @@ ti_stop(struct ti_softc *sc) TI_DO_CMD(TI_CMD_HOST_STATE, TI_CMD_CODE_STACK_DOWN, 0); /* Halt and reinitialize. */ - if (ti_chipinit(sc) != 0) - return; - ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); - if (ti_chipinit(sc) != 0) - return; + if (ti_chipinit(sc) == 0) { + ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); + /* XXX ignore init errors. */ + ti_chipinit(sc); + } /* Free the RX lists. */ ti_free_rx_ring_std(sc); Modified: stable/8/sys/dev/ti/if_tireg.h ============================================================================== --- stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 20:48:28 2012 (r229421) +++ stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 20:50:48 2012 (r229422) @@ -1000,7 +1000,6 @@ struct ti_softc { struct resource *ti_irq; struct resource *ti_res; struct ifmedia ifmedia; /* media info */ - uint8_t ti_unit; /* interface number */ uint8_t ti_hwrev; /* Tigon rev (1 or 2) */ uint8_t ti_copper; /* 1000baseTX card */ uint8_t ti_linkstat; /* Link state */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 21:17:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4FB81065670; Tue, 3 Jan 2012 21:17:59 +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 A1E3A8FC1A; Tue, 3 Jan 2012 21:17:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03LHxdi043757; Tue, 3 Jan 2012 21:17:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03LHx7F043752; Tue, 3 Jan 2012 21:17:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032117.q03LHx7F043752@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 21:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229433 - in stable/8/sys: conf dev/ti X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 21:17:59 -0000 Author: yongari Date: Tue Jan 3 21:17:59 2012 New Revision: 229433 URL: http://svn.freebsd.org/changeset/base/229433 Log: MFC r227347,227367: r227347: Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo allocator with UMA backed jumbo allocator by default. Previously ti(4) used sf_buf(9) interface for jumbo buffers but it was broken at this moment such that enabling jumbo frame caused instant panic. Due to the nature of sf_buf(9) it heavily relies on VM changes but it seems ti(4) was not received much blessing from VM gurus. I don't understand VM magic and implications used in driver either. Switching to UMA backed jumbo allocator like other network drivers will make jumbo frame work on ti(4). While I'm here, fully allocate all RX buffers. This means ti(4) now uses 512 RX buffer and 1024 mini RX buffers. To use sf_buf(9) interface for jumbo buffers, introduce a new 'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better for jumbo buffers, interesting developers can fix the issue in future. ti(4) still needs more bus_dma(9) cleanups and should use separate DMA tag/map for each ring(standard, jumbo, mini, command, event etc) but it should work on all platforms except PAE. Special thanks to Jay[1] who provided complete remote debugging access. r227367: Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO. Modified: stable/8/sys/conf/NOTES stable/8/sys/conf/options stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/conf/NOTES Tue Jan 3 21:17:59 2012 (r229433) @@ -2072,12 +2072,12 @@ device fpa # PCI WAN adapters. device lmc -# Use "private" jumbo buffers allocated exclusively for the ti(4) driver. -# This option is incompatible with the TI_JUMBO_HDRSPLIT option below. -#options TI_PRIVATE_JUMBOS +# Use sf_buf(9) interface for jumbo buffers on ti(4) controllers. +#options TI_SF_BUF_JUMBO # Turn on the header splitting option for the ti(4) driver firmware. This # only works for Tigon II chips, and has no effect for Tigon I chips. -options TI_JUMBO_HDRSPLIT +# This option requires the TI_SF_BUF_JUMBO option above. +#options TI_JUMBO_HDRSPLIT # # Use header splitting feature on bce(4) adapters. Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/conf/options Tue Jan 3 21:17:59 2012 (r229433) @@ -515,7 +515,7 @@ NGATM_CCATM opt_netgraph.h DRM_DEBUG opt_drm.h ZERO_COPY_SOCKETS opt_zero.h -TI_PRIVATE_JUMBOS opt_ti.h +TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h BCE_JUMBO_HDRSPLIT opt_bce.h Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 21:17:59 2012 (r229433) @@ -112,8 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include -/* #define TI_PRIVATE_JUMBOS */ -#ifndef TI_PRIVATE_JUMBOS +#ifdef TI_SF_BUF_JUMBO #include #include #endif @@ -131,9 +130,9 @@ __FBSDID("$FreeBSD$"); * We can only turn on header splitting if we're using extended receive * BDs. */ -#if defined(TI_JUMBO_HDRSPLIT) && defined(TI_PRIVATE_JUMBOS) -#error "options TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS are mutually exclusive" -#endif /* TI_JUMBO_HDRSPLIT && TI_JUMBO_HDRSPLIT */ +#if defined(TI_JUMBO_HDRSPLIT) && !defined(TI_SF_BUF_JUMBO) +#error "options TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO" +#endif /* TI_JUMBO_HDRSPLIT && !TI_SF_BUF_JUMBO */ typedef enum { TI_SWAP_HTON, @@ -222,12 +221,8 @@ static void ti_handle_events(struct ti_s static int ti_alloc_dmamaps(struct ti_softc *); static void ti_free_dmamaps(struct ti_softc *); static int ti_alloc_jumbo_mem(struct ti_softc *); -#ifdef TI_PRIVATE_JUMBOS -static void *ti_jalloc(struct ti_softc *); -static void ti_jfree(void *, void *); -#endif /* TI_PRIVATE_JUMBOS */ -static int ti_newbuf_std(struct ti_softc *, int, struct mbuf *); -static int ti_newbuf_mini(struct ti_softc *, int, struct mbuf *); +static int ti_newbuf_std(struct ti_softc *, int); +static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); static int ti_init_rx_ring_std(struct ti_softc *); static void ti_free_rx_ring_std(struct ti_softc *); @@ -237,6 +232,11 @@ static int ti_init_rx_ring_mini(struct t static void ti_free_rx_ring_mini(struct ti_softc *); static void ti_free_tx_ring(struct ti_softc *); static int ti_init_tx_ring(struct ti_softc *); +static void ti_discard_std(struct ti_softc *, int); +#ifndef TI_SF_BUF_JUMBO +static void ti_discard_jumbo(struct ti_softc *, int); +#endif +static void ti_discard_mini(struct ti_softc *, int); static int ti_64bitslot_war(struct ti_softc *); static int ti_chipinit(struct ti_softc *); @@ -982,21 +982,42 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_TX_RING_CNT; i++) { sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) + &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for TX\n"); return (ENOBUFS); + } } for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) + &sc->ti_cdata.ti_rx_std_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_std_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for RX\n"); + return (ENOBUFS); } for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) + &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for jumbo RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for jumbo RX\n"); + return (ENOBUFS); } /* Mini ring is not available on Tigon 1. */ @@ -1005,8 +1026,17 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) + &sc->ti_cdata.ti_rx_mini_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_mini_sparemap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); + return (ENOBUFS); } return (0); @@ -1017,173 +1047,77 @@ ti_free_dmamaps(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) - for (i = 0; i < TI_TX_RING_CNT; i++) + if (sc->ti_mbuftx_dmat) { + for (i = 0; i < TI_TX_RING_CNT; i++) { if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { bus_dmamap_destroy(sc->ti_mbuftx_dmat, sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; } + } + } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_STD_RX_RING_CNT; i++) + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = 0; + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + } - if (sc->ti_jumbo_dmat) - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) + if (sc->ti_jumbo_dmat) { + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { bus_dmamap_destroy(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = 0; + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) + } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + } + + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = 0; + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; + } + } } -#ifdef TI_PRIVATE_JUMBOS - -/* - * Memory management for the jumbo receive ring is a pain in the - * butt. We need to allocate at least 9018 bytes of space per frame, - * _and_ it has to be contiguous (unless you use the extended - * jumbo descriptor format). Using malloc() all the time won't - * work: malloc() allocates memory in powers of two, which means we - * would end up wasting a considerable amount of space by allocating - * 9K chunks. We don't have a jumbo mbuf cluster pool. Thus, we have - * to do our own memory management. - * - * The driver needs to allocate a contiguous chunk of memory at boot - * time. We then chop this up ourselves into 9K pieces and use them - * as external mbuf storage. - * - * One issue here is how much memory to allocate. The jumbo ring has - * 256 slots in it, but at 9K per slot than can consume over 2MB of - * RAM. This is a bit much, especially considering we also need - * RAM for the standard ring and mini ring (on the Tigon 2). To - * save space, we only actually allocate enough memory for 64 slots - * by default, which works out to between 500 and 600K. This can - * be tuned by changing a #define in if_tireg.h. - */ +#ifndef TI_SF_BUF_JUMBO static int ti_alloc_jumbo_mem(struct ti_softc *sc) { - struct ti_jpool_entry *entry; - caddr_t ptr; - int i; - /* - * Grab a big chunk o' storage. Since we are chopping this pool up - * into ~9k chunks, there doesn't appear to be a need to use page - * alignment. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - TI_JMEM, /* maxsize */ - 1, /* nsegments */ - TI_JMEM, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { + if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, + NULL, &sc->ti_jumbo_dmat) != 0) { device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + return (ENOBUFS); } - - if (bus_dmamem_alloc(sc->ti_jumbo_dmat, - (void**)&sc->ti_cdata.ti_jumbo_buf, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &sc->ti_jumbo_dmamap) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); - return (ENOBUFS); - } - - SLIST_INIT(&sc->ti_jfree_listhead); - SLIST_INIT(&sc->ti_jinuse_listhead); - - /* - * Now divide it up into 9K pieces and save the addresses - * in an array. - */ - ptr = sc->ti_cdata.ti_jumbo_buf; - for (i = 0; i < TI_JSLOTS; i++) { - sc->ti_cdata.ti_jslots[i] = ptr; - ptr += TI_JLEN; - entry = malloc(sizeof(struct ti_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - device_printf(sc->ti_dev, "no memory for jumbo " - "buffer queue!\n"); - return (ENOBUFS); - } - entry->slot = i; - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); - } - return (0); } -/* - * Allocate a jumbo buffer. - */ -static void *ti_jalloc(struct ti_softc *sc) -{ - struct ti_jpool_entry *entry; - - entry = SLIST_FIRST(&sc->ti_jfree_listhead); - - if (entry == NULL) { - device_printf(sc->ti_dev, "no free jumbo buffers\n"); - return (NULL); - } - - SLIST_REMOVE_HEAD(&sc->ti_jfree_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jinuse_listhead, entry, jpool_entries); - return (sc->ti_cdata.ti_jslots[entry->slot]); -} - -/* - * Release a jumbo buffer. - */ -static void -ti_jfree(void *buf, void *args) -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; - - /* Extract the softc struct pointer. */ - sc = (struct ti_softc *)args; - - if (sc == NULL) - panic("ti_jfree: didn't get softc pointer!"); - - /* calculate the slot this buffer belongs to */ - i = ((vm_offset_t)buf - - (vm_offset_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN; - - if ((i < 0) || (i >= TI_JSLOTS)) - panic("ti_jfree: asked to free buffer that we don't manage!"); - - entry = SLIST_FIRST(&sc->ti_jinuse_listhead); - if (entry == NULL) - panic("ti_jfree: buffer not in use!"); - entry->slot = i; - SLIST_REMOVE_HEAD(&sc->ti_jinuse_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); -} - #else static int @@ -1212,56 +1146,59 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) return (0); } -#endif /* TI_PRIVATE_JUMBOS */ +#endif /* TI_SF_BUF_JUMBO */ /* * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_std(struct ti_softc *sc, int i) { bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) - return (ENOBUFS); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, ETHER_ALIGN); - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - m_freem(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - } else { - m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_new->m_data = m_new->m_ext.ext_buf; + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - sc->ti_cdata.ti_rx_std_chain[i] = m_new; - r = &sc->ti_rdata->ti_rx_std_ring[i]; map = sc->ti_cdata.ti_rx_std_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_std_maps[i] = sc->ti_cdata.ti_rx_std_sparemap; + sc->ti_cdata.ti_rx_std_sparemap = map; + sc->ti_cdata.ti_rx_std_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1270,111 +1207,112 @@ ti_newbuf_std(struct ti_softc *sc, int i * the Tigon 2. */ static int -ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_mini(struct ti_softc *sc, int i) { - bus_dma_segment_t segs; bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MHLEN; - } else { - m_new = m; - m_new->m_data = m_new->m_pktdat; - m_new->m_len = m_new->m_pkthdr.len = MHLEN; + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MHLEN; + m_adj(m, ETHER_ALIGN); + + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - r = &sc->ti_rdata->ti_rx_mini_ring[i]; - sc->ti_cdata.ti_rx_mini_chain[i] = m_new; map = sc->ti_cdata.ti_rx_mini_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_mini_maps[i] = sc->ti_cdata.ti_rx_mini_sparemap; + sc->ti_cdata.ti_rx_mini_sparemap = map; + sc->ti_cdata.ti_rx_mini_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], + BUS_DMASYNC_PREREAD); return (0); } -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *dummy) { bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; + int error, nsegs; - if (m == NULL) { - caddr_t *buf = NULL; + (void)dummy; - /* Allocate the mbuf. */ - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MJUM9BYTES; + m_adj(m, ETHER_ALIGN); - /* Allocate the jumbo buffer */ - buf = ti_jalloc(sc); - if (buf == NULL) { - m_freem(m_new); - device_printf(sc->ti_dev, "jumbo allocation failed " - "-- packet dropped!\n"); - return (ENOBUFS); - } + error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - /* Attach the buffer to the mbuf. */ - m_new->m_data = (void *) buf; - m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, - (struct ti_softc *)sc, 0, EXT_NET_DRV); - } else { - m_new = m; - m_new->m_data = m_new->m_ext.ext_buf; - m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN; + if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; - sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_jumbo_maps[i] = sc->ti_cdata.ti_rx_jumbo_sparemap; + sc->ti_cdata.ti_rx_jumbo_sparemap = map; + sc->ti_cdata.ti_rx_jumbo_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1555,13 +1493,13 @@ ti_init_rx_ring_std(struct ti_softc *sc) int i; struct ti_cmd_desc cmd; - for (i = 0; i < TI_SSLOTS; i++) { - if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (ti_newbuf_std(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_STDPROD(sc, i - 1); - sc->ti_std = i - 1; + sc->ti_std = TI_STD_RX_RING_CNT - 1; + TI_UPDATE_STDPROD(sc, TI_STD_RX_RING_CNT - 1); return (0); } @@ -1593,12 +1531,12 @@ ti_init_rx_ring_jumbo(struct ti_softc *s int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) + if (ti_newbuf_jumbo(sc, i, NULL) != 0) return (ENOBUFS); }; - TI_UPDATE_JUMBOPROD(sc, i - 1); - sc->ti_jumbo = i - 1; + sc->ti_jumbo = TI_JUMBO_RX_RING_CNT - 1; + TI_UPDATE_JUMBOPROD(sc, TI_JUMBO_RX_RING_CNT - 1); return (0); } @@ -1628,13 +1566,13 @@ ti_init_rx_ring_mini(struct ti_softc *sc { int i; - for (i = 0; i < TI_MSLOTS; i++) { - if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (ti_newbuf_mini(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_MINIPROD(sc, i - 1); - sc->ti_mini = i - 1; + sc->ti_mini = TI_MINI_RX_RING_CNT - 1; + TI_UPDATE_MINIPROD(sc, TI_MINI_RX_RING_CNT - 1); return (0); } @@ -2082,8 +2020,8 @@ ti_gibinit(struct ti_softc *sc) rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); -#ifdef TI_PRIVATE_JUMBOS - rcb->ti_max_len = TI_JUMBO_FRAMELEN; +#ifndef TI_SF_BUF_JUMBO + rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; rcb->ti_flags = 0; #else rcb->ti_max_len = PAGE_SIZE; @@ -2396,7 +2334,6 @@ ti_attach(device_t dev) } if (ti_alloc_dmamaps(sc)) { - device_printf(dev, "dma map creation failed\n"); error = ENXIO; goto fail; } @@ -2544,11 +2481,6 @@ ti_detach(device_t dev) ti_free_dmamaps(sc); ifmedia_removeall(&sc->ifmedia); -#ifdef TI_PRIVATE_JUMBOS - if (sc->ti_cdata.ti_jumbo_buf) - bus_dmamem_free(sc->ti_jumbo_dmat, sc->ti_cdata.ti_jumbo_buf, - sc->ti_jumbo_dmamap); -#endif if (sc->ti_jumbo_dmat) bus_dma_tag_destroy(sc->ti_jumbo_dmat); if (sc->ti_mbuftx_dmat) @@ -2637,6 +2569,59 @@ ti_hdr_split(struct mbuf *top, int hdr_l } #endif /* TI_JUMBO_HDRSPLIT */ +static void +ti_discard_std(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + r->ti_len = MCLBYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +static void +ti_discard_mini(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MHLEN - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +#ifndef TI_SF_BUF_JUMBO +static void +ti_discard_jumbo(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MJUM9BYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; + r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} +#endif + /* * Frame reception handling. This is called if there's a frame * on the receive return list. @@ -2652,9 +2637,11 @@ static void ti_rxeof(struct ti_softc *sc) { struct ifnet *ifp; +#ifdef TI_SF_BUF_JUMBO bus_dmamap_t map; +#endif struct ti_cmd_desc cmd; - int jumbocnt, minicnt, stdcnt; + int jumbocnt, minicnt, stdcnt, ti_len; TI_LOCK_ASSERT(sc); @@ -2671,6 +2658,7 @@ ti_rxeof(struct ti_softc *sc) cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; rxidx = cur_rx->ti_idx; + ti_len = cur_rx->ti_len; TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT); if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { @@ -2682,6 +2670,19 @@ ti_rxeof(struct ti_softc *sc) jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; +#ifndef TI_SF_BUF_JUMBO + if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { + ifp->if_ierrors++; + ti_discard_jumbo(sc, rxidx); + continue; + } + if (ti_newbuf_jumbo(sc, rxidx, NULL) != 0) { + ifp->if_iqdrops++; + ti_discard_jumbo(sc, rxidx); + continue; + } + m->m_len = ti_len; +#else /* !TI_SF_BUF_JUMBO */ sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; map = sc->ti_cdata.ti_rx_jumbo_maps[rxidx]; bus_dmamap_sync(sc->ti_jumbo_dmat, map, @@ -2693,64 +2694,51 @@ ti_rxeof(struct ti_softc *sc) continue; } if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) { - ifp->if_ierrors++; + ifp->if_iqdrops++; ti_newbuf_jumbo(sc, sc->ti_jumbo, m); continue; } -#ifdef TI_PRIVATE_JUMBOS - m->m_len = cur_rx->ti_len; -#else /* TI_PRIVATE_JUMBOS */ #ifdef TI_JUMBO_HDRSPLIT if (sc->ti_hdrsplit) ti_hdr_split(m, TI_HOSTADDR(cur_rx->ti_addr), - cur_rx->ti_len, rxidx); + ti_len, rxidx); else #endif /* TI_JUMBO_HDRSPLIT */ - m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); -#endif /* TI_PRIVATE_JUMBOS */ + m_adj(m, ti_len - m->m_pkthdr.len); +#endif /* TI_SF_BUF_JUMBO */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; - sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_mini_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + ti_discard_mini(sc, rxidx); continue; } - if (ti_newbuf_mini(sc, sc->ti_mini, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + if (ti_newbuf_mini(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_mini(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } else { stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; - sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_std_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + ti_discard_std(sc, rxidx); continue; } - if (ti_newbuf_std(sc, sc->ti_std, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + if (ti_newbuf_std(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_std(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } - m->m_pkthdr.len = cur_rx->ti_len; + m->m_pkthdr.len = ti_len; ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; Modified: stable/8/sys/dev/ti/if_tireg.h ============================================================================== --- stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 21:17:59 2012 (r229433) @@ -887,23 +887,6 @@ struct ti_event_desc { #define TI_CLRBIT(sc, reg, x) \ CSR_WRITE_4((sc), (reg), (CSR_READ_4((sc), (reg)) & ~(x))) -/* - * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS - * values are tuneable. They control the actual amount of buffers - * allocated for the standard, mini and jumbo receive rings. - */ - -#define TI_SSLOTS 256 -#define TI_MSLOTS 256 -#define TI_JSLOTS 256 - -#define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN) -#define TI_JLEN (TI_JRAWLEN + (sizeof(uint64_t) - \ - (TI_JRAWLEN % sizeof(uint64_t)))) -#define TI_JPAGESZ PAGE_SIZE -#define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ) -#define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID) - struct ti_txdesc { struct mbuf *tx_m; bus_dmamap_t tx_dmamap; @@ -920,7 +903,7 @@ STAILQ_HEAD(ti_txdq, ti_txdesc); */ struct ti_ring_data { struct ti_rx_desc ti_rx_std_ring[TI_STD_RX_RING_CNT]; -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO struct ti_rx_desc ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; #else struct ti_rx_desc_ext ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; @@ -955,13 +938,13 @@ struct ti_chain_data { struct ti_txdq ti_txbusyq; struct mbuf *ti_rx_std_chain[TI_STD_RX_RING_CNT]; bus_dmamap_t ti_rx_std_maps[TI_STD_RX_RING_CNT]; + bus_dmamap_t ti_rx_std_sparemap; struct mbuf *ti_rx_jumbo_chain[TI_JUMBO_RX_RING_CNT]; bus_dmamap_t ti_rx_jumbo_maps[TI_JUMBO_RX_RING_CNT]; + bus_dmamap_t ti_rx_jumbo_sparemap; struct mbuf *ti_rx_mini_chain[TI_MINI_RX_RING_CNT]; bus_dmamap_t ti_rx_mini_maps[TI_MINI_RX_RING_CNT]; - /* Stick the jumbo mem management stuff here too. */ - caddr_t ti_jslots[TI_JSLOTS]; - void *ti_jumbo_buf; + bus_dmamap_t ti_rx_mini_sparemap; }; struct ti_type { @@ -980,11 +963,6 @@ struct ti_mc_entry { SLIST_ENTRY(ti_mc_entry) mc_entries; }; -struct ti_jpool_entry { - int slot; - SLIST_ENTRY(ti_jpool_entry) jpool_entries; -}; - typedef enum { TI_FLAG_NONE = 0x00, TI_FLAG_DEBUGING = 0x01, @@ -1006,7 +984,6 @@ struct ti_softc { int ti_hdrsplit; /* enable header splitting */ bus_dma_tag_t ti_parent_dmat; bus_dma_tag_t ti_jumbo_dmat; - bus_dmamap_t ti_jumbo_dmamap; bus_dma_tag_t ti_mbuftx_dmat; bus_dma_tag_t ti_mbufrx_dmat; bus_dma_tag_t ti_rdata_dmat; @@ -1026,8 +1003,6 @@ struct ti_softc { int ti_mini; /* current mini ring head */ int ti_jumbo; /* current jumo ring head */ SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead; - SLIST_HEAD(__ti_jfreehead, ti_jpool_entry) ti_jfree_listhead; - SLIST_HEAD(__ti_jinusehead, ti_jpool_entry) ti_jinuse_listhead; uint32_t ti_stat_ticks; uint32_t ti_rx_coal_ticks; uint32_t ti_tx_coal_ticks; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 23:38:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1ECBB1065677; Tue, 3 Jan 2012 23:38:17 +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 060488FC1C; Tue, 3 Jan 2012 23:38:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03NcHUU048796; Tue, 3 Jan 2012 23:38:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03NcGKC048793; Tue, 3 Jan 2012 23:38:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032338.q03NcGKC048793@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229439 - in stable/8/sys: conf dev/ti X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 23:38:17 -0000 Author: yongari Date: Tue Jan 3 23:38:16 2012 New Revision: 229439 URL: http://svn.freebsd.org/changeset/base/229439 Log: MFC r227431-227432,227505,227509: r227431: style. No functional changes. r227432: Remove dead ifdef. Driver should always check raised interrupt is for the device. r227505: It's bad idea to allocate large memory, 4KB, from stack. Pre-allocate the memory in device attach time. While I'm here remove unnecessary reassignment of error variable as it was already initialized. Also added a missing driver lock in TIIOCSETTRACE handler. r227509: Export sysctl node for various interrupt moderation parameters and have administrators control them. ti(4) provides a character device to control various other features of driver via ioctls but users had to write their own code to manipulate these parameters. It seems some default values for these parameters are not optimal on today's system but leave it as it was and let administrators change them. The following parameters could be changed: dev.ti.%d.rx_coal_ticks dev.ti.%d.rx_max_coal_bds dev.ti.%d.tx_coal_ticks dev.ti.%d.tx_max_coal_bds dev.ti.%d.tx_buf_ratio dev.ti.%d.stat_ticks The interface has to be brought down and up again before a change takes effect. ti(4) controller supports hardware MAC counters with additional DMA statistics. So it's doable to export these counters via sysctl interface. Unfortunately, these counters are cumulative such that driver have to either send an explicit clear command to controller after extracting them or have to maintain internal counters to get actual changes. Neither look good to me so counters were not exported via sysctl. Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:36:29 2012 (r229438) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:38:16 2012 (r229439) @@ -125,6 +125,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define TI_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_IP_FRAGS) /* * We can only turn on header splitting if we're using extended receive @@ -247,6 +249,8 @@ static __inline void ti_hdr_split(struct int idx); #endif /* TI_JUMBO_HDRSPLIT */ +static void ti_sysctl_node(struct ti_softc *); + static device_method_t ti_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ti_probe), @@ -497,7 +501,6 @@ ti_copy_mem(struct ti_softc *sc, uint32_ int segptr, segsize, cnt; caddr_t ptr; uint32_t origwin; - uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; int resid, segresid; int first_pass; @@ -507,8 +510,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * At the moment, we don't handle non-aligned cases, we just bail. * If this proves to be a problem, it will be fixed. */ - if ((readdata == 0) - && (tigon_addr & 0x3)) { + if (readdata == 0 && (tigon_addr & 0x3) != 0) { device_printf(sc->ti_dev, "%s: tigon address %#x isn't " "word-aligned\n", __func__, tigon_addr); device_printf(sc->ti_dev, "%s: unaligned writes aren't " @@ -557,58 +559,54 @@ ti_copy_mem(struct ti_softc *sc, uint32_ ti_offset = TI_WINDOW + (segptr & (TI_WINLEN -1)); if (readdata) { - - bus_space_read_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); if (useraddr) { /* * Yeah, this is a little on the kludgy * side, but at least this code is only * used for debugging. */ - ti_bcopy_swap(tmparray, tmparray2, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, sc->ti_membuf2, + segsize, TI_SWAP_NTOH); TI_UNLOCK(sc); if (first_pass) { - copyout(&tmparray2[segresid], ptr, - segsize - segresid); + copyout(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); first_pass = 0; } else - copyout(tmparray2, ptr, segsize); + copyout(sc->ti_membuf2, ptr, segsize); TI_LOCK(sc); } else { if (first_pass) { - ti_bcopy_swap(tmparray, tmparray2, - segsize, TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, + sc->ti_membuf2, segsize, + TI_SWAP_NTOH); TI_UNLOCK(sc); - bcopy(&tmparray2[segresid], ptr, - segsize - segresid); + bcopy(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); TI_LOCK(sc); first_pass = 0; } else - ti_bcopy_swap(tmparray, ptr, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, ptr, + segsize, TI_SWAP_NTOH); } } else { if (useraddr) { TI_UNLOCK(sc); - copyin(ptr, tmparray2, segsize); + copyin(ptr, sc->ti_membuf2, segsize); TI_LOCK(sc); - ti_bcopy_swap(tmparray2, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(sc->ti_membuf2, sc->ti_membuf, + segsize, TI_SWAP_HTON); } else - ti_bcopy_swap(ptr, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(ptr, sc->ti_membuf, segsize, + TI_SWAP_HTON); - bus_space_write_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); } segptr += segsize; ptr += segsize; @@ -619,8 +617,8 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - uint32_t tmpval, tmpval2; - bus_size_t ti_offset; + uint32_t tmpval, tmpval2; + bus_size_t ti_offset; /* * Set the segment pointer. @@ -635,7 +633,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * writes, since we'll be doing read/modify/write. */ bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); /* * Next, translate this from little-endian to big-endian @@ -677,7 +675,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ tmpval = htonl(tmpval2); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); } } @@ -788,8 +786,7 @@ ti_bcopy_swap(const void *src, void *dst size_t tmplen; if (len & 0x3) { - printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", - len); + printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", len); return (-1); } @@ -799,12 +796,9 @@ ti_bcopy_swap(const void *src, void *dst while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(uint32_t *)tmpdst = - ntohl(*(const uint32_t *)tmpsrc); + *(uint32_t *)tmpdst = ntohl(*(const uint32_t *)tmpsrc); else - *(uint32_t *)tmpdst = - htonl(*(const uint32_t *)tmpsrc); - + *(uint32_t *)tmpdst = htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; tmplen -= 4; @@ -1770,7 +1764,8 @@ ti_setmulti(struct ti_softc *sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(struct ti_softc *sc) +static int +ti_64bitslot_war(struct ti_softc *sc) { if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { @@ -2094,7 +2089,7 @@ ti_gibinit(struct ti_softc *sc) bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); - /* Set up tuneables */ + /* Set up tunables */ #if 0 if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, @@ -2243,6 +2238,16 @@ ti_attach(device_t dev) goto fail; } + /* Allocate working area for memory dump. */ + sc->ti_membuf = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, M_NOWAIT); + sc->ti_membuf2 = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, + M_NOWAIT); + if (sc->ti_membuf == NULL || sc->ti_membuf2 == NULL) { + device_printf(dev, "cannot allocate memory buffer\n"); + error = ENOMEM; + goto fail; + } + /* Allocate the general information block and ring buffers. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* algnmnt, boundary */ @@ -2353,19 +2358,8 @@ ti_attach(device_t dev) pci_get_device(dev) == NG_DEVICEID_GA620T) sc->ti_copper = 1; - /* Set default tuneable values. */ - sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; -#if 0 - sc->ti_rx_coal_ticks = TI_TICKS_PER_SEC / 5000; -#endif - sc->ti_rx_coal_ticks = 170; - sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; - sc->ti_rx_max_coal_bds = 64; -#if 0 - sc->ti_tx_max_coal_bds = 128; -#endif - sc->ti_tx_max_coal_bds = 32; - sc->ti_tx_buf_ratio = 21; + /* Set default tunable values. */ + ti_sysctl_node(sc); /* Set up ifnet structure */ ifp->if_softc = sc; @@ -2506,6 +2500,10 @@ ti_detach(device_t dev) } if (ifp) if_free(ifp); + if (sc->ti_membuf) + free(sc->ti_membuf, M_DEVBUF); + if (sc->ti_membuf2) + free(sc->ti_membuf2, M_DEVBUF); mtx_destroy(&sc->ti_mtx); @@ -2837,14 +2835,11 @@ ti_intr(void *xsc) TI_LOCK(sc); ifp = sc->ti_ifp; -/*#ifdef notdef*/ - /* Avoid this for now -- checking this register is expensive. */ /* Make sure this is really our interrupt. */ if (!(CSR_READ_4(sc, TI_MISC_HOST_CTL) & TI_MHC_INTSTATE)) { TI_UNLOCK(sc); return; } -/*#endif*/ /* Ack interrupt and stop others from occuring. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); @@ -3534,7 +3529,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); bcopy(&sc->ti_rdata->ti_info.ti_stats, outstats, - sizeof(struct ti_stats)); + sizeof(struct ti_stats)); TI_UNLOCK(sc); break; } @@ -3553,9 +3548,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, params->ti_tx_buf_ratio = sc->ti_tx_buf_ratio; params->param_mask = TI_PARAM_ALL; TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETPARAMS: @@ -3600,13 +3592,10 @@ ti_ioctl2(struct cdev *dev, u_long cmd, sc->ti_tx_buf_ratio); } TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETTRACE: { - ti_trace_type trace_type; + ti_trace_type trace_type; trace_type = *(ti_trace_type *)addr; @@ -3615,10 +3604,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * this register to 0 should have the effect of disabling * tracing. */ + TI_LOCK(sc); CSR_WRITE_4(sc, TI_GCR_NIC_TRACING, trace_type); - - error = 0; - + TI_UNLOCK(sc); break; } case TIIOCGETTRACE: { @@ -3631,7 +3619,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, trace_start = CSR_READ_4(sc, TI_GCR_NICTRACE_START); cur_trace_ptr = CSR_READ_4(sc, TI_GCR_NICTRACE_PTR); trace_len = CSR_READ_4(sc, TI_GCR_NICTRACE_LEN); - #if 0 if_printf(sc->ti_ifp, "trace_start = %#x, cur_trace_ptr = %#x, " "trace_len = %d\n", trace_start, @@ -3639,24 +3626,20 @@ ti_ioctl2(struct cdev *dev, u_long cmd, if_printf(sc->ti_ifp, "trace_buf->buf_len = %d\n", trace_buf->buf_len); #endif - error = ti_copy_mem(sc, trace_start, min(trace_len, - trace_buf->buf_len), - (caddr_t)trace_buf->buf, 1, 1); - + trace_buf->buf_len), (caddr_t)trace_buf->buf, 1, 1); if (error == 0) { trace_buf->fill_len = min(trace_len, - trace_buf->buf_len); + trace_buf->buf_len); if (cur_trace_ptr < trace_start) trace_buf->cur_trace_ptr = - trace_start - cur_trace_ptr; + trace_start - cur_trace_ptr; else trace_buf->cur_trace_ptr = - cur_trace_ptr - trace_start; + cur_trace_ptr - trace_start; } else trace_buf->fill_len = 0; TI_UNLOCK(sc); - break; } @@ -3678,7 +3661,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * you're interested in every ioctl, you'll only be * able to debug one board at a time. */ - error = 0; break; case ALT_READ_TG_MEM: case ALT_WRITE_TG_MEM: @@ -3701,25 +3683,22 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * nothing else. */ TI_LOCK(sc); - if ((mem_param->tgAddr >= TI_BEG_SRAM) - && ((mem_param->tgAddr + mem_param->len) <= sram_end)) { + if (mem_param->tgAddr >= TI_BEG_SRAM && + mem_param->tgAddr + mem_param->len <= sram_end) { /* * In this instance, we always copy to/from user * space, so the user space argument is set to 1. */ error = ti_copy_mem(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? 1 : 0); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH) - && (mem_param->tgAddr <= scratch_end)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH && + mem_param->tgAddr <= scratch_end) { error = ti_copy_scratch(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_A); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG) - && (mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_A); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG && + mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG) { if (sc->ti_hwrev == TI_HWREV_TIGON) { if_printf(sc->ti_ifp, "invalid memory range for Tigon I\n"); @@ -3727,11 +3706,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, break; } error = ti_copy_scratch(sc, mem_param->tgAddr - - TI_SCRATCH_DEBUG_OFF, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_B); + TI_SCRATCH_DEBUG_OFF, mem_param->len, + mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_B); } else { if_printf(sc->ti_ifp, "memory address %#x len %d is " "out of supported range\n", @@ -3739,14 +3716,13 @@ ti_ioctl2(struct cdev *dev, u_long cmd, error = EINVAL; } TI_UNLOCK(sc); - break; } case ALT_READ_TG_REG: case ALT_WRITE_TG_REG: { - struct tg_reg *regs; - uint32_t tmpval; + struct tg_reg *regs; + uint32_t tmpval; regs = (struct tg_reg *)addr; @@ -3760,7 +3736,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); if (cmd == ALT_READ_TG_REG) { bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); regs->data = ntohl(tmpval); #if 0 if ((regs->addr == TI_CPU_STATE) @@ -3772,10 +3748,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, } else { tmpval = htonl(regs->data); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); } TI_UNLOCK(sc); - break; } default: @@ -3878,3 +3853,58 @@ ti_shutdown(device_t dev) return (0); } + +static void +ti_sysctl_node(struct ti_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + + ctx = device_get_sysctl_ctx(sc->ti_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ti_dev)); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_coal_ticks", CTLFLAG_RW, + &sc->ti_rx_coal_ticks, 0, "Receive coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_max_coal_bds", CTLFLAG_RW, + &sc->ti_rx_max_coal_bds, 0, "Receive max coalcesced BDs"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_coal_ticks", CTLFLAG_RW, + &sc->ti_tx_coal_ticks, 0, "Send coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_max_coal_bds", CTLFLAG_RW, + &sc->ti_tx_max_coal_bds, 0, "Send max coalcesced BDs"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_buf_ratio", CTLFLAG_RW, + &sc->ti_tx_buf_ratio, 0, + "Ratio of NIC memory devoted to TX buffer"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "stat_ticks", CTLFLAG_RW, + &sc->ti_stat_ticks, 0, + "Number of clock ticks for statistics update interval"); + + /* Pull in device tunables. */ + sc->ti_rx_coal_ticks = 170; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_coal_ticks", + &sc->ti_rx_coal_ticks); + sc->ti_rx_max_coal_bds = 64; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_max_coal_bds", + &sc->ti_rx_max_coal_bds); + + sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_coal_ticks", + &sc->ti_tx_coal_ticks); + sc->ti_tx_max_coal_bds = 32; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_max_coal_bds", + &sc->ti_tx_max_coal_bds); + sc->ti_tx_buf_ratio = 21; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_buf_ratio", + &sc->ti_tx_buf_ratio); + + sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "stat_ticks", + &sc->ti_stat_ticks); +} Modified: stable/8/sys/dev/ti/if_tireg.h ============================================================================== --- stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 23:36:29 2012 (r229438) +++ stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 23:38:16 2012 (r229439) @@ -1015,6 +1015,8 @@ struct ti_softc { struct callout ti_watchdog; int ti_timer; ti_flag_vals ti_flags; + uint8_t *ti_membuf; + uint8_t *ti_membuf2; struct cdev *dev; }; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 23:45:45 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C29201065672; Tue, 3 Jan 2012 23:45:44 +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 AA6BD8FC1C; Tue, 3 Jan 2012 23:45:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03NjiOI049245; Tue, 3 Jan 2012 23:45:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Njir7049242; Tue, 3 Jan 2012 23:45:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032345.q03Njir7049242@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229442 - in stable/8/sys: conf dev/ti X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 23:45:46 -0000 Author: yongari Date: Tue Jan 3 23:45:44 2012 New Revision: 229442 URL: http://svn.freebsd.org/changeset/base/229442 Log: MFC r227512: Overhaul bus_dma(9) usage in driver: - Don't use a single big DMA block for all rings. Create separate DMA area for each ring instead. Currently the following DMA areas are created: Event ring, standard RX ring, jumbo RX ring, RX return ring, hardware MAC statistics and producer/consumer status area. For Tigon II, mini RX ring and TX ring are additionally created. - Added missing bus_dmamap_sync(9) in various TX/RX paths. - TX ring is no longer created for Tigon 1 such that it saves more resources on Tigon 1. - Data sheet is not clear about alignment requirement of each ring so use 32 bytes alignment for normal DMA area but use 64 bytes alignment for jumbo RX ring where the extended RX descriptor size is 64 bytes. - For each TX/RX buffers use separate DMA tag(e.g. the size of a DMA segment, total size of DMA segments etc). - Tigon allows separate DMA area for event producer, RX return producer and TX consumer which is really cool feature. This means TX and RX path could be independently run in parallel. However ti(4) uses a single driver lock so it's meaningless to have separate DMA area for these producer/consumer such that this change creates a single status DMA area. - It seems Tigon has no limits on DMA address space and I also don't see any problem with that but old comments in driver indicates there could be issues on descriptors being located in 64bit region. Introduce a tunable, dev.ti.%d.dac, to disable using 64bit DMA in driver. The default is 0 which means it would use full 64bit DMA. If there are DMA issues, users can disable it by setting the tunable to 0. - Do not increase watchdog timer in ti_txeof(). Previously driver increased the watchdog timer whenever there are queued TX frames. - When stat ticks is set to 0, skip processing ti_stats_update(), avoiding bus_dmamap_sync(9) and updating if_collisions counter. - MTU does not include FCS bytes, replace it with ETHER_VLAN_ENCAP_LEN. With these changes, ti(4) should work on PAE environments. Many thanks to Jay Borkenhagen for remote hardware access. Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:44:05 2012 (r229441) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:45:44 2012 (r229442) @@ -220,9 +220,13 @@ static void ti_loadfw(struct ti_softc *) static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); static void ti_cmd_ext(struct ti_softc *, struct ti_cmd_desc *, caddr_t, int); static void ti_handle_events(struct ti_softc *); -static int ti_alloc_dmamaps(struct ti_softc *); -static void ti_free_dmamaps(struct ti_softc *); -static int ti_alloc_jumbo_mem(struct ti_softc *); +static void ti_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int ti_dma_alloc(struct ti_softc *); +static void ti_dma_free(struct ti_softc *); +static int ti_dma_ring_alloc(struct ti_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); +static void ti_dma_ring_free(struct ti_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); static int ti_newbuf_std(struct ti_softc *, int); static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); @@ -911,11 +915,13 @@ ti_handle_events(struct ti_softc *sc) { struct ti_event_desc *e; - if (sc->ti_rdata->ti_event_ring == NULL) + if (sc->ti_rdata.ti_event_ring == NULL) return; + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_POSTREAD); while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { - e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; + e = &sc->ti_rdata.ti_event_ring[sc->ti_ev_saved_considx]; switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); @@ -967,181 +973,402 @@ ti_handle_events(struct ti_softc *sc) TI_INC(sc->ti_ev_saved_considx, TI_EVENT_RING_CNT); CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, sc->ti_ev_saved_considx); } + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_PREREAD); +} + +struct ti_dmamap_arg { + bus_addr_t ti_busaddr; +}; + +static void +ti_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct ti_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->ti_busaddr = segs->ds_addr; } static int -ti_alloc_dmamaps(struct ti_softc *sc) +ti_dma_ring_alloc(struct ti_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - int i; + struct ti_dmamap_arg ctx; + int error; - for (i = 0; i < TI_TX_RING_CNT; i++) { - sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { - device_printf(sc->ti_dev, - "cannot create DMA map for TX\n"); - return (ENOBUFS); - } + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, + alignment, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not create %s dma tag\n", msg); + return (error); + } + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (error); } + /* Load the address of the ring. */ + ctx.ti_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, ti_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->ti_dev, + "could not load DMA'able memory for %s\n", msg); + return (error); + } + *paddr = ctx.ti_busaddr; + return (0); +} + +static void +ti_dma_ring_free(struct ti_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ + + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; + } + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; + } +} + +static int +ti_dma_alloc(struct ti_softc *sc) +{ + bus_addr_t lowaddr; + int i, error; + + lowaddr = BUS_SPACE_MAXADDR; + if (sc->ti_dac == 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->ti_dev), 1, 0, lowaddr, + BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, + BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->ti_cdata.ti_parent_tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate parent dma tag\n"); + return (ENOMEM); + } + + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_gib), + &sc->ti_cdata.ti_gib_tag, (uint8_t **)&sc->ti_rdata.ti_info, + &sc->ti_cdata.ti_gib_map, &sc->ti_rdata.ti_info_paddr, "GIB"); + if (error) + return (error); + + /* Producer/consumer status */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_status), + &sc->ti_cdata.ti_status_tag, (uint8_t **)&sc->ti_rdata.ti_status, + &sc->ti_cdata.ti_status_map, &sc->ti_rdata.ti_status_paddr, + "event ring"); + if (error) + return (error); + + /* Event ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_EVENT_RING_SZ, + &sc->ti_cdata.ti_event_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map, &sc->ti_rdata.ti_event_ring_paddr, + "event ring"); + if (error) + return (error); + + /* Command ring lives in shared memory so no need to create DMA area. */ + + /* Standard RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_STD_RX_RING_SZ, + &sc->ti_cdata.ti_rx_std_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map, + &sc->ti_rdata.ti_rx_std_ring_paddr, "RX ring"); + if (error) + return (error); + + /* Jumbo RX ring */ + error = ti_dma_ring_alloc(sc, TI_JUMBO_RING_ALIGN, TI_JUMBO_RX_RING_SZ, + &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map, + &sc->ti_rdata.ti_rx_jumbo_ring_paddr, "jumbo RX ring"); + if (error) + return (error); + + /* RX return ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_RX_RETURN_RING_SZ, + &sc->ti_cdata.ti_rx_return_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map, + &sc->ti_rdata.ti_rx_return_ring_paddr, "RX return ring"); + if (error) + return (error); + + /* Create DMA tag for standard RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_std_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate RX dma tag\n"); + return (error); + } + + /* Create DMA tag for jumbo RX mbufs. */ +#ifdef TI_SF_BUF_JUMBO + /* + * The VM system will take care of providing aligned pages. Alignment + * is set to 1 here so that busdma resources won't be wasted. + */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE * 4, 4, + PAGE_SIZE, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#else + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, + MJUM9BYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#endif + if (error) { + device_printf(sc->ti_dev, + "could not allocate jumbo RX dma tag\n"); + return (error); + } + + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, + 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * TI_MAXTXSEGS, TI_MAXTXSEGS, MCLBYTES, 0, NULL, NULL, + &sc->ti_cdata.ti_tx_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate TX dma tag\n"); + return (ENOMEM); + } + + /* Create DMA maps for RX buffers. */ for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for RX\n"); - return (ENOBUFS); + "could not create DMA map for RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for RX\n"); - return (ENOBUFS); + "could not create spare DMA map for RX\n"); + return (error); } + /* Create DMA maps for jumbo RX buffers. */ for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create DMA map for jumbo RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create spare DMA map for jumbo RX\n"); + return (error); + } + + /* Create DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + error = bus_dmamap_create(sc->ti_cdata.ti_tx_tag, 0, + &sc->ti_cdata.ti_txdesc[i].tx_dmamap); + if (error) { + device_printf(sc->ti_dev, + "could not create DMA map for TX\n"); + return (ENOMEM); + } } - /* Mini ring is not available on Tigon 1. */ + /* Mini ring and TX ring is not available on Tigon 1. */ if (sc->ti_hwrev == TI_HWREV_TIGON) return (0); + /* TX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_TX_RING_SZ, + &sc->ti_cdata.ti_tx_ring_tag, (uint8_t **)&sc->ti_rdata.ti_tx_ring, + &sc->ti_cdata.ti_tx_ring_map, &sc->ti_rdata.ti_tx_ring_paddr, + "TX ring"); + if (error) + return (error); + + /* Mini RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_MINI_RX_RING_SZ, + &sc->ti_cdata.ti_rx_mini_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map, + &sc->ti_rdata.ti_rx_mini_ring_paddr, "mini RX ring"); + if (error) + return (error); + + /* Create DMA tag for mini RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->ti_cdata.ti_rx_mini_tag); + if (error) { + device_printf(sc->ti_dev, + "could not allocate mini RX dma tag\n"); + return (error); + } + + /* Create DMA maps for mini RX buffers. */ for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create DMA map for mini RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create spare DMA map for mini RX\n"); + return (error); } return (0); } static void -ti_free_dmamaps(struct ti_softc *sc) +ti_dma_free(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) { - for (i = 0; i < TI_TX_RING_CNT; i++) { - if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { - bus_dmamap_destroy(sc->ti_mbuftx_dmat, - sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - } + /* Destroy DMA maps for RX buffers. */ + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_std_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i]); + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } } - - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_std_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_std_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_sparemap); - sc->ti_cdata.ti_rx_std_sparemap = NULL; - } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_std_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_std_tag); + sc->ti_cdata.ti_rx_std_tag = NULL; } - if (sc->ti_jumbo_dmat) { - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_jumbo_sparemap) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_sparemap); - sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + /* Destroy DMA maps for jumbo RX buffers. */ + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i]); + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_jumbo_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_jumbo_tag); + sc->ti_cdata.ti_rx_jumbo_tag = NULL; + } - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_mini_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_mini_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_sparemap); - sc->ti_cdata.ti_rx_mini_sparemap = NULL; + /* Destroy DMA maps for mini RX buffers. */ + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_mini_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i]); + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } } -} - -#ifndef TI_SF_BUF_JUMBO - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, - BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, - NULL, &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; } - return (0); -} - -#else - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - /* - * The VM system will take care of providing aligned pages. Alignment - * is set to 1 here so that busdma resources won't be wasted. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - PAGE_SIZE * 4 /*XXX*/, /* maxsize */ - 4, /* nsegments */ - PAGE_SIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_mini_tag); + sc->ti_cdata.ti_rx_mini_tag = NULL; } - return (0); + /* Destroy DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { + bus_dmamap_destroy(sc->ti_cdata.ti_tx_tag, + sc->ti_cdata.ti_txdesc[i].tx_dmamap); + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; + } + } + if (sc->ti_cdata.ti_tx_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_tx_tag); + sc->ti_cdata.ti_tx_tag = NULL; + } + + /* Destroy standard RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_std_ring_tag, + (void *)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map); + /* Destroy jumbo RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (void *)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map); + /* Destroy mini RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_mini_ring_tag, + (void *)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map); + /* Destroy RX return ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_return_ring_tag, + (void *)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map); + /* Destroy TX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_tx_ring_tag, + (void *)&sc->ti_rdata.ti_tx_ring, &sc->ti_cdata.ti_tx_ring_map); + /* Destroy status block. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_status_tag, + (void *)&sc->ti_rdata.ti_status, &sc->ti_cdata.ti_status_map); + /* Destroy event ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_event_ring_tag, + (void *)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map); + /* Destroy GIB */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_gib_tag, + (void *)&sc->ti_rdata.ti_info, &sc->ti_cdata.ti_gib_map); + + /* Destroy the parent tag. */ + if (sc->ti_cdata.ti_parent_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_parent_tag); + sc->ti_cdata.ti_parent_tag = NULL; + } } -#endif /* TI_SF_BUF_JUMBO */ - /* * Intialize a standard receive ring descriptor. */ @@ -1160,7 +1387,7 @@ ti_newbuf_std(struct ti_softc *sc, int i m->m_len = m->m_pkthdr.len = MCLBYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1169,9 +1396,9 @@ ti_newbuf_std(struct ti_softc *sc, int i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i]); } @@ -1180,7 +1407,7 @@ ti_newbuf_std(struct ti_softc *sc, int i sc->ti_cdata.ti_rx_std_sparemap = map; sc->ti_cdata.ti_rx_std_chain[i] = m; - r = &sc->ti_rdata->ti_rx_std_ring[i]; + r = &sc->ti_rdata.ti_rx_std_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1191,8 +1418,8 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1215,7 +1442,7 @@ ti_newbuf_mini(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MHLEN; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1224,9 +1451,9 @@ ti_newbuf_mini(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i]); } @@ -1235,7 +1462,7 @@ ti_newbuf_mini(struct ti_softc *sc, int sc->ti_cdata.ti_rx_mini_sparemap = map; sc->ti_cdata.ti_rx_mini_chain[i] = m; - r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r = &sc->ti_rdata.ti_rx_mini_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1246,8 +1473,8 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1274,7 +1501,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MJUM9BYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1283,9 +1510,9 @@ ti_newbuf_jumbo(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_jumbo_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i]); } @@ -1294,7 +1521,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int sc->ti_cdata.ti_rx_jumbo_sparemap = map; sc->ti_cdata.ti_rx_jumbo_chain[i] = m; - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; @@ -1305,8 +1532,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1419,11 +1646,11 @@ ti_newbuf_jumbo(struct ti_softc *sc, int } /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[idx]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[idx]; sc->ti_cdata.ti_rx_jumbo_chain[idx] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, segs, - &nsegs, 0)) + if (bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, map, m_new, + segs, &nsegs, 0)) return (ENOBUFS); if ((nsegs < 1) || (nsegs > 4)) return (ENOBUFS); @@ -1451,7 +1678,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_idx = idx; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_PREREAD); return (0); nobufs: @@ -1507,15 +1734,16 @@ ti_free_rx_ring_std(struct ti_softc *sc) for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_std_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, map); m_freem(sc->ti_cdata.ti_rx_std_chain[i]); sc->ti_cdata.ti_rx_std_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_std_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_std_ring, TI_STD_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_ring_tag, + sc->ti_cdata.ti_rx_std_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1544,15 +1772,16 @@ ti_free_rx_ring_jumbo(struct ti_softc *s for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, map); m_freem(sc->ti_cdata.ti_rx_jumbo_chain[i]); sc->ti_cdata.ti_rx_jumbo_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_jumbo_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_jumbo_ring, TI_JUMBO_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_ring_tag, + sc->ti_cdata.ti_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1577,18 +1806,22 @@ ti_free_rx_ring_mini(struct ti_softc *sc bus_dmamap_t map; int i; + if (sc->ti_rdata.ti_rx_mini_ring == NULL) + return; + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_mini_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, map); m_freem(sc->ti_cdata.ti_rx_mini_chain[i]); sc->ti_cdata.ti_rx_mini_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_mini_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_mini_ring, TI_MINI_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_ring_tag, + sc->ti_cdata.ti_rx_mini_ring_map, BUS_DMASYNC_PREWRITE); } static void @@ -1597,21 +1830,23 @@ ti_free_tx_ring(struct ti_softc *sc) struct ti_txdesc *txd; int i; - if (sc->ti_rdata->ti_tx_ring == NULL) + if (sc->ti_rdata.ti_tx_ring == NULL) return; for (i = 0; i < TI_TX_RING_CNT; i++) { txd = &sc->ti_cdata.ti_txdesc[i]; if (txd->tx_m != NULL) { - bus_dmamap_sync(sc->ti_mbuftx_dmat, txd->tx_dmamap, + bus_dmamap_sync(sc->ti_cdata.ti_tx_tag, txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->ti_mbuftx_dmat, txd->tx_dmamap); + bus_dmamap_unload(sc->ti_cdata.ti_tx_tag, + txd->tx_dmamap); m_freem(txd->tx_m); txd->tx_m = NULL; } - bzero((char *)&sc->ti_rdata->ti_tx_ring[i], - sizeof(struct ti_tx_desc)); } + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1943,25 +2178,20 @@ ti_gibinit(struct ti_softc *sc) { struct ifnet *ifp; struct ti_rcb *rcb; - uint32_t rdphys; int i; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; - rdphys = sc->ti_rdata_phys; /* Disable interrupts for now. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); - /* - * Tell the chip where to find the general information block. - * While this struct could go into >4GB memory, we allocate it in a - * single slab with the other descriptors, and those don't seem to - * support being located in a 64-bit region. - */ - CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, 0); - CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, rdphys + TI_RD_OFF(ti_info)); + /* Tell the chip where to find the general information block. */ + CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, + (uint64_t)sc->ti_rdata.ti_info_paddr >> 32); + CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, + sc->ti_rdata.ti_info_paddr & 0xFFFFFFFF); /* Load the firmware into SRAM. */ ti_loadfw(sc); @@ -1969,20 +2199,20 @@ ti_gibinit(struct ti_softc *sc) /* Set up the contents of the general info and ring control blocks. */ /* Set up the event ring and producer pointer. */ - rcb = &sc->ti_rdata->ti_info.ti_ev_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_event_ring); + bzero(sc->ti_rdata.ti_event_ring, TI_EVENT_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_ev_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_event_ring_paddr); rcb->ti_flags = 0; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_ev_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_ev_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_ev_prodidx_r)); sc->ti_ev_prodidx.ti_idx = 0; CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0); sc->ti_ev_saved_considx = 0; /* Set up the command ring and producer mailbox. */ - rcb = &sc->ti_rdata->ti_info.ti_cmd_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING); + rcb = &sc->ti_rdata.ti_info->ti_cmd_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, TI_GCR_NIC_ADDR(TI_GCR_CMDRING)); rcb->ti_flags = 0; rcb->ti_max_len = 0; for (i = 0; i < TI_CMD_RING_CNT; i++) { @@ -1997,12 +2227,13 @@ ti_gibinit(struct ti_softc *sc) * We re-use the current stats buffer for this to * conserve memory. */ - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) = - rdphys + TI_RD_OFF(ti_info.ti_stats); + bzero(&sc->ti_rdata.ti_info->ti_stats, sizeof(struct ti_stats)); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_refresh_stats_ptr, + sc->ti_rdata.ti_info_paddr + offsetof(struct ti_gib, ti_stats)); /* Set up the standard receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_std_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); + rcb = &sc->ti_rdata.ti_info->ti_std_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_std_ring_paddr); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) @@ -2012,8 +2243,8 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); + rcb = &sc->ti_rdata.ti_info->ti_jumbo_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_jumbo_ring_paddr); #ifndef TI_SF_BUF_JUMBO rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; @@ -2033,8 +2264,8 @@ ti_gibinit(struct ti_softc *sc) * Tigon 2 but the slot in the config block is * still there on the Tigon 1. */ - rcb = &sc->ti_rdata->ti_info.ti_mini_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_mini_ring); + rcb = &sc->ti_rdata.ti_info->ti_mini_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_mini_ring_paddr); rcb->ti_max_len = MHLEN - ETHER_ALIGN; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; @@ -2049,12 +2280,13 @@ ti_gibinit(struct ti_softc *sc) /* * Set up the receive return ring. */ - rcb = &sc->ti_rdata->ti_info.ti_return_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_return_ring); + rcb = &sc->ti_rdata.ti_info->ti_return_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_return_ring_paddr); rcb->ti_flags = 0; rcb->ti_max_len = TI_RETURN_RING_CNT; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_return_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_return_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_return_prodidx_r)); /* * Set up the tx ring. Note: for the Tigon 2, we have the option @@ -2066,9 +2298,9 @@ ti_gibinit(struct ti_softc *sc) * a Tigon 1 chip. */ CSR_WRITE_4(sc, TI_WINBASE, TI_TX_RING_BASE); - bzero((char *)sc->ti_rdata->ti_tx_ring, - TI_TX_RING_CNT * sizeof(struct ti_tx_desc)); - rcb = &sc->ti_rdata->ti_info.ti_tx_rcb; + if (sc->ti_rdata.ti_tx_ring != NULL) + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_tx_rcb; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = 0; else @@ -2080,18 +2312,28 @@ ti_gibinit(struct ti_softc *sc) TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; if (sc->ti_hwrev == TI_HWREV_TIGON) - TI_HOSTADDR(rcb->ti_hostaddr) = TI_TX_RING_BASE; + ti_hostaddr64(&rcb->ti_hostaddr, TI_TX_RING_BASE); else - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_tx_ring); - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr) = - rdphys + TI_RD_OFF(ti_tx_considx_r); - - bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, - BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + ti_hostaddr64(&rcb->ti_hostaddr, + sc->ti_rdata.ti_tx_ring_paddr); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_tx_considx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_tx_considx_r)); + + bus_dmamap_sync(sc->ti_cdata.ti_gib_tag, sc->ti_cdata.ti_gib_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_status_tag, sc->ti_cdata.ti_status_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if (sc->ti_rdata.ti_tx_ring != NULL) + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); /* Set up tunables */ #if 0 - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) + if (ifp->if_mtu > ETHERMTU + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, (sc->ti_rx_coal_ticks / 10)); else @@ -2113,23 +2355,6 @@ ti_gibinit(struct ti_softc *sc) return (0); } -static void -ti_rdata_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct ti_softc *sc; - - sc = arg; - if (error || nseg != 1) - return; - - /* - * All of the Tigon data structures need to live at <4GB. This - * cast is fine since busdma was told about this constraint. - */ - sc->ti_rdata_phys = segs[0].ds_addr; - return; -} - /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. @@ -2231,8 +2456,7 @@ ti_attach(device_t dev) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 3 23:57:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5725106564A; Tue, 3 Jan 2012 23:57:47 +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 BF6A48FC08; Tue, 3 Jan 2012 23:57:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q03NvlbG049829; Tue, 3 Jan 2012 23:57:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Nvl51049827; Tue, 3 Jan 2012 23:57:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032357.q03Nvl51049827@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229445 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 23:57:47 -0000 Author: yongari Date: Tue Jan 3 23:57:47 2012 New Revision: 229445 URL: http://svn.freebsd.org/changeset/base/229445 Log: MFC r227348: ti(4) supports altq(4). Modified: stable/8/share/man/man4/altq.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/altq.4 ============================================================================== --- stable/8/share/man/man4/altq.4 Tue Jan 3 23:57:27 2012 (r229444) +++ stable/8/share/man/man4/altq.4 Tue Jan 3 23:57:47 2012 (r229445) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2010 +.Dd November 8, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -160,6 +160,7 @@ They have been applied to the following .Xr sk 4 , .Xr ste 4 , .Xr stge 4 , +.Xr ti 4 , .Xr txp 4 , .Xr udav 4 , .Xr ural 4 , From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 00:03:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6387106567A; Wed, 4 Jan 2012 00:03:50 +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 9F77A8FC0C; Wed, 4 Jan 2012 00:03:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0403oZk050277; Wed, 4 Jan 2012 00:03:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0403oZC050275; Wed, 4 Jan 2012 00:03:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040003.q0403oZC050275@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 00:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229448 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 00:03:50 -0000 Author: yongari Date: Wed Jan 4 00:03:50 2012 New Revision: 229448 URL: http://svn.freebsd.org/changeset/base/229448 Log: MFC r227349,227513-227514: r227349: Document TI_SF_BUF_JUMBO and Xr altq. r227513: Document newly introduced a loader tunable and sysctl variables. r227514: Clarify hw.ti.%d.dac tunable. Modified: stable/8/share/man/man4/ti.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ti.4 ============================================================================== --- stable/8/share/man/man4/ti.4 Wed Jan 4 00:03:33 2012 (r229447) +++ stable/8/share/man/man4/ti.4 Wed Jan 4 00:03:50 2012 (r229448) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd November 14, 2011 .Dt TI 4 .Os .Sh NAME @@ -42,7 +42,7 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ti" -.Cd "options TI_PRIVATE_JUMBOS" +.Cd "options TI_SF_BUF_JUMBO" .Cd "options TI_JUMBO_HDRSPLIT" .Ed .Pp @@ -97,13 +97,14 @@ for more discussion on zero copy receive .Pp The .Nm -driver normally uses jumbo receive buffers allocated by the +driver uses UMA backed jumbo receive buffers, but can be configured +to use .Xr sendfile 2 -buffer allocator, but can be configured to use its own private pool of -jumbo buffers that are contiguous instead of buffers from the jumbo -allocator, which are made up of multiple page sized chunks. -To turn on private jumbos, use the -.Dv TI_PRIVATE_JUMBOS +buffer allocator. +To turn on +.Xr sendfile 2 +buffer allocator, use the +.Dv TI_SF_BUF_JUMBO option. .Pp Support for vlans is also available using the @@ -203,6 +204,93 @@ NEC Gigabit Ethernet .It Silicon Graphics PCI Gigabit Ethernet adapter .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.ti.%d.dac +If this tunable is set to 0 it will disable DAC (Dual Address Cycle). +The default value is 1 which means driver will use full 64bit +DMA addressing. +.El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables. +The interface has to be brought down and up again before a +change takes effect when any of the following tunables are +changed. +The one microsecond clock tick referenced below is a nominal +time and the actual hardware may not provide granularity to +this level. +For example, on Tigon 2 (revision 6) cards with release 12.0 +the clock granularity is 5 microseconds. +.Bl -tag -width "xxxxxx" +.It Va dev.ti.%d.rx_coal_ticks +This value, receive coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the receive return producer pointer to the Host and generates an +interrupt. +This parameter works in conjunction with the rx_max_coal_bds, +receive max coalesced BDs, tunable parameter. +The NIC will return the receive return producer pointer to the Host +when either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and receive BDs +will only be returned when the receive max coalesced BDs value is +reached. +The default valus is 170. +.It Va dev.ti.%d.rx_max_coal_bds +This value, receive max coalesced BDs, controls the number of +receive buffer descriptors that will be coalesced before the NIC +updates the receive return ring producer index. +If this value is set to 0 it will disable receive buffer descriptor +coalescing. +The default valus is 64. +.It Va dev.ti.%d.ti_tx_coal_ticks +This value, send coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the send consumer pointer to the Host and generates an interrupt. +This parameter works in conjunction with the tx_max_coal_bds, +send max coalesced BDs, tunable parameter. +The NIC will return the send consumer pointer to the Host when +either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and send BDs will +only be returned when the send max coalesced BDs value is reached. +The default value is 2000. +.It Va dev.ti.%d.tx_max_coal_bds +This value, send max coalesced BDs, controls the number of send +buffer descriptors that will be coalesced before the NIC updates +the send consumer index. +If this valus is set to 0 it will disable send buffer descriptor +coalescing. +The default valus is 32. +.It Va dev.ti.%d.tx_buf_ratio +This value controls the ratio of the remaining memory in the NIC +that should be devoted to transmit buffer vs. receive buffer. +The lower 7 bits are used to indicate the ratio in 1/64th increments. +For example, setting this value to 16 will set the transmit buffer +to 1/4 of the remaining buffer space. +In no cases will the transmit or receive buffer be reduced below +68 KB. +For a 1 MB NIC the approximate total space for data buffers is +800 KB. +For a 512 KB NIC that number is 300 KB. +The default value is 21. +.It Va dev.ti.%d.stat_ticks +The value, stat ticks, controls the number of clock ticks +(of 1 microseconds each) that must elapse before the NIC DMAs +the statistics block to the Host and generates a STATS_UPDATED +event. +If set to zero then statistics are never DMAed to the Host. +It is recommended that this value be set to a high enough +frequency to not mislead someone reading statistics refreshes. +Several times a second is enough. +The default value is 2000000 (2 seconds). +.El .Sh IOCTLS In addition to the standard .Xr socket 2 @@ -313,6 +401,7 @@ the network connection (cable). .El .Sh SEE ALSO .Xr sendfile 2 , +.Xr altq 4 , .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 00:24:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40BE8106566B; Wed, 4 Jan 2012 00:24:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29C478FC0A; Wed, 4 Jan 2012 00:24:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q040OAbL051180; Wed, 4 Jan 2012 00:24:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q040OAxX051178; Wed, 4 Jan 2012 00:24:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201040024.q040OAxX051178@svn.freebsd.org> From: Rick Macklem Date: Wed, 4 Jan 2012 00:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229450 - in stable/8/sys: conf nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 00:24:10 -0000 Author: rmacklem Date: Wed Jan 4 00:24:09 2012 New Revision: 229450 URL: http://svn.freebsd.org/changeset/base/229450 Log: MFC: r227690 The old NFS client will crash due to the reply being m_freem()'d twice if the server bogusly returns an error with the NFSERR_RETERR bit (bit 31) set. No actual NFS error has this bit set, but it seems that amd will sometimes do this. This patch makes sure the NFSERR_RETERR bit is cleared to avoid a crash. Modified: stable/8/sys/nfsclient/nfs_krpc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/8/sys/nfsclient/nfs_krpc.c Wed Jan 4 00:04:01 2012 (r229449) +++ stable/8/sys/nfsclient/nfs_krpc.c Wed Jan 4 00:24:09 2012 (r229450) @@ -540,6 +540,11 @@ tryagain: hz); goto tryagain; } + /* + * Make sure NFSERR_RETERR isn't bogusly set by a server + * such as amd. (No actual NFS error has bit 31 set.) + */ + error &= ~NFSERR_RETERR; /* * If the File Handle was stale, invalidate the lookup From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 01:45:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0738B106566C; Wed, 4 Jan 2012 01:45: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 CB3D68FC15; Wed, 4 Jan 2012 01:45:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q041jqrv053784; Wed, 4 Jan 2012 01:45:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q041jqXb053781; Wed, 4 Jan 2012 01:45:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040145.q041jqXb053781@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 01:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229453 - in stable/8/sys: conf dev/dc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 01:45:53 -0000 Author: yongari Date: Wed Jan 4 01:45:52 2012 New Revision: 229453 URL: http://svn.freebsd.org/changeset/base/229453 Log: MFC r227675: Partially revert r218788. r218788 removed calling dc_setcfg() for !DC_IS_ADMTEK in dc_miibus_statchg(). This change broke link establishment of Intel 21143 with dcphy(4) where it stuck in "ability detect" state without completing auto-negotiation. Also nuke dc_if_media as it's not actually used. Modified: stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/if_dcreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Wed Jan 4 01:38:52 2012 (r229452) +++ stable/8/sys/dev/dc/if_dc.c Wed Jan 4 01:45:52 2012 (r229453) @@ -860,12 +860,11 @@ dc_miibus_statchg(device_t dev) return; ifm = &mii->mii_media; - if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { + if (DC_IS_DAVICOM(sc) && IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { dc_setcfg(sc, ifm->ifm_media); - sc->dc_if_media = ifm->ifm_media; return; - } + } else if (!DC_IS_ADMTEK(sc)) + dc_setcfg(sc, mii->mii_media_active); sc->dc_link = 0; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == @@ -875,17 +874,8 @@ dc_miibus_statchg(device_t dev) case IFM_100_TX: sc->dc_link = 1; break; - default: - break; } } - if (sc->dc_link == 0) - return; - - sc->dc_if_media = mii->mii_media_active; - if (DC_IS_ADMTEK(sc)) - return; - dc_setcfg(sc, mii->mii_media_active); } /* Modified: stable/8/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/8/sys/dev/dc/if_dcreg.h Wed Jan 4 01:38:52 2012 (r229452) +++ stable/8/sys/dev/dc/if_dcreg.h Wed Jan 4 01:45:52 2012 (r229453) @@ -760,7 +760,6 @@ struct dc_softc { int dc_pnic_rx_bug_save; unsigned char *dc_pnic_rx_buf; int dc_if_flags; - int dc_if_media; uint32_t dc_flags; uint32_t dc_txthresh; uint32_t dc_eaddr[2]; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 02:03:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94B65106567C; Wed, 4 Jan 2012 02:03:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F2568FC13; Wed, 4 Jan 2012 02:03:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0423AjR054478; Wed, 4 Jan 2012 02:03:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0423AMH054476; Wed, 4 Jan 2012 02:03:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201040203.q0423AMH054476@svn.freebsd.org> From: Eitan Adler Date: Wed, 4 Jan 2012 02:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229457 - stable/8/usr.sbin/makefs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 02:03:10 -0000 Author: eadler (ports committer) Date: Wed Jan 4 02:03:10 2012 New Revision: 229457 URL: http://svn.freebsd.org/changeset/base/229457 Log: MFC r226482 - remove device keyword from makefs manpage Approved by: gjb Modified: stable/8/usr.sbin/makefs/makefs.8 Directory Properties: stable/8/usr.sbin/makefs/ (props changed) Modified: stable/8/usr.sbin/makefs/makefs.8 ============================================================================== --- stable/8/usr.sbin/makefs/makefs.8 Wed Jan 4 02:02:58 2012 (r229456) +++ stable/8/usr.sbin/makefs/makefs.8 Wed Jan 4 02:03:10 2012 (r229457) @@ -130,8 +130,7 @@ and .Sy uname or .Sy uid , -.Sy device -(in the case of block or character devices), and +and .Sy link (in the case of symbolic links). If From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 08:47:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A571106564A; Wed, 4 Jan 2012 08:47:01 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70CBF8FC08; Wed, 4 Jan 2012 08:47:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q048l1QG068792; Wed, 4 Jan 2012 08:47:01 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q048l1Zo068786; Wed, 4 Jan 2012 08:47:01 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201040847.q048l1Zo068786@svn.freebsd.org> From: Fabien Thomas Date: Wed, 4 Jan 2012 08:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229472 - in stable/8: sys/dev/cpuctl usr.sbin/cpucontrol X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 08:47:01 -0000 Author: fabient Date: Wed Jan 4 08:47:00 2012 New Revision: 229472 URL: http://svn.freebsd.org/changeset/base/229472 Log: MFC r228436: Add VIA microcode update support to cpuctl(4) and cpucontrol(8). Added: stable/8/usr.sbin/cpucontrol/via.c - copied unchanged from r228436, head/usr.sbin/cpucontrol/via.c stable/8/usr.sbin/cpucontrol/via.h - copied unchanged from r228436, head/usr.sbin/cpucontrol/via.h Modified: stable/8/sys/dev/cpuctl/cpuctl.c stable/8/usr.sbin/cpucontrol/Makefile stable/8/usr.sbin/cpucontrol/cpucontrol.c Directory Properties: stable/8/sys/ (props changed) stable/8/usr.sbin/cpucontrol/ (props changed) Modified: stable/8/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/8/sys/dev/cpuctl/cpuctl.c Wed Jan 4 08:14:05 2012 (r229471) +++ stable/8/sys/dev/cpuctl/cpuctl.c Wed Jan 4 08:47:00 2012 (r229472) @@ -74,6 +74,8 @@ static int cpuctl_do_update(int cpu, cpu static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td); static int update_amd(int cpu, cpuctl_update_args_t *args, struct thread *td); +static int update_via(int cpu, cpuctl_update_args_t *args, + struct thread *td); static struct cdev **cpuctl_devs; static MALLOC_DEFINE(M_CPUCTL, "cpuctl", "CPUCTL buffer"); @@ -281,8 +283,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ vendor[12] = '\0'; if (strncmp(vendor, INTEL_VENDOR_ID, sizeof(INTEL_VENDOR_ID)) == 0) ret = update_intel(cpu, data, td); - else if(strncmp(vendor, INTEL_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) + else if(strncmp(vendor, AMD_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) ret = update_amd(cpu, data, td); + else if(strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) == 0) + ret = update_via(cpu, data, td); else ret = ENXIO; return (ret); @@ -402,6 +406,81 @@ fail: return (ret); } +static int +update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) +{ + void *ptr = NULL; + uint64_t rev0, rev1, res; + uint32_t tmp[4]; + int is_bound = 0; + int oldcpu; + int ret; + + if (args->size == 0 || args->data == NULL) { + DPRINTF("[cpuctl,%d]: zero-sized firmware image", __LINE__); + return (EINVAL); + } + if (args->size > UCODE_SIZE_MAX) { + DPRINTF("[cpuctl,%d]: firmware image too large", __LINE__); + return (EINVAL); + } + + /* + * 4 byte alignment required. + */ + ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); + ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); + if (copyin(args->data, ptr, args->size) != 0) { + DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", + __LINE__, args->data, ptr, args->size); + ret = EFAULT; + goto fail; + } + oldcpu = td->td_oncpu; + is_bound = cpu_sched_is_bound(td); + set_cpu(cpu, td); + critical_enter(); + rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current micorcode revision. */ + + /* + * Perform update. + */ + wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); + do_cpuid(1, tmp); + + /* + * Result are in low byte of MSR FCR5: + * 0x00: No update has been attempted since RESET. + * 0x01: The last attempted update was successful. + * 0x02: The last attempted update was unsuccessful due to a bad + * environment. No update was loaded and any preexisting + * patches are still active. + * 0x03: The last attempted update was not applicable to this processor. + * No update was loaded and any preexisting patches are still + * active. + * 0x04: The last attempted update was not successful due to an invalid + * update data block. No update was loaded and any preexisting + * patches are still active + */ + rdmsr_safe(0x1205, &res); + res &= 0xff; + critical_exit(); + rdmsr_safe(MSR_BIOS_SIGN, &rev1); /* Get new microcode revision. */ + restore_cpu(oldcpu, is_bound, td); + + DPRINTF("[cpu,%d]: rev0=%x rev1=%x res=%x\n", __LINE__, + (unsigned)(rev0 >> 32), (unsigned)(rev1 >> 32), (unsigned)res); + + if (res != 0x01) + ret = EINVAL; + else + ret = 0; +fail: + if (ptr != NULL) + contigfree(ptr, args->size, M_CPUCTL); + return (ret); +} + int cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { Modified: stable/8/usr.sbin/cpucontrol/Makefile ============================================================================== --- stable/8/usr.sbin/cpucontrol/Makefile Wed Jan 4 08:14:05 2012 (r229471) +++ stable/8/usr.sbin/cpucontrol/Makefile Wed Jan 4 08:47:00 2012 (r229472) @@ -2,7 +2,7 @@ PROG= cpucontrol MAN= cpucontrol.8 -SRCS= cpucontrol.c intel.c amd.c +SRCS= cpucontrol.c intel.c amd.c via.c WARNS?= 6 Modified: stable/8/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- stable/8/usr.sbin/cpucontrol/cpucontrol.c Wed Jan 4 08:14:05 2012 (r229471) +++ stable/8/usr.sbin/cpucontrol/cpucontrol.c Wed Jan 4 08:47:00 2012 (r229472) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "cpucontrol.h" #include "amd.h" #include "intel.h" +#include "via.h" int verbosity_level = 0; @@ -91,6 +92,7 @@ struct ucode_handler { } handlers[] = { { intel_probe, intel_update }, { amd_probe, amd_update }, + { via_probe, via_update }, }; #define NHANDLERS (sizeof(handlers) / sizeof(*handlers)) Copied: stable/8/usr.sbin/cpucontrol/via.c (from r228436, head/usr.sbin/cpucontrol/via.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/cpucontrol/via.c Wed Jan 4 08:47:00 2012 (r229472, copy of r228436, head/usr.sbin/cpucontrol/via.c) @@ -0,0 +1,222 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR 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 +#include + +#include +#include + +#include "cpucontrol.h" +#include "via.h" + +int +via_probe(int fd) +{ + char vendor[13]; + int error; + cpuctl_cpuid_args_t idargs = { + .level = 0, + }; + + error = ioctl(fd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl()"); + return (1); + } + ((uint32_t *)vendor)[0] = idargs.data[1]; + ((uint32_t *)vendor)[1] = idargs.data[3]; + ((uint32_t *)vendor)[2] = idargs.data[2]; + vendor[12] = '\0'; + if (strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) != 0) + return (1); + + /* TODO: detect Nano CPU. */ + return (0); +} + +void +via_update(const char *dev, const char *path) +{ + int fd, devfd; + struct stat st; + uint32_t *fw_image; + uint32_t sum; + unsigned int i; + size_t payload_size; + via_fw_header_t *fw_header; + uint32_t signature, flags; + int32_t revision; + void *fw_data; + size_t data_size, total_size; + cpuctl_msr_args_t msrargs = { + .msr = MSR_IA32_PLATFORM_ID, + }; + cpuctl_cpuid_args_t idargs = { + .level = 1, /* Signature. */ + }; + cpuctl_update_args_t args; + int error; + + assert(path); + assert(dev); + + fd = -1; + devfd = -1; + fw_image = MAP_FAILED; + devfd = open(dev, O_RDWR); + if (devfd < 0) { + WARN(0, "could not open %s for writing", dev); + return; + } + error = ioctl(devfd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + signature = idargs.data[0]; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + + /* + * MSR_IA32_PLATFORM_ID contains flag in BCD in bits 52-50. + */ + flags = 1 << ((msrargs.data >> 50) & 7); + msrargs.msr = MSR_BIOS_SIGN; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + revision = msrargs.data >> 32; /* Revision in the high dword. */ + WARNX(2, "found cpu type %#x family %#x model %#x stepping %#x.", + (signature >> 12) & 0x03, (signature >> 8) & 0x0f, + (signature >> 4) & 0x0f, (signature >> 0) & 0x0f); + /* + * Open firmware image. + */ + fd = open(path, O_RDONLY, 0); + if (fd < 0) { + WARN(0, "open(%s)", path); + return; + } + error = fstat(fd, &st); + if (error != 0) { + WARN(0, "fstat(%s)", path); + goto fail; + } + if (st.st_size < 0 || (unsigned)st.st_size < sizeof(*fw_header)) { + WARNX(2, "file too short: %s", path); + goto fail; + } + + /* + * mmap the whole image. + */ + fw_image = (uint32_t *)mmap(NULL, st.st_size, PROT_READ, + MAP_PRIVATE, fd, 0); + if (fw_image == MAP_FAILED) { + WARN(0, "mmap(%s)", path); + goto fail; + } + fw_header = (via_fw_header_t *)fw_image; + if (fw_header->signature != VIA_HEADER_SIGNATURE || + fw_header->loader_revision != VIA_LOADER_REVISION) { + WARNX(2, "%s is not a valid via firmware: version mismatch", + path); + goto fail; + } + data_size = fw_header->data_size; + total_size = fw_header->total_size; + if (total_size > (unsigned)st.st_size || st.st_size < 0) { + WARNX(2, "file too short: %s", path); + goto fail; + } + payload_size = data_size + sizeof(*fw_header); + + /* + * Check the primary checksum. + */ + sum = 0; + for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) + sum += *((uint32_t *)fw_image + i); + if (sum != 0) { + WARNX(2, "%s: update data checksum invalid", path); + goto fail; + } + + fw_data = fw_header + 1; /* Pointer to the update data. */ + + /* + * Check if the given image is ok for this cpu. + */ + if (signature != fw_header->cpu_signature) + goto fail; + + if (fw_header->revision != 0 && revision >= fw_header->revision) { + WARNX(1, "skipping %s of rev %#x: up to date", + path, fw_header->revision); + goto fail; + } + fprintf(stderr, "%s: updating cpu %s from rev %#x to rev %#x... ", + path, dev, revision, fw_header->revision); + args.data = fw_data; + args.size = data_size; + error = ioctl(devfd, CPUCTL_UPDATE, &args); + if (error < 0) { + fprintf(stderr, "failed.\n"); + WARN(0, "ioctl()"); + goto fail; + } + fprintf(stderr, "done.\n"); + +fail: + if (fw_image != MAP_FAILED) + if (munmap(fw_image, st.st_size) != 0) + warn("munmap(%s)", path); + if (devfd >= 0) + close(devfd); + if (fd >= 0) + close(fd); + return; +} Copied: stable/8/usr.sbin/cpucontrol/via.h (from r228436, head/usr.sbin/cpucontrol/via.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/cpucontrol/via.h Wed Jan 4 08:47:00 2012 (r229472, copy of r228436, head/usr.sbin/cpucontrol/via.h) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef VIA_H +#define VIA_H + +/* + * Prototypes. + */ +ucode_probe_t via_probe; +ucode_update_t via_update; + +typedef struct via_fw_header { + uint32_t signature; /* Signature. */ + int32_t revision; /* Unique version number. */ + uint32_t date; /* Date of creation in BCD. */ + uint32_t cpu_signature; /* Extended family, extended + model, type, family, model + and stepping. */ + uint32_t checksum; /* Sum of all DWORDS should + be 0. */ + uint32_t loader_revision; /* Version of the loader + required to load update. */ + uint32_t reserverd1; /* Platform IDs encoded in + the lower 8 bits. */ + uint32_t data_size; + uint32_t total_size; + uint8_t reserved2[12]; +} via_fw_header_t; + +typedef struct via_cpu_signature { + uint32_t cpu_signature; + uint32_t checksum; +} via_cpu_signature_t; + +#define VIA_HEADER_SIGNATURE 0x53415252 +#define VIA_LOADER_REVISION 0x00000001 + +#endif /* !VIA_H */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 12:48:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF74D106566C; Wed, 4 Jan 2012 12:48:24 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCAC88FC13; Wed, 4 Jan 2012 12:48:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04CmOa7078410; Wed, 4 Jan 2012 12:48:24 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04CmOti078405; Wed, 4 Jan 2012 12:48:24 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041248.q04CmOti078405@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 12:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229474 - in stable/8/sys: boot/common boot/forth conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 12:48:24 -0000 Author: pluknet Date: Wed Jan 4 12:48:24 2012 New Revision: 229474 URL: http://svn.freebsd.org/changeset/base/229474 Log: MFC r226833,r227056: Remove the long reprecated ``/stand/sysinstall'' from the init_path. Modified: stable/8/sys/boot/common/loader.8 stable/8/sys/boot/forth/loader.conf stable/8/sys/conf/NOTES stable/8/sys/kern/init_main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/boot/common/loader.8 Wed Jan 4 12:48:24 2012 (r229474) @@ -449,7 +449,7 @@ Sets the list of binaries which the kern process. The first matching binary is used. The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . .It Va init_script If set to a valid file name in the root file system, instructs Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/boot/forth/loader.conf Wed Jan 4 12:48:24 2012 (r229474) @@ -76,7 +76,7 @@ module_path="/boot/modules" # Set the mo #boot_serial="" # -h: Use serial console #boot_single="" # -s: Start system in single-user mode #boot_verbose="" # -v: Causes extra debugging information to be printed -#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" +#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init" # Sets the list of init candidates #init_shell="/bin/sh" # The shell binary used by init(8). #init_script="" # Initial script to run by init(8) before chrooting. Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/conf/NOTES Wed Jan 4 12:48:24 2012 (r229474) @@ -2733,7 +2733,7 @@ options UBSEC_RNDTEST # enable rndtest # Embedded system options: # # An embedded system might want to run something other than init. -options INIT_PATH=/sbin/init:/stand/sysinstall +options INIT_PATH=/sbin/init:/rescue/init # Debug options options BUS_DEBUG # enable newbus debugging Modified: stable/8/sys/kern/init_main.c ============================================================================== --- stable/8/sys/kern/init_main.c Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/kern/init_main.c Wed Jan 4 12:48:24 2012 (r229474) @@ -623,7 +623,7 @@ static char init_path[MAXPATHLEN] = #ifdef INIT_PATH __XSTRING(INIT_PATH); #else - "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"; + "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"; #endif SYSCTL_STRING(_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0, "Path used to search the init process"); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 12:54:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 833F91065678; Wed, 4 Jan 2012 12:54:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 58A708FC13; Wed, 4 Jan 2012 12:54:54 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 11EEB46B0C; Wed, 4 Jan 2012 07:54:54 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 16CA1B924; Wed, 4 Jan 2012 07:54:53 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Wed, 4 Jan 2012 07:54:50 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201041248.q04CmOti078405@svn.freebsd.org> In-Reply-To: <201201041248.q04CmOti078405@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201040754.50457.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 07:54:53 -0500 (EST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r229474 - in stable/8/sys: boot/common boot/forth conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 12:54:54 -0000 On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: > Author: pluknet > Date: Wed Jan 4 12:48:24 2012 > New Revision: 229474 > URL: http://svn.freebsd.org/changeset/base/229474 > > Log: > MFC r226833,r227056: > > Remove the long reprecated ``/stand/sysinstall'' from the init_path. Uh, you need to revert this or 8.3 won't install. -- John Baldwin From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 13:31:38 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24E0B1065670; Wed, 4 Jan 2012 13:31:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id EC8DA8FC19; Wed, 4 Jan 2012 13:31:37 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id A41AB46B1A; Wed, 4 Jan 2012 08:31:37 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 32438B944; Wed, 4 Jan 2012 08:31:37 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Wed, 4 Jan 2012 08:31:36 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201041248.q04CmOti078405@svn.freebsd.org> <201201040754.50457.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201040831.36693.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 08:31:37 -0500 (EST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r229474 - in stable/8/sys: boot/common boot/forth conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 13:31:38 -0000 On Wednesday, January 04, 2012 8:09:51 am Sergey Kandaurov wrote: > On 4 January 2012 16:54, John Baldwin wrote: > > On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: > >> Author: pluknet > >> Date: Wed Jan 4 12:48:24 2012 > >> New Revision: 229474 > >> URL: http://svn.freebsd.org/changeset/base/229474 > >> > >> Log: > >> MFC r226833,r227056: > >> > >> Remove the long reprecated ``/stand/sysinstall'' from the init_path. > > > > Uh, you need to revert this or 8.3 won't install. > > So, /stand was removed exactly 5.3 timeframe. I see no reason > why we still should reference it 3 major versions later. > Please correct me if I'm wrong. > > http://www.mavetju.org/mail/view_message.php?list=freebsd-arch&id=1749748 That only stops making a copy of it from the MFS root onto the installed system. The entry in the init path is to allow the MFS root to boot during an install. If you go grab the mfsroot from 8.2-RELEASE and mount it via mdconfig you will find that it has no /sbin/init file. Instead, it uses /stand/sysinstall as its init. -- John Baldwin From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 13:37:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26CB6106566B for ; Wed, 4 Jan 2012 13:37:48 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id E1BF88FC0C for ; Wed, 4 Jan 2012 13:37:47 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so20321878obb.13 for ; Wed, 04 Jan 2012 05:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xSoHF6n7zu2FcTQTSiLvX6H9wlWRFYy7nGIGLY1WPjA=; b=MtSpse16lL+vvpIJvpYUXnHkSdYYxObmKLwBXmtTFrR7YpEJy4l1+xv329JzIEh2Mo QYQQjIYnpQtVrvcaYkdIU1rE/vD+9Phg6Rp3p0qJCgTyGQMnshQRMcegY0Z20d+3nwQi HZE4lgPVR0Z2WzCX19fphfIX7HFF5M2Er+PoE= MIME-Version: 1.0 Received: by 10.182.160.1 with SMTP id xg1mr48407978obb.30.1325682591679; Wed, 04 Jan 2012 05:09:51 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Wed, 4 Jan 2012 05:09:51 -0800 (PST) In-Reply-To: <201201040754.50457.jhb@freebsd.org> References: <201201041248.q04CmOti078405@svn.freebsd.org> <201201040754.50457.jhb@freebsd.org> Date: Wed, 4 Jan 2012 16:09:51 +0300 X-Google-Sender-Auth: Um9A-vx7riz2Ee0ARlbNo4rIfzo Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r229474 - in stable/8/sys: boot/common boot/forth conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 13:37:48 -0000 On 4 January 2012 16:54, John Baldwin wrote: > On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: >> Author: pluknet >> Date: Wed Jan =A04 12:48:24 2012 >> New Revision: 229474 >> URL: http://svn.freebsd.org/changeset/base/229474 >> >> Log: >> =A0 MFC r226833,r227056: >> >> =A0 Remove the long reprecated ``/stand/sysinstall'' from the init_path. > > Uh, you need to revert this or 8.3 won't install. So, /stand was removed exactly 5.3 timeframe. I see no reason why we still should reference it 3 major versions later. Please correct me if I'm wrong. http://www.mavetju.org/mail/view_message.php?list=3Dfreebsd-arch&id=3D17497= 48 --=20 wbr, pluknet From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 13:40:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 978B5106564A; Wed, 4 Jan 2012 13:40:42 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 263148FC12; Wed, 4 Jan 2012 13:40:41 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so20326276obb.13 for ; Wed, 04 Jan 2012 05:40:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=thvAHwXLh7InJkMXW+R1xXu+cvOBdn31BuRTviUrbzQ=; b=V1eQDn7V+XaDMzn9WeV0MPUPqYwF3XrDpuAlQINXgT6S3grKUsBDKPosAB0tewuVmT pcGDOPukeF09eBrvPa8vDtnCrVAz0RYYkxXc0GpNwONVapwr1JYTINExOc/xNzBdzzdo zARlOlLhR1LGQR2M89l50tycR00OMC2ALlqqM= MIME-Version: 1.0 Received: by 10.182.117.97 with SMTP id kd1mr21975476obb.50.1325684441602; Wed, 04 Jan 2012 05:40:41 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Wed, 4 Jan 2012 05:40:41 -0800 (PST) In-Reply-To: <201201040831.36693.jhb@freebsd.org> References: <201201041248.q04CmOti078405@svn.freebsd.org> <201201040754.50457.jhb@freebsd.org> <201201040831.36693.jhb@freebsd.org> Date: Wed, 4 Jan 2012 16:40:41 +0300 X-Google-Sender-Auth: w2zF_8lKT41XpMWo-HeQahKuCkU Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r229474 - in stable/8/sys: boot/common boot/forth conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 13:40:42 -0000 On 4 January 2012 17:31, John Baldwin wrote: > On Wednesday, January 04, 2012 8:09:51 am Sergey Kandaurov wrote: >> On 4 January 2012 16:54, John Baldwin wrote: >> > On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: >> >> Author: pluknet >> >> Date: Wed Jan =A04 12:48:24 2012 >> >> New Revision: 229474 >> >> URL: http://svn.freebsd.org/changeset/base/229474 >> >> >> >> Log: >> >> =A0 MFC r226833,r227056: >> >> >> >> =A0 Remove the long reprecated ``/stand/sysinstall'' from the init_pa= th. >> > >> > Uh, you need to revert this or 8.3 won't install. >> >> So, /stand was removed exactly 5.3 timeframe. I see no reason >> why we still should reference it 3 major versions later. >> Please correct me if I'm wrong. >> >> http://www.mavetju.org/mail/view_message.php?list=3Dfreebsd-arch&id=3D17= 49748 > > That only stops making a copy of it from the MFS root onto the installed > system. =A0The entry in the init path is to allow the MFS root to boot du= ring an > install. =A0If you go grab the mfsroot from 8.2-RELEASE and mount it via > mdconfig you will find that it has no /sbin/init file. =A0Instead, it use= s > /stand/sysinstall as its init. Doh, indeed. I will revert it right now, sorry. --=20 wbr, pluknet From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 13:53:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FBC21065673; Wed, 4 Jan 2012 13:53:51 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CFA28FC0A; Wed, 4 Jan 2012 13:53:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04DrpTm080707; Wed, 4 Jan 2012 13:53:51 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DroP4080702; Wed, 4 Jan 2012 13:53:50 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041353.q04DroP4080702@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 13:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229481 - in stable/8/sys: boot/common boot/forth conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 13:53:51 -0000 Author: pluknet Date: Wed Jan 4 13:53:50 2012 New Revision: 229481 URL: http://svn.freebsd.org/changeset/base/229481 Log: Revert MFC r226833,227056. /stand exists in the MFS root used during a sysinstall-based install. Reported by: jhb Pointy hat to: pluknet Modified: stable/8/sys/boot/common/loader.8 stable/8/sys/boot/forth/loader.conf stable/8/sys/conf/NOTES stable/8/sys/kern/init_main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/boot/common/loader.8 Wed Jan 4 13:53:50 2012 (r229481) @@ -449,7 +449,7 @@ Sets the list of binaries which the kern process. The first matching binary is used. The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . .It Va init_script If set to a valid file name in the root file system, instructs Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/boot/forth/loader.conf Wed Jan 4 13:53:50 2012 (r229481) @@ -76,7 +76,7 @@ module_path="/boot/modules" # Set the mo #boot_serial="" # -h: Use serial console #boot_single="" # -s: Start system in single-user mode #boot_verbose="" # -v: Causes extra debugging information to be printed -#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init" +#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" # Sets the list of init candidates #init_shell="/bin/sh" # The shell binary used by init(8). #init_script="" # Initial script to run by init(8) before chrooting. Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/conf/NOTES Wed Jan 4 13:53:50 2012 (r229481) @@ -2733,7 +2733,7 @@ options UBSEC_RNDTEST # enable rndtest # Embedded system options: # # An embedded system might want to run something other than init. -options INIT_PATH=/sbin/init:/rescue/init +options INIT_PATH=/sbin/init:/stand/sysinstall # Debug options options BUS_DEBUG # enable newbus debugging Modified: stable/8/sys/kern/init_main.c ============================================================================== --- stable/8/sys/kern/init_main.c Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/kern/init_main.c Wed Jan 4 13:53:50 2012 (r229481) @@ -623,7 +623,7 @@ static char init_path[MAXPATHLEN] = #ifdef INIT_PATH __XSTRING(INIT_PATH); #else - "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"; + "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"; #endif SYSCTL_STRING(_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0, "Path used to search the init process"); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 14:03:46 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 326CB1065673; Wed, 4 Jan 2012 14:03:46 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 204A38FC26; Wed, 4 Jan 2012 14:03:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04E3j5N081149; Wed, 4 Jan 2012 14:03:45 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04E3jLT081147; Wed, 4 Jan 2012 14:03:45 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041403.q04E3jLT081147@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:03:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229483 - in stable/8/sys: conf netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 14:03:46 -0000 Author: pluknet Date: Wed Jan 4 14:03:45 2012 New Revision: 229483 URL: http://svn.freebsd.org/changeset/base/229483 Log: MFC r227055: Remove a couple of write-only variables. Modified: stable/8/sys/netinet6/icmp6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/icmp6.c ============================================================================== --- stable/8/sys/netinet6/icmp6.c Wed Jan 4 14:02:00 2012 (r229482) +++ stable/8/sys/netinet6/icmp6.c Wed Jan 4 14:03:45 2012 (r229483) @@ -2266,8 +2266,6 @@ icmp6_redirect_input(struct mbuf *m, int int icmp6len = ntohs(ip6->ip6_plen); char *lladdr = NULL; int lladdrlen = 0; - u_char *redirhdr = NULL; - int redirhdrlen = 0; struct rtentry *rt = NULL; int is_router; int is_onlink; @@ -2403,11 +2401,6 @@ icmp6_redirect_input(struct mbuf *m, int lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } - if (ndopts.nd_opts_rh) { - redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len; - redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */ - } - if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "icmp6_redirect_input: lladdrlen mismatch for %s " From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 14:21:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69857106566B; Wed, 4 Jan 2012 14:21:31 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 577218FC19; Wed, 4 Jan 2012 14:21:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04ELV58081923; Wed, 4 Jan 2012 14:21:31 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04ELV7A081921; Wed, 4 Jan 2012 14:21:31 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041421.q04ELV7A081921@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229486 - in stable/8/sys: conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 14:21:31 -0000 Author: pluknet Date: Wed Jan 4 14:21:30 2012 New Revision: 229486 URL: http://svn.freebsd.org/changeset/base/229486 Log: MFC r226882: Fix arguments list for proc:::signal-discard DTrace probe. Reported by: Anton Yuzhaninov Modified: stable/8/sys/kern/kern_sig.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_sig.c ============================================================================== --- stable/8/sys/kern/kern_sig.c Wed Jan 4 14:18:47 2012 (r229485) +++ stable/8/sys/kern/kern_sig.c Wed Jan 4 14:21:30 2012 (r229486) @@ -2058,7 +2058,7 @@ tdsignal(struct proc *p, struct thread * */ mtx_lock(&ps->ps_mtx); if (SIGISMEMBER(ps->ps_sigignore, sig)) { - SDT_PROBE(proc, kernel, , signal_discard, ps, td, sig, 0, 0 ); + SDT_PROBE(proc, kernel, , signal_discard, td, p, sig, 0, 0 ); mtx_unlock(&ps->ps_mtx); if (ksi && (ksi->ksi_flags & KSI_INS)) From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 14:34:46 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4203B106564A; Wed, 4 Jan 2012 14:34:46 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FD3A8FC17; Wed, 4 Jan 2012 14:34:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04EYkMZ082429; Wed, 4 Jan 2012 14:34:46 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EYjrg082427; Wed, 4 Jan 2012 14:34:45 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041434.q04EYjrg082427@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229488 - in stable/8/sys: compat/freebsd32 conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 14:34:46 -0000 Author: pluknet Date: Wed Jan 4 14:34:45 2012 New Revision: 229488 URL: http://svn.freebsd.org/changeset/base/229488 Log: MFC r227447: struct timespec32: change types of tv_sec and tv_nsec fields to signed to match native struct timespec ABI on __LP32__. Modified: stable/8/sys/compat/freebsd32/freebsd32.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32.h Wed Jan 4 14:33:54 2012 (r229487) +++ stable/8/sys/compat/freebsd32/freebsd32.h Wed Jan 4 14:34:45 2012 (r229488) @@ -52,8 +52,8 @@ struct timeval32 { } while (0) struct timespec32 { - u_int32_t tv_sec; - u_int32_t tv_nsec; + int32_t tv_sec; + int32_t tv_nsec; }; #define TS_CP(src,dst,fld) do { \ CP((src).fld,(dst).fld,tv_sec); \ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 14:49:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC2211065673; Wed, 4 Jan 2012 14:49:29 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA1C68FC0C; Wed, 4 Jan 2012 14:49:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04EnTw6082976; Wed, 4 Jan 2012 14:49:29 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EnTPi082974; Wed, 4 Jan 2012 14:49:29 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041449.q04EnTPi082974@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229490 - stable/8/lib/libc/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 14:49:30 -0000 Author: pluknet Date: Wed Jan 4 14:49:29 2012 New Revision: 229490 URL: http://svn.freebsd.org/changeset/base/229490 Log: MFC r227792: Add history for setsockopt(2). PR: docs/162719 Submitted by: Niclas Zeising Modified: stable/8/lib/libc/sys/getsockopt.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/sys/getsockopt.2 ============================================================================== --- stable/8/lib/libc/sys/getsockopt.2 Wed Jan 4 14:47:32 2012 (r229489) +++ stable/8/lib/libc/sys/getsockopt.2 Wed Jan 4 14:49:29 2012 (r229490) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd June 13, 2008 +.Dd November 21, 2011 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -515,7 +515,9 @@ on a non-listening socket was attempted. .Sh HISTORY The .Fn getsockopt -system call appeared in +and +.Fn setsockopt +system calls appeared in .Bx 4.2 . .Sh BUGS Several of the socket options should be handled at lower levels of the system. From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 15:59:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3D51106564A; Wed, 4 Jan 2012 15:59:49 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C14268FC16; Wed, 4 Jan 2012 15:59:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04Fxns4085284; Wed, 4 Jan 2012 15:59:49 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Fxnep085282; Wed, 4 Jan 2012 15:59:49 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041559.q04Fxnep085282@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 15:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229493 - in stable/8/sys: boot/common conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 15:59:49 -0000 Author: pluknet Date: Wed Jan 4 15:59:49 2012 New Revision: 229493 URL: http://svn.freebsd.org/changeset/base/229493 Log: MFC r228916: Clean up from the 4.x era. In an example of boot command: - rename wd(4) IDE disk drives name to ad(4). - update the used kernel path "/kernel" to the current default. Bump .Dd for this and previous changes. Modified: stable/8/sys/boot/common/loader.8 Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Wed Jan 4 15:58:35 2012 (r229492) +++ stable/8/sys/boot/common/loader.8 Wed Jan 4 15:59:49 2012 (r229493) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2009 +.Dd December 27, 2011 .Dt LOADER 8 .Os .Sh NAME @@ -933,10 +933,10 @@ autoboot 5 .Pp Set the disk unit of the root device to 2, and then boot. This would be needed in a system with two IDE disks, -with the second IDE disk hardwired to wd2 instead of wd1. +with the second IDE disk hardwired to ad2 instead of ad1. .Bd -literal -offset indent set root_disk_unit=2 -boot /kernel +boot /boot/kernel/kernel .Ed .Pp See also: From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 16:20:56 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8840C106564A; Wed, 4 Jan 2012 16:20:56 +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 74B708FC19; Wed, 4 Jan 2012 16:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04GKu1f086205; Wed, 4 Jan 2012 16:20:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GKupF086196; Wed, 4 Jan 2012 16:20:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041620.q04GKupF086196@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229497 - in stable/8/sys: conf modules modules/ipfw netinet/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 16:20:56 -0000 Author: jhb Date: Wed Jan 4 16:20:55 2012 New Revision: 229497 URL: http://svn.freebsd.org/changeset/base/229497 Log: MFC 225518,225793,227085: Allow the ipfw.ko module built with a kernel to honor any options defined in the kernel config. This more closely matches the behavior of other modules which inherit configuration settings from the kernel configuration during a kernel + modules build. Do not try to build the module in case of no INET support but keep #error calls for now in case we would compile it into the kernel. While here garbage collect unneeded opt_*.h includes. opt_ipdn.h is not used anywhere but we need to leave the DUMMYNET entry in options for conditional inclusion in kernel so keep the file with the same name. Modified: stable/8/sys/modules/Makefile stable/8/sys/modules/ipfw/Makefile stable/8/sys/netinet/ipfw/ip_fw2.c stable/8/sys/netinet/ipfw/ip_fw_dynamic.c stable/8/sys/netinet/ipfw/ip_fw_log.c stable/8/sys/netinet/ipfw/ip_fw_pfil.c stable/8/sys/netinet/ipfw/ip_fw_sockopt.c stable/8/sys/netinet/ipfw/ip_fw_table.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/modules/Makefile Wed Jan 4 16:20:55 2012 (r229497) @@ -134,7 +134,7 @@ SUBDIR= ${_3dfx} \ ${_io} \ ipdivert \ ${_ipfilter} \ - ipfw \ + ${_ipfw} \ ipfw_nat \ ${_ipmi} \ ip_mroute_mod \ @@ -366,6 +366,10 @@ _random= random _ipfilter= ipfilter .endif +.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_ipfw= ipfw +.endif + .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) _netgraph= netgraph .endif Modified: stable/8/sys/modules/ipfw/Makefile ============================================================================== --- stable/8/sys/modules/ipfw/Makefile Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/modules/ipfw/Makefile Wed Jan 4 16:20:55 2012 (r229497) @@ -8,7 +8,7 @@ KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c SRCS+= ip_fw_dynamic.c ip_fw_log.c SRCS+= ip_fw_sockopt.c ip_fw_table.c -SRCS+= opt_inet6.h opt_ipsec.h +SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h opt_ipsec.h CFLAGS+= -DIPFIREWALL CFLAGS+= -I${.CURDIR}/../../contrib/pf @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf # .if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + echo "#define INET 1" > ${.TARGET} +.endif .if ${MK_INET6_SUPPORT} != "no" opt_inet6.h: echo "#define INET6 1" > ${.TARGET} Modified: stable/8/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw2.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw2.c Wed Jan 4 16:20:55 2012 (r229497) @@ -30,15 +30,12 @@ __FBSDID("$FreeBSD$"); * The FreeBSD IP packet firewall, main file */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" #include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" #include "opt_ipsec.h" Modified: stable/8/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jan 4 16:20:55 2012 (r229497) @@ -33,17 +33,12 @@ __FBSDID("$FreeBSD$"); * Dynamic rule support for ipfw */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/8/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_log.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_log.c Wed Jan 4 16:20:55 2012 (r229497) @@ -30,17 +30,12 @@ __FBSDID("$FreeBSD$"); * Logging support for ipfw */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/8/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_pfil.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_pfil.c Wed Jan 4 16:20:55 2012 (r229497) @@ -27,15 +27,12 @@ #include __FBSDID("$FreeBSD$"); -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdn.h" #include "opt_inet.h" +#include "opt_inet6.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif /* KLD_MODULE */ -#include "opt_inet6.h" #include #include @@ -150,7 +147,7 @@ again: /* next_hop may be set by ipfw_chk */ if (args.next_hop == NULL) break; /* pass */ -#ifndef IPFIREWALL_FORWARD +#if !defined(IPFIREWALL_FORWARD) || (!defined(INET6) && !defined(INET)) ret = EACCES; #else { @@ -178,7 +175,7 @@ again: if (in_localip(args.next_hop->sin_addr)) (*m0)->m_flags |= M_FASTFWD_OURS; } -#endif +#endif /* IPFIREWALL_FORWARD */ break; case IP_FW_DENY: Modified: stable/8/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Wed Jan 4 16:20:55 2012 (r229497) @@ -33,17 +33,12 @@ __FBSDID("$FreeBSD$"); * the upper half of the ipfw code. */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_table.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_table.c Wed Jan 4 16:20:55 2012 (r229497) @@ -39,17 +39,12 @@ __FBSDID("$FreeBSD$"); * from userland, because operations are typically fast. */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 16:24:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFF10106566B; Wed, 4 Jan 2012 16:24:33 +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 C44F58FC08; Wed, 4 Jan 2012 16:24:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04GOX07086385; Wed, 4 Jan 2012 16:24:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GOXZA086384; Wed, 4 Jan 2012 16:24:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041624.q04GOXZA086384@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229498 - stable/8/sys/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 16:24:34 -0000 Author: jhb Date: Wed Jan 4 16:24:33 2012 New Revision: 229498 URL: http://svn.freebsd.org/changeset/base/229498 Log: Remove unnecessary mergeinfo from these two files. Modified: Directory Properties: stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 16:43:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3400106564A; Wed, 4 Jan 2012 16:43: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 8E7C28FC13; Wed, 4 Jan 2012 16:43:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04Gh955087207; Wed, 4 Jan 2012 16:43:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Gh9h9087191; Wed, 4 Jan 2012 16:43:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041643.q04Gh9h9087191@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229502 - in stable/8/sys/boot: i386/boot2 i386/btx/lib i386/common i386/libi386 pc98/boot2 pc98/btx/lib pc98/libpc98 pc98/loader X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 16:43:09 -0000 Author: jhb Date: Wed Jan 4 16:43:08 2012 New Revision: 229502 URL: http://svn.freebsd.org/changeset/base/229502 Log: MFC 226746: Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for the carry and zero flags being set, respectively, in and use them throughout the x86 boot code. Modified: stable/8/sys/boot/i386/boot2/boot2.c stable/8/sys/boot/i386/btx/lib/btxv86.h stable/8/sys/boot/i386/common/cons.c stable/8/sys/boot/i386/common/drv.c stable/8/sys/boot/i386/libi386/bioscd.c stable/8/sys/boot/i386/libi386/biosdisk.c stable/8/sys/boot/i386/libi386/biosmem.c stable/8/sys/boot/i386/libi386/biospci.c stable/8/sys/boot/i386/libi386/biossmap.c stable/8/sys/boot/i386/libi386/vidconsole.c stable/8/sys/boot/pc98/boot2/boot2.c stable/8/sys/boot/pc98/btx/lib/btxv86.h stable/8/sys/boot/pc98/libpc98/bioscd.c stable/8/sys/boot/pc98/libpc98/vidconsole.c stable/8/sys/boot/pc98/loader/main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:43:08 2012 (r229502) @@ -24,7 +24,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$"); #define NDEV 3 #define MEM_BASE 0x12 #define MEM_EXT 0x15 -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) #define DRV_HARD 0x80 #define DRV_MASK 0x7f Modified: stable/8/sys/boot/i386/btx/lib/btxv86.h ============================================================================== --- stable/8/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:43:08 2012 (r229502) @@ -21,6 +21,7 @@ #define _BTXV86_H_ #include +#include #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ @@ -57,6 +58,9 @@ extern u_int32_t __args; #define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) #define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + void __exit(int) __attribute__((__noreturn__)); void __exec(caddr_t, ...); Modified: stable/8/sys/boot/i386/common/cons.c ============================================================================== --- stable/8/sys/boot/i386/common/cons.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/common/cons.c Wed Jan 4 16:43:08 2012 (r229502) @@ -27,8 +27,6 @@ __FBSDID("$FreeBSD$"); #include "util.h" #include "cons.h" -#define V86_ZR(x) ((x) & PSL_Z) - #define SECOND 18 /* Circa that many ticks in a second. */ uint8_t ioctrl = IO_KEYBOARD; Modified: stable/8/sys/boot/i386/common/drv.c ============================================================================== --- stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:43:08 2012 (r229502) @@ -19,8 +19,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include "rbx.h" @@ -30,9 +28,6 @@ __FBSDID("$FreeBSD$"); #include "xreadorg.h" #endif -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) - #ifdef GPT uint64_t drvsize(struct dsk *dskp) Modified: stable/8/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:43:08 2012 (r229502) @@ -42,12 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include #include "libi386.h" #define BIOSCD_SECSIZE 2048 @@ -333,7 +333,7 @@ bc_read(int unit, daddr_t dblk, int blks v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); - result = (v86.efl & PSL_C); + result = V86_CY(v86.efl); if (result == 0) break; } Modified: stable/8/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:43:08 2012 (r229502) @@ -248,7 +248,7 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ if ((v86.ecx & 0x3f) == 0) { /* absurd sector size */ DEBUG("Invalid geometry for unit %d", bd->bd_unit); @@ -262,11 +262,11 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86.ebx = 0x55aa; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ (v86.ecx & 0x1)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; - if((v86.eax & 0xff00) >= 0x3000) + if ((v86.eax & 0xff00) >= 0x3000) bd->bd_flags |= BD_MODEEDD3; } return(1); @@ -560,7 +560,7 @@ bd_opendisk(struct open_disk **odp, stru return (ENOMEM); } - /* Look up BIOS unit number, intialise open_disk structure */ + /* Look up BIOS unit number, initalise open_disk structure */ od->od_dkunit = dev->d_unit; od->od_unit = bdinfo[od->od_dkunit].bd_unit; od->od_flags = bdinfo[od->od_dkunit].bd_flags; @@ -1148,7 +1148,7 @@ bd_edd_io(struct open_disk *od, daddr_t v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); - return (v86.efl & 0x1); + return (V86_CY(v86.efl)); } static int @@ -1181,7 +1181,7 @@ bd_chs_io(struct open_disk *od, daddr_t v86.es = VTOPSEG(dest); v86.ebx = VTOPOFF(dest); v86int(); - return (v86.efl & 0x1); + return (V86_CY(v86.efl)); } static int @@ -1309,7 +1309,7 @@ bd_getgeom(struct open_disk *od) v86.edx = od->od_unit; v86int(); - if ((v86.efl & 0x1) || /* carry set */ + if ((V86_CY(v86.efl)) || /* carry set */ ((v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f))) /* unit # bad */ return(1); @@ -1346,7 +1346,7 @@ bd_getbigeom(int bunit) v86.eax = 0x800; v86.edx = 0x80 + bunit; v86int(); - if (v86.efl & 0x1) + if (V86_CY(v86.efl)) return 0x4f010f; return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) | (v86.edx & 0xff00) | (v86.ecx & 0x3f); Modified: stable/8/sys/boot/i386/libi386/biosmem.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:43:08 2012 (r229502) @@ -61,7 +61,7 @@ bios_getmem(void) v86.es = VTOPSEG(&smap); v86.edi = VTOPOFF(&smap); v86int(); - if ((v86.efl & 1) || (v86.eax != SMAP_SIG)) + if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG)) break; /* look for a low-memory segment that's large enough */ if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) && @@ -108,7 +108,7 @@ bios_getmem(void) v86.addr = 0x15; /* int 0x15 function 0xe801*/ v86.eax = 0xe801; v86int(); - if (!(v86.efl & 1)) { + if (!(V86_CY(v86.efl))) { bios_extmem = ((v86.ecx & 0xffff) + ((v86.edx & 0xffff) * 64)) * 1024; } } Modified: stable/8/sys/boot/i386/libi386/biospci.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:43:08 2012 (r229502) @@ -218,7 +218,8 @@ biospci_enumerate(void) v86int(); /* Check for OK response */ - if ((v86.efl & 1) || ((v86.eax & 0xff00) != 0) || (v86.edx != 0x20494350)) + if (V86_CY(v86.efl) || ((v86.eax & 0xff00) != 0) || + (v86.edx != 0x20494350)) return; biospci_version = v86.ebx & 0xffff; @@ -295,7 +296,7 @@ biospci_find_devclass(uint32_t class, in v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); *locator = v86.ebx; @@ -317,7 +318,7 @@ biospci_write_config(uint32_t locator, i v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); return(0); @@ -334,7 +335,7 @@ biospci_read_config(uint32_t locator, in v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); *val = v86.ecx; Modified: stable/8/sys/boot/i386/libi386/biossmap.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:43:08 2012 (r229502) @@ -36,14 +36,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "bootstrap.h" #include "libi386.h" #include "btxv86.h" -#define V86_CY(x) ((x) & PSL_C) - struct smap_buf { struct bios_smap smap; uint32_t xattr; /* Extended attribute from ACPI 3.0 */ Modified: stable/8/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- stable/8/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:43:08 2012 (r229502) @@ -516,7 +516,7 @@ vidc_ischar(void) v86.addr = 0x16; v86.eax = 0x100; v86int(); - return (!(v86.efl & PSL_Z)); + return (!V86_ZR(v86.efl)); } #if KEYBOARD_PROBE Modified: stable/8/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:43:08 2012 (r229502) @@ -26,7 +26,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$"); #define ARGS 0x900 #define NOPT 14 #define NDEV 3 -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) #define DRV_DISK 0xf0 #define DRV_UNIT 0x0f Modified: stable/8/sys/boot/pc98/btx/lib/btxv86.h ============================================================================== --- stable/8/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:43:08 2012 (r229502) @@ -21,6 +21,7 @@ #define _BTXV86_H_ #include +#include #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ @@ -57,6 +58,9 @@ extern u_int32_t __args; #define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) #define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + void __exit(int) __attribute__((__noreturn__)); void __exec(caddr_t, ...); Modified: stable/8/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- stable/8/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:43:08 2012 (r229502) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -325,7 +324,7 @@ bc_read(int unit, daddr_t dblk, int blks v86.ebp = VTOPOFF(xp); v86.es = VTOPSEG(xp); v86int(); - result = (v86.efl & PSL_C); + result = V86_CY(v86.efl); if (result == 0) break; } Modified: stable/8/sys/boot/pc98/libpc98/vidconsole.c ============================================================================== --- stable/8/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:43:08 2012 (r229502) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "libi386.h" Modified: stable/8/sys/boot/pc98/loader/main.c ============================================================================== --- stable/8/sys/boot/pc98/loader/main.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/loader/main.c Wed Jan 4 16:43:08 2012 (r229502) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "bootstrap.h" From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 16:45:13 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEDB7106564A; Wed, 4 Jan 2012 16:45:12 +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 CB4D18FC08; Wed, 4 Jan 2012 16:45:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04GjCng087390; Wed, 4 Jan 2012 16:45:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GjCOn087383; Wed, 4 Jan 2012 16:45:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041645.q04GjCOn087383@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229504 - in stable/8/sys/boot/i386: common libi386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 16:45:13 -0000 Author: jhb Date: Wed Jan 4 16:45:12 2012 New Revision: 229504 URL: http://svn.freebsd.org/changeset/base/229504 Log: MFC 226748: - Add a new header for the x86 boot code that defines various structures and constants related to the BIOS Enhanced Disk Drive Specification. - Use this header instead of magic numbers and various duplicate structure definitions for doing I/O. - Use an actual structure for the request to fetch drive parameters in drvsize() rather than a gross hack of a char array with some magic size. While here, change drvsize() to only pass the 1.1 version of the structure and not request device path information. If we want device path information you have to set the length of the device path information as an input (along with probably checking the actual EDD version to see which size one should use as the device path information is variable-length). This fixes data smashing problems from passing an EDD 3 structure to BIOSes supporting EDD 4. Added: stable/8/sys/boot/i386/common/edd.h - copied unchanged from r226748, head/sys/boot/i386/common/edd.h Modified: stable/8/sys/boot/i386/common/drv.c stable/8/sys/boot/i386/libi386/Makefile stable/8/sys/boot/i386/libi386/bioscd.c stable/8/sys/boot/i386/libi386/biosdisk.c stable/8/sys/boot/i386/libi386/libi386.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/i386/common/drv.c ============================================================================== --- stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:45:12 2012 (r229504) @@ -24,43 +24,36 @@ __FBSDID("$FreeBSD$"); #include "rbx.h" #include "util.h" #include "drv.h" +#include "edd.h" #ifdef USE_XREAD #include "xreadorg.h" #endif #ifdef GPT +static struct edd_params params; + uint64_t drvsize(struct dsk *dskp) { - unsigned char params[0x42]; - uint64_t sectors; - - *(uint32_t *)params = sizeof(params); + params.len = sizeof(struct edd_params); v86.ctl = V86_FLAGS; v86.addr = 0x13; v86.eax = 0x4800; v86.edx = dskp->drive; - v86.ds = VTOPSEG(params); - v86.esi = VTOPOFF(params); + v86.ds = VTOPSEG(¶ms); + v86.esi = VTOPOFF(¶ms); v86int(); if (V86_CY(v86.efl)) { printf("error %u\n", v86.eax >> 8 & 0xff); return (0); } - memcpy(§ors, params + 0x10, sizeof(sectors)); - return (sectors); + return (params.sectors); } #endif /* GPT */ #ifndef USE_XREAD -static struct { - uint16_t len; - uint16_t count; - uint16_t off; - uint16_t seg; - uint64_t lba; -} packet; +static struct edd_packet packet; #endif int @@ -71,7 +64,7 @@ drvread(struct dsk *dskp, void *buf, dad if (!OPT_CHECK(RBX_QUIET)) printf("%c\b", c = c << 8 | c >> 24); #ifndef USE_XREAD - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); @@ -105,7 +98,7 @@ int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) { - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); Copied: stable/8/sys/boot/i386/common/edd.h (from r226748, head/sys/boot/i386/common/edd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/i386/common/edd.h Wed Jan 4 16:45:12 2012 (r229504, copy of r226748, head/sys/boot/i386/common/edd.h) @@ -0,0 +1,110 @@ +/*- + * Copyright (c) 2011 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _EDD_H_ +#define _EDD_H_ + +/* Supported interfaces for "Check Extensions Present". */ +#define EDD_INTERFACE_FIXED_DISK 0x01 +#define EDD_INTERFACE_EJECT 0x02 +#define EDD_INTERFACE_EDD 0x04 + +struct edd_packet { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; +}; + +struct edd_packet_v3 { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; + uint64_t phys_addr; +}; + +struct edd_params { + uint16_t len; + uint16_t flags; + uint32_t cylinders; + uint32_t heads; + uint32_t sectors_per_track; + uint64_t sectors; + uint16_t sector_size; + uint16_t edd_params_seg; + uint16_t edd_params_off; +}; + +struct edd_device_path_v3 { + uint16_t key; + uint8_t len; + uint8_t reserved[3]; + char host_bus[4]; + char interface[8]; + uint64_t interface_path; + uint64_t device_path; + uint8_t reserved2[1]; + uint8_t checksum; +}; + +struct edd_params_v3 { + struct edd_params params; + struct edd_device_path_v3 device_path; +}; + +struct edd_device_path_v4 { + uint16_t key; + uint8_t len; + uint8_t reserved[3]; + char host_bus[4]; + char interface[8]; + uint64_t interface_path; + uint64_t device_path[2]; + uint8_t reserved2[1]; + uint8_t checksum; +}; + +struct edd_params_v4 { + struct edd_params params; + struct edd_device_path_v4 device_path; +}; + +#define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001 +#define EDD_FLAGS_REMOVABLE_MEDIA 0x0002 +#define EDD_FLAGS_WRITE_VERIFY 0x0004 +#define EDD_FLAGS_MEDIA_CHANGE_NOTIFICATION 0x0008 +#define EDD_FLAGS_LOCKABLE_MEDIA 0x0010 +#define EDD_FLAGS_NO_MEDIA_PRESENT 0x0020 + +#define EDD_DEVICE_PATH_KEY 0xbedd + +#endif /* !_EDD_H_ */ Modified: stable/8/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/8/sys/boot/i386/libi386/Makefile Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/Makefile Wed Jan 4 16:45:12 2012 (r229504) @@ -47,7 +47,8 @@ CFLAGS+= -DTERM_EMU # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \ + -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica/include \ -I${.CURDIR}/../../.. -I. # the location of libstand Modified: stable/8/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:45:12 2012 (r229504) @@ -321,9 +321,9 @@ bc_read(int unit, daddr_t dblk, int blks v86int(); } - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = x; - packet.offset = VTOPOFF(xp); + packet.off = VTOPOFF(xp); packet.seg = VTOPSEG(xp); packet.lba = dblk; v86.ctl = V86_FLAGS; Modified: stable/8/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:45:12 2012 (r229504) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "libi386.h" #define BIOS_NUMDRIVES 0x475 @@ -264,7 +265,7 @@ bd_int13probe(struct bdinfo *bd) v86int(); if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ - (v86.ecx & 0x1)) { /* packets mode ok */ + (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; if ((v86.eax & 0xff00) >= 0x3000) bd->bd_flags |= BD_MODEEDD3; @@ -1132,9 +1133,9 @@ bd_edd_io(struct open_disk *od, daddr_t { static struct edd_packet packet; - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = blks; - packet.offset = VTOPOFF(dest); + packet.off = VTOPOFF(dest); packet.seg = VTOPSEG(dest); packet.lba = dblk; v86.ctl = V86_FLAGS; Modified: stable/8/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/8/sys/boot/i386/libi386/libi386.h Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/libi386.h Wed Jan 4 16:45:12 2012 (r229504) @@ -52,14 +52,6 @@ struct i386_devdesc } d_kind; }; -struct edd_packet { - uint16_t len; - uint16_t count; - uint16_t offset; - uint16_t seg; - uint64_t lba; -}; - int i386_getdev(void **vdev, const char *devspec, const char **path); char *i386_fmtdev(void *vdev); int i386_setcurrdev(struct env_var *ev, int flags, const void *value); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 16:51:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDF89106564A; Wed, 4 Jan 2012 16:51:04 +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 ABCAE8FC25; Wed, 4 Jan 2012 16:51:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04Gp4AD087661; Wed, 4 Jan 2012 16:51:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Gp4eD087658; Wed, 4 Jan 2012 16:51:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041651.q04Gp4eD087658@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229506 - in stable/8/sys: fs/devfs kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 16:51:04 -0000 Author: jhb Date: Wed Jan 4 16:51:04 2012 New Revision: 229506 URL: http://svn.freebsd.org/changeset/base/229506 Log: MFC 227069: Move the cleanup of f_cdevpriv when the reference count of a devfs file descriptor drops to zero out of _fdrop() and into devfs_close_f() as it is only relevant for devfs file descriptors. Modified: stable/8/sys/fs/devfs/devfs_vnops.c stable/8/sys/kern/kern_descrip.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Wed Jan 4 16:50:12 2012 (r229505) +++ stable/8/sys/fs/devfs/devfs_vnops.c Wed Jan 4 16:51:04 2012 (r229506) @@ -552,6 +552,13 @@ devfs_close_f(struct file *fp, struct th td->td_fpop = fp; error = vnops.fo_close(fp, td); td->td_fpop = fpop; + + /* + * The f_cdevpriv cannot be assigned non-NULL value while we + * are destroying the file. + */ + if (fp->f_cdevpriv != NULL) + devfs_fpdrop(fp); return (error); } Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Wed Jan 4 16:50:12 2012 (r229505) +++ stable/8/sys/kern/kern_descrip.c Wed Jan 4 16:51:04 2012 (r229506) @@ -2359,12 +2359,6 @@ _fdrop(struct file *fp, struct thread *t panic("fdrop: count %d", fp->f_count); if (fp->f_ops != &badfileops) error = fo_close(fp, td); - /* - * The f_cdevpriv cannot be assigned non-NULL value while we - * are destroying the file. - */ - if (fp->f_cdevpriv != NULL) - devfs_fpdrop(fp); atomic_subtract_int(&openfiles, 1); crfree(fp->f_cred); uma_zfree(file_zone, fp); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 17:25:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31C12106564A; Wed, 4 Jan 2012 17:25:42 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DDD28FC14; Wed, 4 Jan 2012 17:25:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04HPgJN088854; Wed, 4 Jan 2012 17:25:42 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04HPfPF088841; Wed, 4 Jan 2012 17:25:41 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201041725.q04HPfPF088841@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 4 Jan 2012 17:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229510 - in stable/8/sbin: hastctl hastd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 17:25:42 -0000 Author: trociny Date: Wed Jan 4 17:25:41 2012 New Revision: 229510 URL: http://svn.freebsd.org/changeset/base/229510 Log: MFC r219843, r225773, r225781, r225782, r225783, r225784, 225785, r225786, r225787, r225830, r225831, r225832, r225835, r226461, r226462, r226463, r226842, r226851, r226852, r226854, r226855, r226856, r226857, r226859, r226861, r228542, r228542, r228543, r228544, r228695, r228696: r219843 (pjd): Fix typo. r225773 (pjd): Ensure that pjdlog functions don't modify errno. r225781 (pjd): No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't modify errno. r225782 (pjd): Prefer PJDLOG_ASSERT() and PJDLOG_ABORT() over assert() and abort(). pjdlog versions will log problem to syslog when application is running in background. r225783 (pjd): Correct two mistakes when converting asserts to PJDLOG_ASSERT()/PJDLOG_ABORT(). r225784 (pjd): - Convert some impossible conditions into assertions. - Add missing 'if' in comment. r225785 (pjd): Prefer PJDLOG_ASSERT()/PJDLOG_ABORT() over assert(). r225786 (pjd): No need to wrap pjdlog functions around with KEEP_ERRNO() macro. r225787 (pjd): Use PJDLOG_ASSERT() and PJDLOG_ABORT() everywhere instead of assert(). r225830 (pjd): After every activemap change flush disk's write cache, so that write reordering won't make the actual write to be committed before marking the coresponding extent as dirty. It can be disabled in configuration file. If BIO_FLUSH is not supported by the underlying file system we log a warning and never send BIO_FLUSH again to that GEOM provider. r225831 (pjd): Break a bit earlier. r225832 (pjd): If the underlying provider doesn't support BIO_FLUSH, log it only once and don't bother trying in the future. r225835 (pjd): Correct typo. r226461 (pjd): When path to the configuration file is relative, obtain full path, so we can always find the file, even after daemonizing and changing working directory to /. r226462 (pjd): Remove redundant space. r226463 (pjd): Allow to specify pidfile in HAST configuration file. r226842 (pjd): Correct comments. r226851 (pjd): Delay resuid generation until first connection to secondary, not until first write. This way on first connection we will synchronize only the extents that were modified during the lifetime of primary node, not entire GEOM provider. r226852 (pjd): Minor cleanups. r226854 (pjd): - Eliminate the need for hio_nv. - Introduce hio_clear() function for clearing hio before returning it onto free queue. r226855 (pjd): Improve comment so it doesn't suggest race is possible, but that we handle the race. r226856 (pjd): Reduce indentation. r226857 (pjd): Minor cleanups. r226859 (pjd): Implement 'async' mode for HAST. r226861 (pjd): Remove redundant space. r228542 (pjd): Remove redundant setting of the error variable. Found by: Clang Static Analyzer r228543 (pjd): Simplify code by changing functions types from int to avoid, as the functions always return 0. Found by: Clang Static Analyzer r228544 (pjd): Remove redundant assignment. Found by: Clang Static Analyzer r228695 (pjd): Don't use function name as format string. Detected by: clang r228696 (pjd): Use lex's standard way of not generating unused function. Inspired by: r228555 Modified: stable/8/sbin/hastctl/hastctl.c stable/8/sbin/hastd/Makefile stable/8/sbin/hastd/activemap.c stable/8/sbin/hastd/control.c stable/8/sbin/hastd/ebuf.c stable/8/sbin/hastd/event.c stable/8/sbin/hastd/hast.conf.5 stable/8/sbin/hastd/hast.h stable/8/sbin/hastd/hast_checksum.c stable/8/sbin/hastd/hast_proto.c stable/8/sbin/hastd/hastd.c stable/8/sbin/hastd/hooks.c stable/8/sbin/hastd/metadata.c stable/8/sbin/hastd/nv.c stable/8/sbin/hastd/parse.y stable/8/sbin/hastd/pjdlog.c stable/8/sbin/hastd/pjdlog.h stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/proto_tcp.c stable/8/sbin/hastd/rangelock.c stable/8/sbin/hastd/secondary.c stable/8/sbin/hastd/subr.c stable/8/sbin/hastd/synch.h stable/8/sbin/hastd/token.l Directory Properties: stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastctl/hastctl.c Wed Jan 4 17:25:41 2012 (r229510) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -433,19 +432,19 @@ main(int argc, char *argv[]) pjdlog_debug_set(debug); cfg = yy_config_parse(cfgpath, true); - assert(cfg != NULL); + PJDLOG_ASSERT(cfg != NULL); switch (cmd) { case CMD_CREATE: control_create(argc, argv, mediasize, extentsize, keepdirty); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_DUMP: /* Dump metadata from local component of the given resource. */ control_dump(argc, argv); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_ROLE: /* Change role for the given resources. */ @@ -476,7 +475,7 @@ main(int argc, char *argv[]) } break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } /* Setup control connection... */ @@ -523,7 +522,7 @@ main(int argc, char *argv[]) error = control_status(nv); break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } exit(error); Modified: stable/8/sbin/hastd/Makefile ============================================================================== --- stable/8/sbin/hastd/Makefile Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/Makefile Wed Jan 4 17:25:41 2012 (r229510) @@ -27,9 +27,6 @@ CFLAGS+=-DINET .if ${MK_INET6_SUPPORT} != "no" CFLAGS+=-DINET6 .endif -# This is needed to have WARNS > 1. -CFLAGS+=-DYY_NO_UNPUT -CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL} LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil Modified: stable/8/sbin/hastd/activemap.c ============================================================================== --- stable/8/sbin/hastd/activemap.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/activemap.c Wed Jan 4 17:25:41 2012 (r229510) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include /* powerof2() */ #include -#include #include #include #include @@ -41,7 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include + +#include "activemap.h" + +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif #define ACTIVEMAP_MAGIC 0xac71e4 struct activemap { @@ -93,9 +99,9 @@ off2ext(const struct activemap *amp, off { int extent; - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); extent = (offset >> amp->am_extentshift); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); return (extent); } @@ -104,9 +110,9 @@ ext2off(const struct activemap *amp, int { off_t offset; - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); offset = ((off_t)extent << amp->am_extentshift); - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); return (offset); } @@ -122,7 +128,7 @@ ext2reqs(const struct activemap *amp, in if (ext < amp->am_nextents - 1) return (((amp->am_extentsize - 1) / MAXPHYS) + 1); - assert(ext == amp->am_nextents - 1); + PJDLOG_ASSERT(ext == amp->am_nextents - 1); left = amp->am_mediasize % amp->am_extentsize; if (left == 0) left = amp->am_extentsize; @@ -139,13 +145,13 @@ activemap_init(struct activemap **ampp, { struct activemap *amp; - assert(ampp != NULL); - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); - assert(keepdirty > 0); + PJDLOG_ASSERT(ampp != NULL); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); + PJDLOG_ASSERT(keepdirty > 0); amp = malloc(sizeof(*amp)); if (amp == NULL) @@ -225,10 +231,10 @@ keepdirty_add(struct activemap *amp, int */ if (amp->am_nkeepdirty >= amp->am_nkeepdirty_limit) { kd = TAILQ_LAST(&->am_keepdirty, skeepdirty); - assert(kd != NULL); + PJDLOG_ASSERT(kd != NULL); TAILQ_REMOVE(&->am_keepdirty, kd, kd_next); amp->am_nkeepdirty--; - assert(amp->am_nkeepdirty > 0); + PJDLOG_ASSERT(amp->am_nkeepdirty > 0); } if (kd == NULL) kd = malloc(sizeof(*kd)); @@ -261,7 +267,7 @@ keepdirty_free(struct activemap *amp) amp->am_nkeepdirty--; free(kd); } - assert(amp->am_nkeepdirty == 0); + PJDLOG_ASSERT(amp->am_nkeepdirty == 0); } /* @@ -271,7 +277,7 @@ void activemap_free(struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); amp->am_magic = 0; @@ -293,8 +299,8 @@ activemap_write_start(struct activemap * off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -307,7 +313,7 @@ activemap_write_start(struct activemap * * was modified and has to be flushed to disk. */ if (amp->am_memtab[ext]++ == 0) { - assert(!bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(!bit_test(amp->am_memmap, ext)); bit_set(amp->am_memmap, ext); amp->am_ndirty++; } @@ -329,8 +335,8 @@ activemap_write_complete(struct activema off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -342,8 +348,8 @@ activemap_write_complete(struct activema * By returning true we inform the caller that on-disk bitmap * was modified and has to be flushed to disk. */ - assert(amp->am_memtab[ext] > 0); - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(amp->am_memtab[ext] > 0); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); if (--amp->am_memtab[ext] == 0) { bit_clear(amp->am_memmap, ext); amp->am_ndirty--; @@ -365,15 +371,15 @@ activemap_extent_complete(struct activem bool modified; int reqs; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); modified = false; reqs = ext2reqs(amp, extent); - assert(amp->am_memtab[extent] >= reqs); + PJDLOG_ASSERT(amp->am_memtab[extent] >= reqs); amp->am_memtab[extent] -= reqs; - assert(bit_test(amp->am_memmap, extent)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, extent)); if (amp->am_memtab[extent] == 0) { bit_clear(amp->am_memmap, extent); amp->am_ndirty--; @@ -390,7 +396,7 @@ uint64_t activemap_ndirty(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_ndirty); } @@ -403,7 +409,7 @@ bool activemap_differ(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (memcmp(amp->am_diskmap, amp->am_memmap, amp->am_mapsize) != 0); @@ -416,7 +422,7 @@ size_t activemap_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_mapsize); } @@ -429,7 +435,7 @@ size_t activemap_ondisk_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_diskmapsize); } @@ -442,8 +448,8 @@ activemap_copyin(struct activemap *amp, { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); memcpy(amp->am_diskmap, buf, amp->am_mapsize); memcpy(amp->am_memmap, buf, amp->am_mapsize); @@ -481,8 +487,8 @@ activemap_merge(struct activemap *amp, c bitstr_t *remmap = __DECONST(bitstr_t *, buf); int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); bit_ffs(remmap, amp->am_nextents, &ext); if (ext == -1) { @@ -521,7 +527,7 @@ const unsigned char * activemap_bitmap(struct activemap *amp, size_t *sizep) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); if (sizep != NULL) *sizep = amp->am_diskmapsize; @@ -539,11 +545,11 @@ activemap_calc_ondisk_size(uint64_t medi { uint64_t nextents, mapsize; - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); nextents = ((mediasize - 1) / extentsize) + 1; mapsize = sizeof(bitstr_t) * bitstr_size(nextents); @@ -558,7 +564,7 @@ activemap_sync_rewind(struct activemap * { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); bit_ffs(amp->am_syncmap, amp->am_nextents, &ext); if (ext == -1) { @@ -581,9 +587,9 @@ activemap_sync_offset(struct activemap * off_t syncoff, left; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(lengthp != NULL); - assert(syncextp != NULL); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(lengthp != NULL); + PJDLOG_ASSERT(syncextp != NULL); *syncextp = -1; @@ -632,9 +638,10 @@ activemap_sync_offset(struct activemap * if (left > MAXPHYS) left = MAXPHYS; - assert(left >= 0 && left <= MAXPHYS); - assert(syncoff >= 0 && syncoff < amp->am_mediasize); - assert(syncoff + left >= 0 && syncoff + left <= amp->am_mediasize); + PJDLOG_ASSERT(left >= 0 && left <= MAXPHYS); + PJDLOG_ASSERT(syncoff >= 0 && syncoff < amp->am_mediasize); + PJDLOG_ASSERT(syncoff + left >= 0 && + syncoff + left <= amp->am_mediasize); *lengthp = left; return (syncoff); @@ -651,7 +658,7 @@ activemap_need_sync(struct activemap *am off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); modified = false; end = offset + length - 1; @@ -659,7 +666,7 @@ activemap_need_sync(struct activemap *am for (ext = off2ext(amp, offset); ext <= off2ext(amp, end); ext++) { if (bit_test(amp->am_syncmap, ext)) { /* Already marked for synchronization. */ - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); continue; } bit_set(amp->am_syncmap, ext); Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/control.c Wed Jan 4 17:25:41 2012 (r229510) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -82,8 +81,8 @@ control_set_role_common(struct hastd_con nv_add_string(nvout, name, "resource%u", no); if (res == NULL) { - assert(cfg != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(name != NULL); TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (strcmp(res->hr_name, name) == 0) @@ -94,7 +93,7 @@ control_set_role_common(struct hastd_con return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); /* Send previous role back. */ nv_add_string(nvout, role2str(res->hr_role), "role%u", no); @@ -222,9 +221,9 @@ control_status(struct hastd_config *cfg, struct hast_resource *res, const char *name, unsigned int no) { - assert(cfg != NULL); - assert(nvout != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(nvout != NULL); + PJDLOG_ASSERT(name != NULL); /* Name is always needed. */ nv_add_string(nvout, name, "resource%u", no); @@ -239,7 +238,7 @@ control_status(struct hastd_config *cfg, return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nv_add_string(nvout, res->hr_provname, "provname%u", no); nv_add_string(nvout, res->hr_localpath, "localpath%u", no); nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr%u", no); @@ -267,7 +266,7 @@ control_status(struct hastd_config *cfg, switch (res->hr_role) { case HAST_ROLE_PRIMARY: - assert(res->hr_workerpid != 0); + PJDLOG_ASSERT(res->hr_workerpid != 0); /* FALLTHROUGH */ case HAST_ROLE_SECONDARY: if (res->hr_workerpid != 0) @@ -313,7 +312,6 @@ control_handle(struct hastd_config *cfg) cmd = nv_get_uint8(nvin, "cmd"); if (cmd == 0) { pjdlog_error("Control header is missing 'cmd' field."); - error = EHAST_INVALID; goto close; } @@ -321,7 +319,6 @@ control_handle(struct hastd_config *cfg) nvout = nv_alloc(); if (nvout == NULL) { pjdlog_error("Unable to allocate header for control response."); - error = EHAST_NOMEMORY; goto close; } @@ -470,7 +467,7 @@ ctrl_thread(void *arg) * something related to us has changes, it sends reload * message to us. */ - assert(res->hr_role == HAST_ROLE_PRIMARY); + PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); primary_config_reload(res, nvin); nv_add_int16(nvout, 0, "error"); break; Modified: stable/8/sbin/hastd/ebuf.c ============================================================================== --- stable/8/sbin/hastd/ebuf.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/ebuf.c Wed Jan 4 17:25:41 2012 (r229510) @@ -32,15 +32,21 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include #include #include +#include + #include "ebuf.h" +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif + #define EBUF_MAGIC 0xeb0f41c struct ebuf { /* Magic to assert the caller uses valid structure. */ @@ -91,7 +97,7 @@ void ebuf_free(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); eb->eb_magic = 0; @@ -103,7 +109,7 @@ int ebuf_add_head(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_used - eb->eb_start)) { /* @@ -113,7 +119,7 @@ ebuf_add_head(struct ebuf *eb, const voi if (ebuf_head_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_used - eb->eb_start)); + PJDLOG_ASSERT(size <= (size_t)(eb->eb_used - eb->eb_start)); eb->eb_size += size; eb->eb_used -= size; @@ -130,7 +136,7 @@ int ebuf_add_tail(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))) { /* @@ -140,7 +146,8 @@ ebuf_add_tail(struct ebuf *eb, const voi if (ebuf_tail_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); + PJDLOG_ASSERT(size <= + (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); /* * If data is NULL the caller just wants to reserve space. @@ -156,8 +163,8 @@ void ebuf_del_head(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_used += size; eb->eb_size -= size; @@ -167,8 +174,8 @@ void ebuf_del_tail(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_size -= size; } @@ -180,7 +187,7 @@ void * ebuf_data(struct ebuf *eb, size_t *sizep) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (sizep != NULL) *sizep = eb->eb_size; @@ -194,7 +201,7 @@ size_t ebuf_size(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); return (eb->eb_size); } @@ -208,7 +215,7 @@ ebuf_head_extend(struct ebuf *eb, size_t unsigned char *newstart, *newused; size_t newsize; - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); newsize = eb->eb_end - eb->eb_start + (PAGE_SIZE / 4) + size; @@ -236,7 +243,7 @@ ebuf_tail_extend(struct ebuf *eb, size_t unsigned char *newstart; size_t newsize; - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); newsize = eb->eb_end - eb->eb_start + size + ((3 * PAGE_SIZE) / 4); Modified: stable/8/sbin/hastd/event.c ============================================================================== --- stable/8/sbin/hastd/event.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/event.c Wed Jan 4 17:25:41 2012 (r229510) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include "hast.h" @@ -46,8 +45,8 @@ event_send(const struct hast_resource *r struct nv *nvin, *nvout; int error; - assert(res != NULL); - assert(event >= EVENT_MIN && event <= EVENT_MAX); + PJDLOG_ASSERT(res != NULL); + PJDLOG_ASSERT(event >= EVENT_MIN && event <= EVENT_MAX); nvin = nvout = NULL; @@ -89,7 +88,7 @@ event_recv(const struct hast_resource *r uint8_t event; int error; - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nvin = nvout = NULL; Modified: stable/8/sbin/hastd/hast.conf.5 ============================================================================== --- stable/8/sbin/hastd/hast.conf.5 Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast.conf.5 Wed Jan 4 17:25:41 2012 (r229510) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2011 +.Dd October 27, 2011 .Dt HAST.CONF 5 .Os .Sh NAME @@ -63,17 +63,21 @@ checksum compression timeout exec +metaflush "on" | "off" +pidfile on { # Node section control listen + pidfile } on { # Node section control listen + pidfile } resource { @@ -85,12 +89,14 @@ resource { local timeout exec + metaflush "on" | "off" on { # Resource-node section name # Required local + metaflush "on" | "off" # Required remote source @@ -100,6 +106,7 @@ resource { name # Required local + metaflush "on" | "off" # Required remote source @@ -142,6 +149,14 @@ unix:///var/run/hastctl .Pp The default value is .Pa uds:///var/run/hastctl . +.It Ic pidfile Aq path +.Pp +File in which to store the process ID of the main +.Xr hastd 8 +process. +.Pp +The default value is +.Pa /var/run/hastd.pid . .It Ic listen Aq addr .Pp Address to listen on in form of: @@ -209,9 +224,6 @@ completes. This is the fastest and the most dangerous replication mode. This mode should be used when replicating to a distant node where latency is too high for other modes. -The -.Ic async -replication mode is currently not implemented. .El .It Ic checksum Aq algorithm .Pp @@ -318,6 +330,25 @@ It can be one of: .Ar secondary , .Ar primary . .Pp +.It Ic metaflush on | off +.Pp +When set to +.Va on , +flush write cache of the local provider after every metadata (activemap) update. +Flushing write cache ensures that provider will not reorder writes and that +metadata will be properly updated before real data is stored. +If the local provider does not support flushing write cache (it returns +.Er EOPNOTSUPP +on the +.Cm BIO_FLUSH +request), +.Nm hastd +will disable +.Ic metaflush +automatically. +The default value is +.Va on . +.Pp .It Ic name Aq name .Pp GEOM provider name that will appear as Modified: stable/8/sbin/hastd/hast.h ============================================================================== --- stable/8/sbin/hastd/hast.h Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast.h Wed Jan 4 17:25:41 2012 (r229510) @@ -111,11 +111,13 @@ struct hastd_listen { struct hastd_config { /* Address to communicate with hastctl(8). */ - char hc_controladdr[HAST_ADDRSIZE]; + char hc_controladdr[HAST_ADDRSIZE]; /* Protocol-specific data. */ struct proto_conn *hc_controlconn; /* Incoming control connection. */ struct proto_conn *hc_controlin; + /* PID file path. */ + char hc_pidfile[PATH_MAX]; /* List of addresses to listen on. */ TAILQ_HEAD(, hastd_listen) hc_listen; /* List of resources. */ @@ -167,6 +169,10 @@ struct hast_resource { off_t hr_local_mediasize; /* Sector size of local provider. */ unsigned int hr_local_sectorsize; + /* Is flushing write cache supported by the local provider? */ + bool hr_localflush; + /* Flush write cache on metadata updates? */ + int hr_metaflush; /* Descriptor for /dev/ggctl communication. */ int hr_ggatefd; Modified: stable/8/sbin/hastd/hast_checksum.c ============================================================================== --- stable/8/sbin/hastd/hast_checksum.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast_checksum.c Wed Jan 4 17:25:41 2012 (r229510) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #define MAX_HASH_SIZE 4 #endif -static int +static void hast_crc32_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -58,12 +58,10 @@ hast_crc32_checksum(const unsigned char /* XXXPJD: Do we have to use htole32() on crc first? */ bcopy(&crc, hash, sizeof(crc)); *hsizep = sizeof(crc); - - return (0); } #ifdef HAVE_CRYPTO -static int +static void hast_sha256_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -73,8 +71,6 @@ hast_sha256_checksum(const unsigned char SHA256_Update(&ctx, data, size); SHA256_Final(hash, &ctx); *hsizep = SHA256_DIGEST_LENGTH; - - return (0); } #endif /* HAVE_CRYPTO */ @@ -99,25 +95,21 @@ checksum_send(const struct hast_resource { unsigned char hash[MAX_HASH_SIZE]; size_t hsize; - int ret; switch (res->hr_checksum) { case HAST_CHECKSUM_NONE: return (0); case HAST_CHECKSUM_CRC32: - ret = hast_crc32_checksum(*datap, *sizep, hash, &hsize); + hast_crc32_checksum(*datap, *sizep, hash, &hsize); break; #ifdef HAVE_CRYPTO case HAST_CHECKSUM_SHA256: - ret = hast_sha256_checksum(*datap, *sizep, hash, &hsize); + hast_sha256_checksum(*datap, *sizep, hash, &hsize); break; #endif default: PJDLOG_ABORT("Invalid checksum: %d.", res->hr_checksum); } - - if (ret != 0) - return (ret); nv_add_string(nv, checksum_name(res->hr_checksum), "checksum"); nv_add_uint8_array(nv, hash, hsize, "hash"); if (nv_error(nv) != 0) { @@ -135,7 +127,6 @@ checksum_recv(const struct hast_resource const unsigned char *rhash; size_t chsize, rhsize; const char *algo; - int ret; algo = nv_get_string(nv, "checksum"); if (algo == NULL) @@ -146,10 +137,10 @@ checksum_recv(const struct hast_resource return (-1); /* Hash not found. */ } if (strcmp(algo, "crc32") == 0) - ret = hast_crc32_checksum(*datap, *sizep, chash, &chsize); + hast_crc32_checksum(*datap, *sizep, chash, &chsize); #ifdef HAVE_CRYPTO else if (strcmp(algo, "sha256") == 0) - ret = hast_sha256_checksum(*datap, *sizep, chash, &chsize); + hast_sha256_checksum(*datap, *sizep, chash, &chsize); #endif else { pjdlog_error("Unknown checksum algorithm '%s'.", algo); Modified: stable/8/sbin/hastd/hast_proto.c ============================================================================== --- stable/8/sbin/hastd/hast_proto.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast_proto.c Wed Jan 4 17:25:41 2012 (r229510) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include @@ -158,7 +157,7 @@ hast_proto_recv_hdr(const struct proto_c if (ebuf_add_tail(eb, NULL, hdr.size) < 0) goto fail; hptr = ebuf_data(eb, NULL); - assert(hptr != NULL); + PJDLOG_ASSERT(hptr != NULL); if (proto_recv(conn, hptr, hdr.size) < 0) goto fail; nv = nv_ntoh(eb); @@ -183,8 +182,8 @@ hast_proto_recv_data(const struct hast_r void *dptr; int ret; - assert(data != NULL); - assert(size > 0); + PJDLOG_ASSERT(data != NULL); + PJDLOG_ASSERT(size > 0); ret = -1; freedata = false; Modified: stable/8/sbin/hastd/hastd.c ============================================================================== --- stable/8/sbin/hastd/hastd.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hastd.c Wed Jan 4 17:25:41 2012 (r229510) @@ -386,6 +386,12 @@ resource_needs_restart(const struct hast return (true); if (strcmp(res0->hr_exec, res1->hr_exec) != 0) return (true); + /* + * When metaflush has changed we don't really need restart, + * but it is just easier this way. + */ + if (res0->hr_metaflush != res1->hr_metaflush) + return (true); } return (false); } @@ -416,6 +422,8 @@ resource_needs_reload(const struct hast_ return (true); if (strcmp(res0->hr_exec, res1->hr_exec) != 0) return (true); + if (res0->hr_metaflush != res1->hr_metaflush) + return (true); return (false); } @@ -436,6 +444,7 @@ resource_reload(const struct hast_resour nv_add_int32(nvout, (int32_t)res->hr_compression, "compression"); nv_add_int32(nvout, (int32_t)res->hr_timeout, "timeout"); nv_add_string(nvout, res->hr_exec, "exec"); + nv_add_int32(nvout, (int32_t)res->hr_metaflush, "metaflush"); if (nv_error(nvout) != 0) { nv_free(nvout); pjdlog_error("Unable to allocate header for reload message."); @@ -467,11 +476,15 @@ hastd_reload(void) struct hastd_config *newcfg; struct hast_resource *nres, *cres, *tres; struct hastd_listen *nlst, *clst; + struct pidfh *newpfh; unsigned int nlisten; uint8_t role; + pid_t otherpid; pjdlog_info("Reloading configuration..."); + newpfh = NULL; + newcfg = yy_config_parse(cfgpath, false); if (newcfg == NULL) goto failed; @@ -515,6 +528,31 @@ hastd_reload(void) pjdlog_error("No addresses to listen on."); goto failed; } + /* + * Check if pidfile's path has changed. + */ + if (strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { + newpfh = pidfile_open(newcfg->hc_pidfile, 0600, &otherpid); + if (newpfh == NULL) { + if (errno == EEXIST) { + pjdlog_errno(LOG_WARNING, + "Another hastd is already running, pidfile: %s, pid: %jd.", + newcfg->hc_pidfile, (intmax_t)otherpid); + } else { + pjdlog_errno(LOG_WARNING, + "Unable to open or create pidfile %s", + newcfg->hc_pidfile); + } + } else if (pidfile_write(newpfh) < 0) { + /* Write PID to a file. */ + pjdlog_errno(LOG_WARNING, + "Unable to write PID to file %s", + newcfg->hc_pidfile); + } else { + pjdlog_debug(1, "PID stored in %s.", + newcfg->hc_pidfile); + } + } /* No failures from now on. */ @@ -531,6 +569,13 @@ hastd_reload(void) sizeof(cfg->hc_controladdr)); } /* + * Switch to new pidfile. + */ + (void)pidfile_remove(pfh); + pfh = newpfh; + (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, + sizeof(cfg->hc_pidfile)); + /* * Switch to new listen addresses. Close all that were removed. */ while ((clst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) { @@ -591,12 +636,13 @@ hastd_reload(void) * recreating it. * * We do just reload (send SIGHUP to worker process) if we act as - * PRIMARY, but only if remote address, replication mode, timeout or - * execution path has changed. For those, there is no need to restart - * worker process. + * PRIMARY, but only if remote address, source address, replication + * mode, timeout, execution path or metaflush has changed. + * For those, there is no need to restart worker process. * If PRIMARY receives SIGHUP, it will reconnect if remote address or - * replication mode has changed or simply set new timeout if only - * timeout has changed. + * source address has changed or it will set new timeout if only timeout + * has changed or it will update metaflush if only metaflush has + * changed. */ TAILQ_FOREACH_SAFE(nres, &newcfg->hc_resources, hr_next, tres) { TAILQ_FOREACH(cres, &cfg->hc_resources, hr_next) { @@ -627,6 +673,7 @@ hastd_reload(void) cres->hr_timeout = nres->hr_timeout; strlcpy(cres->hr_exec, nres->hr_exec, sizeof(cres->hr_exec)); + cres->hr_metaflush = nres->hr_metaflush; if (cres->hr_workerpid != 0) resource_reload(cres); } @@ -655,6 +702,8 @@ failed: } yy_config_free(newcfg); } + if (newpfh != NULL) + (void)pidfile_remove(newpfh); pjdlog_warning("Configuration not reloaded."); } @@ -1112,7 +1161,7 @@ main(int argc, char *argv[]) foreground = false; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 19:50:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC69D1065672; Wed, 4 Jan 2012 19:50:11 +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 7FB0A8FC12; Wed, 4 Jan 2012 19:50:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04JoBvZ093560; Wed, 4 Jan 2012 19:50:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04JoBSY093556; Wed, 4 Jan 2012 19:50:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201041950.q04JoBSY093556@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 4 Jan 2012 19:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229514 - in stable/8: share/mk tools/build/options X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 19:50:11 -0000 Author: bz Date: Wed Jan 4 19:50:10 2012 New Revision: 229514 URL: http://svn.freebsd.org/changeset/base/229514 Log: MFC r221266: Introduce two new options MK_INET and MK_INET_SUPPORT analogically with INET6 equivalents. Added: stable/8/tools/build/options/WITHOUT_INET - copied unchanged from r221266, head/tools/build/options/WITHOUT_INET stable/8/tools/build/options/WITHOUT_INET_SUPPORT - copied unchanged from r221266, head/tools/build/options/WITHOUT_INET_SUPPORT Modified: stable/8/share/mk/bsd.own.mk Directory Properties: stable/8/share/mk/ (props changed) stable/8/tools/build/options/ (props changed) Modified: stable/8/share/mk/bsd.own.mk ============================================================================== --- stable/8/share/mk/bsd.own.mk Wed Jan 4 19:43:53 2012 (r229513) +++ stable/8/share/mk/bsd.own.mk Wed Jan 4 19:50:10 2012 (r229514) @@ -325,6 +325,7 @@ WITH_IDEA= GPIB \ GROFF \ HTML \ + INET \ INET6 \ INFO \ INSTALLLIB \ @@ -500,6 +501,7 @@ MK_GDB:= no .for var in \ BZIP2 \ GNU \ + INET \ INET6 \ IPX \ KERBEROS \ Copied: stable/8/tools/build/options/WITHOUT_INET (from r221266, head/tools/build/options/WITHOUT_INET) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/build/options/WITHOUT_INET Wed Jan 4 19:50:10 2012 (r229514, copy of r221266, head/tools/build/options/WITHOUT_INET) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build programs and libraries related to IPv4 networking. Copied: stable/8/tools/build/options/WITHOUT_INET_SUPPORT (from r221266, head/tools/build/options/WITHOUT_INET_SUPPORT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/build/options/WITHOUT_INET_SUPPORT Wed Jan 4 19:50:10 2012 (r229514, copy of r221266, head/tools/build/options/WITHOUT_INET_SUPPORT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build libraries, programs, and kernel modules without IPv4 support. From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 19:53:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F28A7106566C; Wed, 4 Jan 2012 19:53:32 +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 E098D8FC0A; Wed, 4 Jan 2012 19:53:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04JrWdl093690; Wed, 4 Jan 2012 19:53:32 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04JrW9g093688; Wed, 4 Jan 2012 19:53:32 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201041953.q04JrW9g093688@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 4 Jan 2012 19:53:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229515 - stable/8/share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 19:53:33 -0000 Author: bz Date: Wed Jan 4 19:53:32 2012 New Revision: 229515 URL: http://svn.freebsd.org/changeset/base/229515 Log: Regen src.conf(5) after merge of WITHOUT_INET{,_SUPPORT} in r229514. Modified: stable/8/share/man/man5/src.conf.5 Modified: stable/8/share/man/man5/src.conf.5 ============================================================================== --- stable/8/share/man/man5/src.conf.5 Wed Jan 4 19:50:10 2012 (r229514) +++ stable/8/share/man/man5/src.conf.5 Wed Jan 4 19:53:32 2012 (r229515) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: stable/8/tools/build/options/makeman 188848 2009-02-20 11:09:55Z mtm .\" $FreeBSD$ -.Dd May 25, 2010 +.Dd January 4, 2012 .Dt SRC.CONF 5 .Os .Sh NAME @@ -368,6 +368,15 @@ This code is patented in the USA and man It is .Em "YOUR RESPONSIBILITY" to determine if you can legally use IDEA. +.It Va WITHOUT_INET +.\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET 229514 2012-01-04 19:50:10Z bz +Set to not build programs and libraries related to IPv4 networking. +When set, it also enforces the following options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_INET_SUPPORT +.El .It Va WITHOUT_INET6 .\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET6 156932 2006-03-21 07:50:50Z ru Set to not build @@ -381,6 +390,9 @@ When set, it also enforces the following .It Va WITHOUT_INET6_SUPPORT .\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET6_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build libraries, programs, and kernel modules without IPv6 support. +.It Va WITHOUT_INET_SUPPORT +.\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET_SUPPORT 229514 2012-01-04 19:50:10Z bz +Set to build libraries, programs, and kernel modules without IPv4 support. .It Va WITHOUT_INFO .\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INFO 156932 2006-03-21 07:50:50Z ru Set to not make or install From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 21:27:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD4C7106566B; Wed, 4 Jan 2012 21:27: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 BB3F38FC08; Wed, 4 Jan 2012 21:27:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04LR3UU097041; Wed, 4 Jan 2012 21:27:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LR37w097039; Wed, 4 Jan 2012 21:27:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042127.q04LR37w097039@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229522 - stable/8/sys/dev/ae X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 21:27:04 -0000 Author: yongari Date: Wed Jan 4 21:27:03 2012 New Revision: 229522 URL: http://svn.freebsd.org/changeset/base/229522 Log: MFC r227452: To send a frame, controller requires a prepended TX header and the length of frame should be treated as multiple of 4. Actual frame length is set in the TX header. The TX header position should be aligned on 4 byte boundary and actual frame start position should be aligned on 4 byte boundary as well. This means we need 4(TX header length) + 3(frame length fixup) additional free space in TX buffer in addition to actual frame length. Make sure TX handler check these additional bytes. ae_tx_avail_size() returns actual free space in TX buffer to ease the calculation of available TX buffer space in caller. While I'm here, replace magic number to appropriate sizeof operator to enhance readability. This change should fix controller lockup issue happened under certain conditions but it still does not fix watchdog timeout. It seems the watchdog timeout is side-effect of TxS and TxD mismatches. The root cause of TxD/TxD mismatch is not known yet but it looks like silicon bug. I guess driver may have to reinitialize controller whenever it sees TxS and TxD mismatches but leave it as it was at this moment. PR: kern/145918 Modified: stable/8/sys/dev/ae/if_ae.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ae/if_ae.c ============================================================================== --- stable/8/sys/dev/ae/if_ae.c Wed Jan 4 21:26:47 2012 (r229521) +++ stable/8/sys/dev/ae/if_ae.c Wed Jan 4 21:27:03 2012 (r229522) @@ -1432,7 +1432,7 @@ ae_tx_avail_size(ae_softc_t *sc) else avail = sc->txd_ack - sc->txd_cur; - return (avail - 4); /* 4-byte header. */ + return (avail); } static int @@ -1449,7 +1449,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m len = m0->m_pkthdr.len; if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || - ae_tx_avail_size(sc) < len) { + len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { #ifdef AE_DEBUG if_printf(sc->ifp, "No free Tx available.\n"); #endif @@ -1458,11 +1458,10 @@ ae_encap(ae_softc_t *sc, struct mbuf **m hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur); bzero(hdr, sizeof(*hdr)); - sc->txd_cur = (sc->txd_cur + 4) % AE_TXD_BUFSIZE_DEFAULT; /* Header - size. */ - to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; /* Space available to - * the end of the ring - */ + /* Skip header size. */ + sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT; + /* Space available to the end of the ring */ + to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; if (to_end >= len) { m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur)); } else { @@ -1841,8 +1840,8 @@ ae_tx_intr(ae_softc_t *sc) /* * Move txd ack and align on 4-byte boundary. */ - sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + 4 + 3) & ~3) % - AE_TXD_BUFSIZE_DEFAULT; + sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + + sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; if ((flags & AE_TXS_SUCCESS) != 0) ifp->if_opackets++; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 21:52:56 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB5FE106564A; Wed, 4 Jan 2012 21:52:56 +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 C83F38FC08; Wed, 4 Jan 2012 21:52:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04Lquwl097998; Wed, 4 Jan 2012 21:52:56 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Lqug9097995; Wed, 4 Jan 2012 21:52:56 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042152.q04Lqug9097995@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:52:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229525 - stable/8/sys/dev/msk X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 21:52:57 -0000 Author: yongari Date: Wed Jan 4 21:52:56 2012 New Revision: 229525 URL: http://svn.freebsd.org/changeset/base/229525 Log: MFC r227582: Enable 64bit DMA addressing support for all msk(4) controllers. Unnecessarily complex LE format used on Marvell controller was main reason not to enable 64bit DMA addressing in driver. If high 32bit address of DMA address of TX/RX buffer is changed, driver has to generate a new LE. In TX path, driver will keep track of lastly used high 32bit address of DMA address and generate a new LE whenever it sees high address change in the DMA address. In RX path, driver will always use two LEs to specify 64bit DMA address of RX buffer. If the high 32bit address of DMA address of RX buffer is the same as previous DMA address of RX buffer, driver does not have to use two LEs but driver will use two LEs for simplicity in RX ring management. One of draw back for switching to 64bit DMA addressing is that the large amount of LEs are used to specify 64bit DMA address such that number of available LEs for TX/RX buffers are considerably reduced. To mitigate the issue, increase number of available LEs from 256 to 384 for TX and from 256 to 512 for RX. For 32bit architectures, msk(4) does not use 64bit DMA addressing to save resources. Modified: stable/8/sys/dev/msk/if_msk.c stable/8/sys/dev/msk/if_mskreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/msk/if_msk.c ============================================================================== --- stable/8/sys/dev/msk/if_msk.c Wed Jan 4 21:50:59 2012 (r229524) +++ stable/8/sys/dev/msk/if_msk.c Wed Jan 4 21:52:56 2012 (r229525) @@ -700,7 +700,7 @@ msk_init_rx_ring(struct msk_if_softc *sc { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -710,11 +710,18 @@ msk_init_rx_ring(struct msk_if_softc *sc rd = &sc_if->msk_rdata; bzero(rd->msk_rx_ring, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_rx_ring[prod]; + MSK_INC(prod, MSK_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; @@ -723,15 +730,21 @@ msk_init_rx_ring(struct msk_if_softc *sc rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - i++; - } - for (; i < MSK_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_RX_RING_CNT); + MSK_RX_INC(prod, MSK_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_rx_ring_tag, @@ -739,10 +752,11 @@ msk_init_rx_ring(struct msk_if_softc *sc BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Update prefetch unit. */ - sc_if->msk_cdata.msk_rx_prod = MSK_RX_RING_CNT - 1; + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_RX_RING_CNT - 1) % + MSK_RX_RING_CNT); if (msk_rx_fill(sc_if, 0) != 0) return (ENOBUFS); return (0); @@ -753,7 +767,7 @@ msk_init_jumbo_rx_ring(struct msk_if_sof { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -764,11 +778,18 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rd = &sc_if->msk_rdata; bzero(rd->msk_jumbo_rx_ring, sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_JUMBO_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; @@ -777,25 +798,33 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - i++; - } - for (; i < MSK_JUMBO_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_jumbo_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(prod, MSK_JUMBO_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - sc_if->msk_cdata.msk_rx_prod = MSK_JUMBO_RX_RING_CNT - 1; + /* Update prefetch unit. */ + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_JUMBO_RX_RING_CNT - 1) % + MSK_JUMBO_RX_RING_CNT); if (msk_rx_fill(sc_if, 1) != 0) return (ENOBUFS); return (0); @@ -813,6 +842,7 @@ msk_init_tx_ring(struct msk_if_softc *sc sc_if->msk_cdata.msk_tx_prod = 0; sc_if->msk_cdata.msk_tx_cons = 0; sc_if->msk_cdata.msk_tx_cnt = 0; + sc_if->msk_cdata.msk_tx_high_addr = 0; rd = &sc_if->msk_rdata; bzero(rd->msk_tx_ring, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT); @@ -834,6 +864,12 @@ msk_discard_rxbuf(struct msk_if_softc *s struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -847,6 +883,12 @@ msk_discard_jumbo_rxbuf(struct msk_if_so struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -884,10 +926,18 @@ msk_newbuf(struct msk_if_softc *sc_if, i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_rx_sparemap; @@ -937,11 +987,19 @@ msk_jumbo_newbuf(struct msk_if_softc *sc KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_jumbo_rx_sparemap; @@ -1472,7 +1530,7 @@ mskc_reset(struct msk_softc *sc) /* Clear status list. */ bzero(sc->msk_stat_ring, - sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT); + sizeof(struct msk_stat_desc) * sc->msk_stat_count); sc->msk_stat_cons = 0; bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -1483,7 +1541,7 @@ mskc_reset(struct msk_softc *sc) CSR_WRITE_4(sc, STAT_LIST_ADDR_LO, MSK_ADDR_LO(addr)); CSR_WRITE_4(sc, STAT_LIST_ADDR_HI, MSK_ADDR_HI(addr)); /* Set the status list last index. */ - CSR_WRITE_2(sc, STAT_LAST_IDX, MSK_STAT_RING_CNT - 1); + CSR_WRITE_2(sc, STAT_LAST_IDX, sc->msk_stat_count - 1); if (sc->msk_hw_id == CHIP_ID_YUKON_EC && sc->msk_hw_rev == CHIP_REV_YU_EC_A1) { /* WA for dev. #4.3 */ @@ -2084,17 +2142,29 @@ static int msk_status_dma_alloc(struct msk_softc *sc) { struct msk_dmamap_arg ctx; - int error; + bus_size_t stat_sz; + int count, error; + /* + * It seems controller requires number of status LE entries + * is power of 2 and the maximum number of status LE entries + * is 4096. For dual-port controllers, the number of status + * LE entries should be large enough to hold both port's + * status updates. + */ + count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT; + count = imin(4096, roundup2(count, 1024)); + sc->msk_stat_count = count; + stat_sz = count * sizeof(struct msk_stat_desc); error = bus_dma_tag_create( bus_get_dma_tag(sc->msk_dev), /* parent */ MSK_STAT_ALIGN, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MSK_STAT_RING_SZ, /* maxsize */ + stat_sz, /* maxsize */ 1, /* nsegments */ - MSK_STAT_RING_SZ, /* maxsegsize */ + stat_sz, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->msk_stat_tag); @@ -2115,9 +2185,8 @@ msk_status_dma_alloc(struct msk_softc *s } ctx.msk_busaddr = 0; - error = bus_dmamap_load(sc->msk_stat_tag, - sc->msk_stat_map, sc->msk_stat_ring, MSK_STAT_RING_SZ, - msk_dmamap_cb, &ctx, 0); + error = bus_dmamap_load(sc->msk_stat_tag, sc->msk_stat_map, + sc->msk_stat_ring, stat_sz, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->msk_dev, "failed to load DMA'able memory for status ring\n"); @@ -2158,27 +2227,10 @@ msk_txrx_dma_alloc(struct msk_if_softc * int error, i; /* Create parent DMA tag. */ - /* - * XXX - * It seems that Yukon II supports full 64bits DMA operations. But - * it needs two descriptors(list elements) for 64bits DMA operations. - * Since we don't know what DMA address mappings(32bits or 64bits) - * would be used in advance for each mbufs, we limits its DMA space - * to be in range of 32bits address space. Otherwise, we should check - * what DMA address is used and chain another descriptor for the - * 64bits DMA operation. This also means descriptor ring size is - * variable. Limiting DMA address to be in 32bit address space greatly - * simplifies descriptor handling and possibly would increase - * performance a bit due to efficient handling of descriptors. - * Apart from harassing checksum offloading mechanisms, it seems - * it's really bad idea to use a separate descriptor for 64bit - * DMA operation to save small descriptor memory. Anyway, I've - * never seen these exotic scheme on ethernet interface hardware. - */ error = bus_dma_tag_create( bus_get_dma_tag(sc_if->msk_if_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -2284,7 +2336,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_tx_ring_tag, sc_if->msk_cdata.msk_tx_ring_map, sc_if->msk_rdata.msk_tx_ring, - MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Tx ring\n"); @@ -2305,7 +2357,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_rx_ring_tag, sc_if->msk_cdata.msk_rx_ring_map, sc_if->msk_rdata.msk_rx_ring, - MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Rx ring\n"); @@ -2422,7 +2474,7 @@ msk_rx_dma_jalloc(struct msk_if_softc *s error = bus_dmamap_load(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, sc_if->msk_rdata.msk_jumbo_rx_ring, MSK_JUMBO_RX_RING_SZ, - msk_dmamap_cb, &ctx, 0); + msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for jumbo Rx ring\n"); @@ -2782,6 +2834,18 @@ msk_encap(struct msk_if_softc *sc_if, st } } +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[0].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[0].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = htole32(MSK_ADDR_HI(txsegs[0].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + } +#endif si = prod; tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[0].ds_addr)); @@ -2796,6 +2860,20 @@ msk_encap(struct msk_if_softc *sc_if, st for (i = 1; i < nseg; i++) { tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[i].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[i].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = + htole32(MSK_ADDR_HI(txsegs[i].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + } +#endif tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[i].ds_addr)); tx_le->msk_control = htole32(txsegs[i].ds_len | control | OP_BUFFER | HW_OWNER); @@ -3148,7 +3226,12 @@ msk_rxeof(struct msk_if_softc *sc_if, ui msk_discard_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[(cons + 1) % + MSK_RX_RING_CNT]; +#else rxd = &sc_if->msk_cdata.msk_rxdesc[cons]; +#endif m = rxd->rx_m; if (msk_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3176,8 +3259,8 @@ msk_rxeof(struct msk_if_softc *sc_if, ui MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); } static void @@ -3208,7 +3291,12 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ msk_discard_jumbo_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[(cons + 1) % + MSK_JUMBO_RX_RING_CNT]; +#else jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[cons]; +#endif m = jrxd->rx_m; if (msk_jumbo_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3236,8 +3324,8 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); } static void @@ -3582,7 +3670,7 @@ msk_handle_events(struct msk_softc *sc) control & STLE_OP_MASK); break; } - MSK_INC(cons, MSK_STAT_RING_CNT); + MSK_INC(cons, sc->msk_stat_count); if (rxprog > sc->msk_process_limit) break; } Modified: stable/8/sys/dev/msk/if_mskreg.h ============================================================================== --- stable/8/sys/dev/msk/if_mskreg.h Wed Jan 4 21:50:59 2012 (r229524) +++ stable/8/sys/dev/msk/if_mskreg.h Wed Jan 4 21:52:56 2012 (r229525) @@ -2315,35 +2315,48 @@ struct msk_stat_desc { #define BMU_UDP_CHECK (0x57<<16) /* Descr with UDP ext (YUKON only) */ #define BMU_BBC 0xffff /* Bit 15.. 0: Buffer Byte Counter */ +/* + * Controller requires an additional LE op code for 64bit DMA operation. + * Driver uses fixed number of RX buffers such that this limitation + * reduces number of available RX buffers with 64bit DMA so double + * number of RX buffers on platforms that support 64bit DMA. For TX + * side, controller requires an additional OP_ADDR64 op code if a TX + * buffer uses different high address value than previously used one. + * Driver monitors high DMA address change in TX and inserts an + * OP_ADDR64 op code if the high DMA address is changed. Driver + * allocates 50% more total TX buffers on platforms that support 64bit + * DMA. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define MSK_64BIT_DMA +#define MSK_TX_RING_CNT 384 +#define MSK_RX_RING_CNT 512 +#else +#undef MSK_64BIT_DMA #define MSK_TX_RING_CNT 256 #define MSK_RX_RING_CNT 256 +#endif #define MSK_RX_BUF_ALIGN 8 #define MSK_JUMBO_RX_RING_CNT MSK_RX_RING_CNT -#define MSK_STAT_RING_CNT ((1 + 3) * (MSK_TX_RING_CNT + MSK_RX_RING_CNT)) #define MSK_MAXTXSEGS 32 #define MSK_TSO_MAXSGSIZE 4096 #define MSK_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header)) /* - * It seems that the hardware requires extra decriptors(LEs) to offload - * TCP/UDP checksum, VLAN hardware tag inserstion and TSO. + * It seems that the hardware requires extra descriptors(LEs) to offload + * TCP/UDP checksum, VLAN hardware tag insertion and TSO. * * 1 descriptor for TCP/UDP checksum offload. * 1 descriptor VLAN hardware tag insertion. * 1 descriptor for TSO(TCP Segmentation Offload) - * 1 descriptor for 64bits DMA : Not applicatable due to the use of - * BUS_SPACE_MAXADDR_32BIT in parent DMA tag creation. + * 1 descriptor for each 64bits DMA transfers */ +#ifdef MSK_64BIT_DMA +#define MSK_RESERVED_TX_DESC_CNT (MSK_MAXTXSEGS + 3) +#else #define MSK_RESERVED_TX_DESC_CNT 3 +#endif -/* - * Jumbo buffer stuff. Note that we must allocate more jumbo - * buffers than there are descriptors in the receive ring. This - * is because we don't know how long it will take for a packet - * to be released after we hand it off to the upper protocol - * layers. To be safe, we allocate 1.5 times the number of - * receive descriptors. - */ #define MSK_JUMBO_FRAMELEN 9022 #define MSK_JUMBO_MTU (MSK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define MSK_MAX_FRAMELEN \ @@ -2380,6 +2393,7 @@ struct msk_chain_data { bus_dmamap_t msk_jumbo_rx_sparemap; uint16_t msk_tso_mtu; uint32_t msk_last_csum; + uint32_t msk_tx_high_addr; int msk_tx_prod; int msk_tx_cons; int msk_tx_cnt; @@ -2411,10 +2425,17 @@ struct msk_ring_data { (sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT) #define MSK_JUMBO_RX_RING_SZ \ (sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT) -#define MSK_STAT_RING_SZ \ - (sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT) #define MSK_INC(x, y) (x) = (x + 1) % y +#ifdef MSK_64BIT_DMA +#define MSK_RX_INC(x, y) (x) = (x + 2) % y +#define MSK_RX_BUF_CNT (MSK_RX_RING_CNT / 2) +#define MSK_JUMBO_RX_BUF_CNT (MSK_JUMBO_RX_RING_CNT / 2) +#else +#define MSK_RX_INC(x, y) (x) = (x + 1) % y +#define MSK_RX_BUF_CNT MSK_RX_RING_CNT +#define MSK_JUMBO_RX_BUF_CNT MSK_JUMBO_RX_RING_CNT +#endif #define MSK_PCI_BUS 0 #define MSK_PCIX_BUS 1 @@ -2519,6 +2540,7 @@ struct msk_softc { int msk_int_holdoff; int msk_process_limit; int msk_stat_cons; + int msk_stat_count; struct mtx msk_mtx; }; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 21:57:12 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2761065678; Wed, 4 Jan 2012 21:57:12 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09A038FC14; Wed, 4 Jan 2012 21:57:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04LvBkL098261; Wed, 4 Jan 2012 21:57:11 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LvBiO098259; Wed, 4 Jan 2012 21:57:11 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201042157.q04LvBiO098259@svn.freebsd.org> From: Christian Brueffer Date: Wed, 4 Jan 2012 21:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229528 - stable/8/sbin/dumpfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 21:57:12 -0000 Author: brueffer Date: Wed Jan 4 21:57:11 2012 New Revision: 229528 URL: http://svn.freebsd.org/changeset/base/229528 Log: MFC: r228898 Add missing -l flag to usage(). Modified: stable/8/sbin/dumpfs/dumpfs.c Directory Properties: stable/8/sbin/dumpfs/ (props changed) Modified: stable/8/sbin/dumpfs/dumpfs.c ============================================================================== --- stable/8/sbin/dumpfs/dumpfs.c Wed Jan 4 21:56:47 2012 (r229527) +++ stable/8/sbin/dumpfs/dumpfs.c Wed Jan 4 21:57:11 2012 (r229528) @@ -495,6 +495,6 @@ ufserr(const char *name) void usage(void) { - (void)fprintf(stderr, "usage: dumpfs [-fm] filesys | device\n"); + (void)fprintf(stderr, "usage: dumpfs [-flm] filesys | device\n"); exit(1); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 22:55:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AE0C106566B; Wed, 4 Jan 2012 22:55:15 +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 8854A8FC16; Wed, 4 Jan 2012 22:55:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04MtFmN000570; Wed, 4 Jan 2012 22:55:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04MtFY0000567; Wed, 4 Jan 2012 22:55:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042255.q04MtFY0000567@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 22:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229530 - in stable/8/sys: dev/re pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 22:55:17 -0000 Author: yongari Date: Wed Jan 4 22:55:15 2012 New Revision: 229530 URL: http://svn.freebsd.org/changeset/base/229530 Log: MFC r227587,227590-227591,227593,227638-227639: r227587: Add preliminary support for RTL8402 PCIe FastEthernet with integrated card reader. r227590: Add preliminary support for RTL8411 PCIe Gigabit ethernet with integrated card reader. r227591: Add missing driver lock in SIOCSIFCAP handler. r227593: Disable PCIe ASPM (Active State Power Management) for all controllers. More and more RealTek controllers started to implement EEE feature. Vendor driver seems to load a kind of firmware for EEE with additional PHY fixups. It is known that the EEE feature may need ASPM support. Unfortunately there is no documentation for EEE of the controller so enabling ASPM may cause more problems. r227638: Add preliminary support for second generation RTL8105E PCIe FastEthernet. r227639: Add preliminary support for RTL8168/8111F PCIe Gigabit ethernet. Modified: stable/8/sys/dev/re/if_re.c stable/8/sys/pci/if_rlreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Wed Jan 4 22:53:18 2012 (r229529) +++ stable/8/sys/dev/re/if_re.c Wed Jan 4 22:55:15 2012 (r229530) @@ -181,7 +181,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 810xE PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet" }, + "RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169SC, 0, @@ -220,7 +220,9 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8102EL_SPIN1, RL_8169, "8102EL", RL_MTU }, { RL_HWREV_8103E, RL_8169, "8103E", RL_MTU }, { RL_HWREV_8401E, RL_8169, "8401E", RL_MTU }, + { RL_HWREV_8402, RL_8169, "8402", RL_MTU }, { RL_HWREV_8105E, RL_8169, "8105E", RL_MTU }, + { RL_HWREV_8105E_SPIN1, RL_8169, "8105E", RL_MTU }, { RL_HWREV_8168B_SPIN2, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168B_SPIN3, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168C, RL_8169, "8168C/8111C", RL_JUMBO_MTU_6K }, @@ -230,6 +232,8 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP", RL_JUMBO_MTU_9K }, { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K}, { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K}, + { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, + { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K}, { 0, 0, NULL, 0 } }; @@ -1184,6 +1188,7 @@ re_attach(device_t dev) struct rl_softc *sc; struct ifnet *ifp; struct rl_hwrev *hw_rev; + u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; int error = 0, i, phy, rid; @@ -1239,8 +1244,10 @@ re_attach(device_t dev) msic = pci_msi_count(dev); msixc = pci_msix_count(dev); - if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) + if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; + sc->rl_expcap = reg; + } if (bootverbose) { device_printf(dev, "MSI count : %d\n", msic); device_printf(dev, "MSI-X count : %d\n", msixc); @@ -1332,6 +1339,23 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } + /* Disable ASPM L0S/L1. */ + if (sc->rl_expcap != 0) { + cap = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CAP, 2); + if ((cap & PCIM_LINK_CAP_ASPM) != 0) { + ctl = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, 2); + if ((ctl & 0x0003) != 0) { + ctl &= ~0x0003; + pci_write_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, ctl, 2); + device_printf(dev, "ASPM disabled\n"); + } + } else + device_printf(dev, "no ASPM capability\n"); + } + hw_rev = re_hwrevs; hwrev = CSR_READ_4(sc, RL_TXCFG); switch (hwrev & 0x70000000) { @@ -1381,7 +1405,9 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: + case RL_HWREV_8402: case RL_HWREV_8105E: + case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; @@ -1413,6 +1439,8 @@ re_attach(device_t dev) RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; break; case RL_HWREV_8168E_VL: + case RL_HWREV_8168F: + case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; @@ -3308,6 +3336,7 @@ re_ioctl(struct ifnet *ifp, u_long comma } } #endif /* DEVICE_POLLING */ + RL_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; @@ -3366,8 +3395,9 @@ re_ioctl(struct ifnet *ifp, u_long comma } if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - re_init(sc); + re_init_locked(sc); } + RL_UNLOCK(sc); VLAN_CAPABILITIES(ifp); } break; Modified: stable/8/sys/pci/if_rlreg.h ============================================================================== --- stable/8/sys/pci/if_rlreg.h Wed Jan 4 22:53:18 2012 (r229529) +++ stable/8/sys/pci/if_rlreg.h Wed Jan 4 22:55:15 2012 (r229530) @@ -178,6 +178,10 @@ #define RL_HWREV_8168C_SPIN2 0x3C400000 #define RL_HWREV_8168CP 0x3C800000 #define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -866,6 +870,7 @@ struct rl_softc { const struct rl_hwrev *rl_hwrev; int rl_eecmd_read; int rl_eewidth; + int rl_expcap; int rl_txthresh; struct rl_chain_data rl_cdata; struct rl_list_data rl_ldata; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 4 23:31:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA49D1065670; Wed, 4 Jan 2012 23:31: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 ADDE38FC1A; Wed, 4 Jan 2012 23:31:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q04NVh1E003649; Wed, 4 Jan 2012 23:31:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NVh8p003646; Wed, 4 Jan 2012 23:31:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042331.q04NVh8p003646@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 23:31:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229535 - in stable/8/sys: dev/re pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 23:31:44 -0000 Author: yongari Date: Wed Jan 4 23:31:43 2012 New Revision: 229535 URL: http://svn.freebsd.org/changeset/base/229535 Log: MFC r227850-227851,227854,227914,227916: r227850: Writing access to RL_CFG5 register also requires EEPROM write access. While I'm here, enable WOL through magic packet but disable waking up system via unicast, multicast and broadcast frames. Otherwise, multicast or unicast frame(e.g. ICMP echo request) can wake up system which is not probably wanted behavior on most environments. This was not known as problem because RL_CFG5 register access had not effect until this change. The capability to wake up system with unicast/multicast frames are still set in driver, default off, so users who need that feature can still activate it with ifconfig(8). r227851: Perform media change after setting IFF_DRV_RUNNING flag. Without it, driver would ignore the first link state update if controller already established a link such that it would have to take additional link state handling in re_tick(). r227854: Disable accepting frames in re_stop() to put RX MAC into idle state. Because there is no reliable way to know whether RX MAC is in stopped state, rejecting all frames would be the only way to minimize possible races. Otherwise it's possible to receive frames while stop command execution is in progress and controller can DMA the frame to freed RX buffer during that period. This was observed on recent PCIe controllers(i.e. RTL8111F). While this change may not be required on old controllers it wouldn't make negative effects on old controllers. One side effect of this change is disabling receive so driver reprograms RL_RXCFG to receive WOL frames when it is put into suspend or shutdown. This should address occasional 'memory modified free' errors seen on recent RealTek controllers. r227914: Make sure to stop TX MAC before freeing queued TX frames. For RTL8111DP, check if the TX MAC is active by reading RL_GTXSTART register. For RTL8402/8168E-VL/8168F/8411, wait until TX queue is empty. r227916: To save more power, switch to 10/100Mbps link when controller is put into suspend/shutdown. Old PCI controllers performed that operation in firmware but for RTL8111C or newer controllers, it's responsibility of driver. It's not clear whether the firmware of RTL8111B still downgrades its speed to 10/100Mbps so leave it as it was. Modified: stable/8/sys/dev/re/if_re.c stable/8/sys/pci/if_rlreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Wed Jan 4 23:29:57 2012 (r229534) +++ stable/8/sys/dev/re/if_re.c Wed Jan 4 23:31:43 2012 (r229535) @@ -294,6 +294,7 @@ static void re_set_rxmode (struct rl_so static void re_reset (struct rl_softc *); static void re_setwol (struct rl_softc *); static void re_clrwol (struct rl_softc *); +static void re_set_linkspeed (struct rl_softc *); #ifdef RE_DIAG static int re_diag (struct rl_softc *); @@ -1405,13 +1406,18 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: - case RL_HWREV_8402: case RL_HWREV_8105E: case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; break; + case RL_HWREV_8402: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | + RL_FLAG_CMDSTOP_WAIT_TXQ; + break; case RL_HWREV_8168B_SPIN1: case RL_HWREV_8168B_SPIN2: sc->rl_flags |= RL_FLAG_WOLRXENB; @@ -1428,22 +1434,28 @@ re_attach(device_t dev) /* FALLTHROUGH */ case RL_HWREV_8168CP: case RL_HWREV_8168D: - case RL_HWREV_8168DP: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK; + break; + case RL_HWREV_8168DP: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | + RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_AUTOPAD | + RL_FLAG_JUMBOV2 | RL_FLAG_WAIT_TXPOLL | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | - RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E_VL: case RL_HWREV_8168F: case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SBL: @@ -1594,6 +1606,7 @@ re_attach(device_t dev) if (pci_find_extcap(sc->rl_dev, PCIY_PMG, ®) == 0) ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); /* * Don't enable TSO by default. It is known to generate * corrupted TCP segments(bad TCP options) under certain @@ -3197,14 +3210,14 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_testmode) return; - mii_mediachg(mii); - CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->rl_flags &= ~RL_FLAG_LINK; + mii_mediachg(mii); + sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); } @@ -3459,10 +3472,42 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) + /* + * Disable accepting frames to put RX MAC into idle state. + * Otherwise it's possible to get frames while stop command + * execution is in progress and controller can DMA the frame + * to already freed RX buffer during that period. + */ + CSR_WRITE_4(sc, RL_RXCFG, CSR_READ_4(sc, RL_RXCFG) & + ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | + RL_RXCFG_RX_BROAD)); + + if ((sc->rl_flags & RL_FLAG_WAIT_TXPOLL) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_1(sc, sc->rl_txstart) & + RL_TXSTART_START) == 0) + break; + DELAY(20); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TX poll timed out!\n"); + CSR_WRITE_1(sc, RL_COMMAND, 0x00); + } else if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) { CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | RL_CMD_RX_ENB); - else + if ((sc->rl_flags & RL_FLAG_CMDSTOP_WAIT_TXQ) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_TXCFG) & + RL_TXCFG_QUEUE_EMPTY) != 0) + break; + DELAY(100); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TXQ timed out!\n"); + } + } else CSR_WRITE_1(sc, RL_COMMAND, 0x00); DELAY(1000); CSR_WRITE_2(sc, RL_IMR, 0x0000); @@ -3588,6 +3633,74 @@ re_shutdown(device_t dev) } static void +re_set_linkspeed(struct rl_softc *sc) +{ + struct mii_softc *miisc; + struct mii_data *mii; + int aneg, i, phyno; + + RL_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->rl_miibus); + mii_pollstat(mii); + aneg = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch IFM_SUBTYPE(mii->mii_media_active) { + case IFM_10_T: + case IFM_100_TX: + return; + case IFM_1000_T: + aneg++; + break; + default: + break; + } + } + miisc = LIST_FIRST(&mii->mii_phys); + phyno = miisc->mii_phy; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + re_miibus_writereg(sc->rl_dev, phyno, MII_100T2CR, 0); + re_miibus_writereg(sc->rl_dev, phyno, + MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); + re_miibus_writereg(sc->rl_dev, phyno, + MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + DELAY(1000); + if (aneg != 0) { + /* + * Poll link state until re(4) get a 10/100Mbps link. + */ + for (i = 0; i < MII_ANEGTICKS_GIGE; i++) { + mii_pollstat(mii); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) + == (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + return; + default: + break; + } + } + RL_UNLOCK(sc); + pause("relnk", hz); + RL_LOCK(sc); + } + if (i == MII_ANEGTICKS_GIGE) + device_printf(sc->rl_dev, + "establishing a link failed, WOL may not work!"); + } + /* + * No link, force MAC to have 100Mbps, full-duplex link. + * MAC does not require reprogramming on resolved speed/duplex, + * so this is just for completeness. + */ + mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; + mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; +} + +static void re_setwol(struct rl_softc *sc) { struct ifnet *ifp; @@ -3607,9 +3720,13 @@ re_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_GPIO, CSR_READ_1(sc, RL_GPIO) & ~0x01); } - if ((ifp->if_capenable & IFCAP_WOL) != 0 && - (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rxmode(sc); + if ((sc->rl_flags & RL_FLAG_WOL_MANLINK) != 0) + re_set_linkspeed(sc); + if ((sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + } /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); @@ -3626,12 +3743,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG3_WOL_MAGIC; CSR_WRITE_1(sc, RL_CFG3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); - v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); - v &= ~RL_CFG5_WOL_LANWAKE; + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) v |= RL_CFG5_WOL_UCAST; if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) @@ -3640,6 +3754,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + if ((ifp->if_capenable & IFCAP_WOL) != 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); Modified: stable/8/sys/pci/if_rlreg.h ============================================================================== --- stable/8/sys/pci/if_rlreg.h Wed Jan 4 23:29:57 2012 (r229534) +++ stable/8/sys/pci/if_rlreg.h Wed Jan 4 23:31:43 2012 (r229535) @@ -143,6 +143,7 @@ */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ #define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ #define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ #define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ #define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ @@ -897,22 +898,25 @@ struct rl_softc { int rl_int_rx_act; int rl_int_rx_mod; uint32_t rl_flags; -#define RL_FLAG_MSI 0x0001 -#define RL_FLAG_AUTOPAD 0x0002 -#define RL_FLAG_PHYWAKE_PM 0x0004 -#define RL_FLAG_PHYWAKE 0x0008 -#define RL_FLAG_JUMBOV2 0x0010 -#define RL_FLAG_PAR 0x0020 -#define RL_FLAG_DESCV2 0x0040 -#define RL_FLAG_MACSTAT 0x0080 -#define RL_FLAG_FASTETHER 0x0100 -#define RL_FLAG_CMDSTOP 0x0200 -#define RL_FLAG_MACRESET 0x0400 -#define RL_FLAG_MSIX 0x0800 -#define RL_FLAG_WOLRXENB 0x1000 -#define RL_FLAG_MACSLEEP 0x2000 -#define RL_FLAG_PCIE 0x4000 -#define RL_FLAG_LINK 0x8000 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 +#define RL_FLAG_MACRESET 0x00000400 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_WOLRXENB 0x00001000 +#define RL_FLAG_MACSLEEP 0x00002000 +#define RL_FLAG_WAIT_TXPOLL 0x00004000 +#define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 +#define RL_FLAG_WOL_MANLINK 0x00010000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_LINK 0x80000000 }; #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 00:00:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24B78106567D; Thu, 5 Jan 2012 00:00:31 +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 11CCE8FC17; Thu, 5 Jan 2012 00:00:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0500U8J004995; Thu, 5 Jan 2012 00:00:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0500UOZ004993; Thu, 5 Jan 2012 00:00:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050000.q0500UOZ004993@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229541 - stable/8/sys/dev/vge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 00:00:31 -0000 Author: yongari Date: Thu Jan 5 00:00:30 2012 New Revision: 229541 URL: http://svn.freebsd.org/changeset/base/229541 Log: MFC r227828,227835,227837: r227828: Always start MII auto polling before accessing any MII registers. r227835: Rework link establishment and link state detection logic. - Remove MIIBUS statchg callback and program VGE_DIAGCTL before initiating link establishment. Previously driver used to program VGE_DIAGCTL after getting a link in statchg callback. It seems the VGE_DIAGCTL register works like a kind of MII register such that it requires setting a 'to be' mode in advance rather than relying on resolved speed/duplex of established link. This means the statchg callback is not needed in driver. In addition, if there was no link at the time of media change, this was not called at all. - Introduce vge_ifmedia_upd_locked() to change current media to configured one. Actual media change is performed only after PHY reset and VGE_DIAGCTL setup. - In WOL configuration, make sure to clear forced mode such that controller can rely on auto-negotiation. - Unlike most other drivers that use miibus(4), vge(4) used controller's auto-polling feature for link state tracking via interrupt. This came from controller's inefficient mechanism to access MII registers. On link state change interrupt, vge(4) used to get current link state with series of MII register accesses. Because vge(4) already enabled auto polling, read PHY status register to resolved speed/duplex/flow control parameters. vge(4) still does not drive MII_TICK to reduce number of MII register accesses which in turn means the driver does not know the status of auto-negotiation. This was a one of long standing issue of vge(4). Probably driver may be able to implement a timer that keeps track of auto-negotiation state and restart auto-negotiation when driver couldn't establish a link within a specified period. However the controller does not provide a reliable way to detect auto-negotiation failure so I'm not sure whether it's worth to implement it in driver. Alternatively driver can completely disable MII auto-polling and let miibus(4) poll link state by driving MII_TICK. This may reduce unnecessary overhead of stopping/restarting MII auto-polling of controller. Unfortunately it was known that some variants of controller does not work correctly if MII auto-polling is disabled. r227837: Announce flow control capability to underlying PHY driver. Pause timer value is initialized to 0xFFFF. Controller allows just 4 different TX pause thresholds. The lowest possible threshold value looks too aggressive so use next available threshold value. Modified: stable/8/sys/dev/vge/if_vge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/vge/if_vge.c ============================================================================== --- stable/8/sys/dev/vge/if_vge.c Wed Jan 4 23:58:54 2012 (r229540) +++ stable/8/sys/dev/vge/if_vge.c Thu Jan 5 00:00:30 2012 (r229541) @@ -173,6 +173,7 @@ static __inline void static void vge_freebufs(struct vge_softc *); static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int vge_ifmedia_upd(struct ifnet *); +static int vge_ifmedia_upd_locked(struct vge_softc *); static void vge_init(void *); static void vge_init_locked(struct vge_softc *); static void vge_intr(void *); @@ -180,7 +181,6 @@ static void vge_intr_holdoff(struct vge_ static int vge_ioctl(struct ifnet *, u_long, caddr_t); static void vge_link_statchg(void *); static int vge_miibus_readreg(device_t, int, int); -static void vge_miibus_statchg(device_t); static int vge_miibus_writereg(device_t, int, int, int); static void vge_miipoll_start(struct vge_softc *); static void vge_miipoll_stop(struct vge_softc *); @@ -190,6 +190,7 @@ static void vge_reset(struct vge_softc * static int vge_rx_list_init(struct vge_softc *); static int vge_rxeof(struct vge_softc *, int); static void vge_rxfilter(struct vge_softc *); +static void vge_setmedia(struct vge_softc *); static void vge_setvlan(struct vge_softc *); static void vge_setwol(struct vge_softc *); static void vge_start(struct ifnet *); @@ -218,7 +219,6 @@ static device_method_t vge_methods[] = { /* MII interface */ DEVMETHOD(miibus_readreg, vge_miibus_readreg), DEVMETHOD(miibus_writereg, vge_miibus_writereg), - DEVMETHOD(miibus_statchg, vge_miibus_statchg), { 0, 0 } }; @@ -1099,10 +1099,11 @@ vge_attach(device_t dev) goto fail; } + vge_miipoll_start(sc); /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1660,30 +1661,41 @@ vge_link_statchg(void *xsc) { struct vge_softc *sc; struct ifnet *ifp; - struct mii_data *mii; + uint8_t physts; sc = xsc; ifp = sc->vge_ifp; VGE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->vge_miibus); - mii_pollstat(mii); - if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { - if (!(mii->mii_media_status & IFM_ACTIVE)) { + physts = CSR_READ_1(sc, VGE_PHYSTS0); + if ((physts & VGE_PHYSTS_RESETSTS) == 0) { + if ((physts & VGE_PHYSTS_LINK) == 0) { sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); - } - } else { - if (mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + } else { sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); + CSR_WRITE_1(sc, VGE_CRC2, VGE_CR2_FDX_TXFLOWCTL_ENABLE | + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_FDX) != 0) { + if ((physts & VGE_PHYSTS_TXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_TXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_RXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vge_start_locked(ifp); } } + /* + * Restart MII auto-polling because link state change interrupt + * will disable it. + */ + vge_miipoll_start(sc); } #ifdef DEVICE_POLLING @@ -2028,6 +2040,7 @@ vge_init_locked(struct vge_softc *sc) */ vge_stop(sc); vge_reset(sc); + vge_miipoll_start(sc); /* * Initialize the RX and TX descriptors and mbufs. @@ -2099,9 +2112,16 @@ vge_init_locked(struct vge_softc *sc) vge_rxfilter(sc); vge_setvlan(sc); - /* Enable flow control */ - - CSR_WRITE_1(sc, VGE_CRS2, 0x8B); + /* Initialize pause timer. */ + CSR_WRITE_2(sc, VGE_TX_PAUSE_TIMER, 0xFFFF); + /* + * Initialize flow control parameters. + * TX XON high threshold : 48 + * TX pause low threshold : 24 + * Disable hald-duplex flow control + */ + CSR_WRITE_1(sc, VGE_CRC2, 0xFF); + CSR_WRITE_1(sc, VGE_CRS2, VGE_CR2_XON_ENABLE | 0x0B); /* Enable jumbo frame reception (if desired) */ @@ -2129,7 +2149,7 @@ vge_init_locked(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; - mii_mediachg(mii); + vge_ifmedia_upd_locked(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -2143,14 +2163,28 @@ static int vge_ifmedia_upd(struct ifnet *ifp) { struct vge_softc *sc; - struct mii_data *mii; int error; sc = ifp->if_softc; VGE_LOCK(sc); + error = vge_ifmedia_upd_locked(sc); + VGE_UNLOCK(sc); + + return (error); +} + +static int +vge_ifmedia_upd_locked(struct vge_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + mii = device_get_softc(sc->vge_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + vge_setmedia(sc); error = mii_mediachg(mii); - VGE_UNLOCK(sc); return (error); } @@ -2179,13 +2213,11 @@ vge_ifmedia_sts(struct ifnet *ifp, struc } static void -vge_miibus_statchg(device_t dev) +vge_setmedia(struct vge_softc *sc) { - struct vge_softc *sc; struct mii_data *mii; struct ifmedia_entry *ife; - sc = device_get_softc(dev); mii = device_get_softc(sc->vge_miibus); ife = mii->mii_media.ifm_cur; @@ -2219,7 +2251,7 @@ vge_miibus_statchg(device_t dev) } break; default: - device_printf(dev, "unknown media type: %x\n", + device_printf(sc->vge_dev, "unknown media type: %x\n", IFM_SUBTYPE(ife->ifm_media)); break; } @@ -2772,6 +2804,9 @@ vge_setlinkspeed(struct vge_softc *sc) break; } } + /* Clear forced MAC speed/duplex configuration. */ + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_100T2CR, 0); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 00:09:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 180EF1065670; Thu, 5 Jan 2012 00:09:50 +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 D82288FC12; Thu, 5 Jan 2012 00:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0509nEa005442; Thu, 5 Jan 2012 00:09:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0509nK1005440; Thu, 5 Jan 2012 00:09:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050009.q0509nK1005440@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229544 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 00:09:50 -0000 Author: yongari Date: Thu Jan 5 00:09:49 2012 New Revision: 229544 URL: http://svn.freebsd.org/changeset/base/229544 Log: MFC r227842: For IP1001 PHY, do not set multi-port device(MASTER). Ideally this bit should not affect link establishment process of auto-negotiation if manual configuration is not used, which is true in auto-negotiation. However it seems setting this bit interfere with IP1001 PHY's down-shifting feature such that establishing a 10/100Mbps link failed when 1000baseT link is not available during auto-negotiation process. Modified: stable/8/sys/dev/mii/ip1000phy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/8/sys/dev/mii/ip1000phy.c Thu Jan 5 00:08:16 2012 (r229543) +++ stable/8/sys/dev/mii/ip1000phy.c Thu Jan 5 00:09:49 2012 (r229544) @@ -357,7 +357,8 @@ ip1000phy_mii_phy_auto(struct mii_softc PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; - reg |= IP1000PHY_1000CR_MASTER; + if (isc->model != MII_MODEL_ICPLUS_IP1001) + reg |= IP1000PHY_1000CR_MASTER; PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 02:05:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58F3E106566C; Thu, 5 Jan 2012 02:05:16 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C7F38FC15; Thu, 5 Jan 2012 02:05:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0525Fps009573; Thu, 5 Jan 2012 02:05:15 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0525F9d009570; Thu, 5 Jan 2012 02:05:15 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201050205.q0525F9d009570@svn.freebsd.org> From: Rick Macklem Date: Thu, 5 Jan 2012 02:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229552 - in stable/8/sys/fs: nfs nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 02:05:16 -0000 Author: rmacklem Date: Thu Jan 5 02:05:15 2012 New Revision: 229552 URL: http://svn.freebsd.org/changeset/base/229552 Log: MFC: r227743 Post r223774 the NFSv4 client never uses the linked list with the head nfsc_defunctlockowner. This patch simply removes the code that loops through this always empty list, since the code no longer does anything useful. It should not have any effect on the client's behaviour. Modified: stable/8/sys/fs/nfs/nfsclstate.h stable/8/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/8/sys/fs/nfs/nfsclstate.h Thu Jan 5 01:48:25 2012 (r229551) +++ stable/8/sys/fs/nfs/nfsclstate.h Thu Jan 5 02:05:15 2012 (r229552) @@ -48,7 +48,6 @@ struct nfsclclient { struct nfsclownerhead nfsc_owner; struct nfscldeleghead nfsc_deleg; struct nfscldeleghash nfsc_deleghash[NFSCLDELEGHASHSIZE]; - struct nfscllockownerhead nfsc_defunctlockowner; struct nfsv4lock nfsc_lock; struct proc *nfsc_renewthread; struct nfsmount *nfsc_nmp; Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 01:48:25 2012 (r229551) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 02:05:15 2012 (r229552) @@ -699,7 +699,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr { struct nfsclclient *clp; struct nfsclclient *newclp = NULL; - struct nfscllockowner *lp, *nlp; struct mount *mp; struct nfsmount *nmp; char uuid[HOSTUUIDLEN]; @@ -744,7 +743,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr TAILQ_INIT(&clp->nfsc_deleg); for (i = 0; i < NFSCLDELEGHASHSIZE; i++) LIST_INIT(&clp->nfsc_deleghash[i]); - LIST_INIT(&clp->nfsc_defunctlockowner); clp->nfsc_flags = NFSCLFLAGS_INITED; clp->nfsc_clientidrev = 1; clp->nfsc_cbident = nfscl_nextcbident(); @@ -793,11 +791,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr NFSUNLOCKCLSTATE(); return (EACCES); } - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, - nlp) { - nfscl_freelockowner(lp, 0); - } /* * If RFC3530 Sec. 14.2.33 is taken literally, * NFSERR_CLIDINUSE will be returned persistently for the @@ -1537,13 +1530,6 @@ nfscl_cleanclient(struct nfsclclient *cl { struct nfsclowner *owp, *nowp; struct nfsclopen *op, *nop; - struct nfscllockowner *lp, *nlp; - - - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); - } /* Now, all the OpenOwners, etc. */ LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { @@ -1717,12 +1703,6 @@ nfscl_cleanup_common(struct nfsclclient } owp = nowp; } - - /* and check the defunct list */ - LIST_FOREACH(lp, &clp->nfsc_defunctlockowner, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN)) - lp->nfsl_defunct = 1; - } } #if defined(APPLEKEXT) || defined(__FreeBSD__) @@ -1735,7 +1715,6 @@ static void nfscl_cleanupkext(struct nfsclclient *clp) { struct nfsclowner *owp, *nowp; - struct nfscllockowner *lp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); @@ -1743,12 +1722,6 @@ nfscl_cleanupkext(struct nfsclclient *cl if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } - - /* and check the defunct list */ - LIST_FOREACH(lp, &clp->nfsc_defunctlockowner, nfsl_list) { - if (nfscl_procdoesntexist(lp->nfsl_owner)) - lp->nfsl_defunct = 1; - } NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } @@ -1905,11 +1878,6 @@ nfscl_recover(struct nfsclclient *clp, s NFSUNLOCKREQ(); splx(s); - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); - } - /* * Now, mark all delegations "need reclaim". */ @@ -2157,7 +2125,6 @@ nfscl_recover(struct nfsclclient *clp, s APPLESTATIC int nfscl_hasexpired(struct nfsclclient *clp, u_int32_t clidrev, NFSPROC_T *p) { - struct nfscllockowner *lp, *nlp; struct nfsmount *nmp; struct ucred *cred; int igotlock = 0, error, trycnt; @@ -2207,12 +2174,6 @@ nfscl_hasexpired(struct nfsclclient *clp clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | NFSCLFLAGS_RECOVER); } else { - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, - nlp) { - nfscl_freelockowner(lp, 0); - } - /* * Expire the state for the client. */ @@ -2486,25 +2447,6 @@ nfscl_renewthread(struct nfsclclient *cl owp = nowp; } - /* also search the defunct list */ - lp = LIST_FIRST(&clp->nfsc_defunctlockowner); - while (lp != NULL) { - nlp = LIST_NEXT(lp, nfsl_list); - if (lp->nfsl_defunct) { - LIST_FOREACH(olp, &lh, nfsl_list) { - if (!NFSBCMP(olp->nfsl_owner, lp->nfsl_owner, - NFSV4CL_LOCKNAMELEN)) - break; - } - if (olp == NULL) { - LIST_REMOVE(lp, nfsl_list); - LIST_INSERT_HEAD(&lh, lp, nfsl_list); - } else { - nfscl_freelockowner(lp, 0); - } - } - lp = nlp; - } /* and release defunct lock owners */ LIST_FOREACH_SAFE(lp, &lh, nfsl_list, nlp) { nfscl_freelockowner(lp, 0); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 04:50:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C81C10657B2; Thu, 5 Jan 2012 04:50:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11EDB8FC16; Thu, 5 Jan 2012 04:50:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q054oSNa015213; Thu, 5 Jan 2012 04:50:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q054oSU1015202; Thu, 5 Jan 2012 04:50:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201050450.q054oSU1015202@svn.freebsd.org> From: Eitan Adler Date: Thu, 5 Jan 2012 04:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229559 - in stable/8: lib/libelf lib/libipsec lib/libpmc lib/msun/man sbin/geom/class/part share/doc/psd/03.iosys share/man/man4 share/man/man9 usr.bin/compress/doc usr.sbin/pkg_instal... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 04:50:29 -0000 Author: eadler (ports committer) Date: Thu Jan 5 04:50:28 2012 New Revision: 229559 URL: http://svn.freebsd.org/changeset/base/229559 Log: MFC r227458, r226436: - change "is is" to "is" or "it is" - change "the the" to "the" - other typo fixes Approved by: lstewart Modified: stable/8/lib/libelf/elf_update.3 stable/8/lib/libipsec/ipsec_strerror.3 stable/8/lib/libpmc/pmc.core.3 stable/8/lib/msun/man/ieee.3 stable/8/sbin/geom/class/part/gpart.8 stable/8/share/doc/psd/03.iosys/iosys stable/8/share/man/man4/dc.4 stable/8/share/man/man9/sleepqueue.9 stable/8/usr.bin/compress/doc/NOTES stable/8/usr.sbin/pkg_install/lib/version.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libelf/ (props changed) stable/8/lib/libipsec/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/msun/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/share/doc/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/usr.bin/compress/ (props changed) stable/8/usr.sbin/pkg_install/ (props changed) Modified: stable/8/lib/libelf/elf_update.3 ============================================================================== --- stable/8/lib/libelf/elf_update.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/libelf/elf_update.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -66,7 +66,7 @@ responsibility for the layout of the ELF If this flag is not set, the ELF library will compute the layout of the file from its associated section descriptors. .Pp -It is the application's responsibility to manage the the following +It is the application's responsibility to manage the following structure members in the ELF file: .Bl -tag -width indent .It "Executable Header" Modified: stable/8/lib/libipsec/ipsec_strerror.3 ============================================================================== --- stable/8/lib/libipsec/ipsec_strerror.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/libipsec/ipsec_strerror.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -63,7 +63,7 @@ as an underlying function, calling .Xr strerror 3 after .Fn ipsec_strerror -would overwrite the the return value from +would overwrite the return value from .Fn ipsec_strerror and make it invalid. .\" Modified: stable/8/lib/libpmc/pmc.core.3 ============================================================================== --- stable/8/lib/libpmc/pmc.core.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/libpmc/pmc.core.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -459,7 +459,7 @@ The number of instruction fetch misses i streaming buffers. .It Li ICache_Reads .Pq Event 80H , Umask 00H -The number of instruction fetches from the the instruction cache and +The number of instruction fetches from the instruction cache and streaming buffers counting both cacheable and uncacheable fetches. .It Li IFU_Mem_Stall .Pq Event 86H , Umask 00H Modified: stable/8/lib/msun/man/ieee.3 ============================================================================== --- stable/8/lib/msun/man/ieee.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/msun/man/ieee.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -183,7 +183,7 @@ Type name: .Bd -ragged -offset indent -compact On some architectures, .Vt long double -is the the same as +is the same as .Vt double . .Ed .Pp Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/sbin/geom/class/part/gpart.8 Thu Jan 5 04:50:28 2012 (r229559) @@ -366,7 +366,7 @@ Modify a partition from geom and further identified by the .Fl i Ar index option. -Only the the type and/or label of the partition can be modified. +Only the type and/or label of the partition can be modified. To change the type of a partition, specify the new type with the .Fl t Ar type option. Modified: stable/8/share/doc/psd/03.iosys/iosys ============================================================================== --- stable/8/share/doc/psd/03.iosys/iosys Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/share/doc/psd/03.iosys/iosys Thu Jan 5 04:50:28 2012 (r229559) @@ -813,7 +813,7 @@ which have a separate argument which indicates read or write. .IP B_DONE 10 This bit is set -to 0 when a block is handed to the the device strategy +to 0 when a block is handed to the device strategy routine and is turned on when the operation completes, whether normally as the result of an error. It is also used as part of the return argument of Modified: stable/8/share/man/man4/dc.4 ============================================================================== --- stable/8/share/man/man4/dc.4 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/share/man/man4/dc.4 Thu Jan 5 04:50:28 2012 (r229559) @@ -55,7 +55,7 @@ if_dc_load="YES" The .Nm driver provides support for several PCI Fast Ethernet adapters and -embedded controllers based on the the DEC/Intel 21143 chipset and clones. +embedded controllers based on the DEC/Intel 21143 chipset and clones. .Pp All of supported chipsets have the same general register layout, DMA descriptor format and method of operation. Modified: stable/8/share/man/man9/sleepqueue.9 ============================================================================== --- stable/8/share/man/man9/sleepqueue.9 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/share/man/man9/sleepqueue.9 Thu Jan 5 04:50:28 2012 (r229559) @@ -351,7 +351,7 @@ argument specifies the thread to awaken argument specifies the wait channel to awaken it from. If the thread .Fa td -is not blocked on the the wait channel +is not blocked on the wait channel .Fa wchan then this function will not do anything, even if the thread is asleep on a different wait channel. Modified: stable/8/usr.bin/compress/doc/NOTES ============================================================================== --- stable/8/usr.bin/compress/doc/NOTES Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/usr.bin/compress/doc/NOTES Thu Jan 5 04:50:28 2012 (r229559) @@ -51,7 +51,7 @@ comprehensive survey of an area which wi Until the dust clears, how you approach ideas which are patented depends on how paranoid you are of a legal onslaught. Arbitrary? Yes. But -the patent bar the the CCPA (Court of Customs and Patent Appeals) +the patent bar of the CCPA (Court of Customs and Patent Appeals) thanks you for any uncertainty as they, at least, stand to gain from any trouble. Modified: stable/8/usr.sbin/pkg_install/lib/version.c ============================================================================== --- stable/8/usr.sbin/pkg_install/lib/version.c Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/usr.sbin/pkg_install/lib/version.c Thu Jan 5 04:50:28 2012 (r229559) @@ -66,7 +66,7 @@ split_version(const char *pkgname, const if (pkgname == NULL) errx(2, "%s: Passed NULL pkgname.", __func__); - /* Look for the last '-' the the pkgname */ + /* Look for the last '-' in the pkgname */ ch = strrchr(pkgname, '-'); /* Cheat if we are just passed a version, not a valid package name */ versionstr = ch ? ch + 1 : pkgname; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 08:54:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BEEF10657CA; Thu, 5 Jan 2012 08:54:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 458398FC17; Thu, 5 Jan 2012 08:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q058sGxp022813; Thu, 5 Jan 2012 08:54:16 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q058sGXH022810; Thu, 5 Jan 2012 08:54:16 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050854.q058sGXH022810@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 08:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229564 - in stable/8/cddl/contrib/opensolaris/cmd: zfs zpool X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 08:54:16 -0000 Author: mm Date: Thu Jan 5 08:54:15 2012 New Revision: 229564 URL: http://svn.freebsd.org/changeset/base/229564 Log: MFC r227497, r228020: MFC r227497 [1]: Import upstream changesets for the output of the "zpool" command: 952 separate intent logs should be obvious in 'zpool iostat' output 1337 `zpool status -D' should tell if there are no DDT entries References: https://www.illumos.org/issues/952 https://www.illumos.org/issues/1337 MFC r228020: Fix zfs(8) and zpool(8) context help to repport supported flags. Obtained from: Illumos (issues 952, 1337; changesets 13384, 13432) [1] Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:53:54 2012 (r229563) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:54:15 2012 (r229564) @@ -257,7 +257,8 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-RDp] [-[iI] snapshot] \n")); + return (gettext("\tsend [-DvRp] " + "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " " ...\n")); @@ -293,11 +294,11 @@ get_usage(zfs_help_t idx) "\tunallow [-r] -s @setname [[,...]] " "\n")); case HELP_USERSPACE: - return (gettext("\tuserspace [-hniHp] [-o field[,...]] " + return (gettext("\tuserspace [-niHp] [-o field[,...]] " "[-sS field] ... [-t type[,...]]\n" "\t \n")); case HELP_GROUPSPACE: - return (gettext("\tgroupspace [-hniHpU] [-o field[,...]] " + return (gettext("\tgroupspace [-niHp] [-o field[,...]] " "[-sS field] ... [-t type[,...]]\n" "\t \n")); case HELP_HOLD: Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 08:53:54 2012 (r229563) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 08:54:15 2012 (r229564) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #include @@ -221,7 +222,7 @@ get_usage(zpool_help_t idx) { case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); case HELP_ONLINE: - return (gettext("\tonline ...\n")); + return (gettext("\tonline [-e] ...\n")); case HELP_REPLACE: return (gettext("\treplace [-f] " "[new-device]\n")); @@ -233,8 +234,7 @@ get_usage(zpool_help_t idx) { return (gettext("\tstatus [-vx] [-T d|u] [pool] ... [interval " "[count]]\n")); case HELP_UPGRADE: - return (gettext("\tupgrade\n" - "\tupgrade -v\n" + return (gettext("\tupgrade [-v]\n" "\tupgrade [-V version] <-a | pool ...>\n")); case HELP_GET: return (gettext("\tget <\"all\" | property[,...]> " @@ -2080,10 +2080,15 @@ print_vdev_stats(zpool_handle_t *zhp, co return; for (c = 0; c < children; c++) { - uint64_t ishole = B_FALSE; + uint64_t ishole = B_FALSE, islog = B_FALSE; - if (nvlist_lookup_uint64(newchild[c], - ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_HOLE, + &ishole); + + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, + &islog); + + if (ishole || islog) continue; vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); @@ -2093,6 +2098,31 @@ print_vdev_stats(zpool_handle_t *zhp, co } /* + * Log device section + */ + + if (num_logs(newnv) > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "logs"); + + for (c = 0; c < children; c++) { + uint64_t islog = B_FALSE; + (void) nvlist_lookup_uint64(newchild[c], + ZPOOL_CONFIG_IS_LOG, &islog); + + if (islog) { + vname = zpool_vdev_name(g_zfs, zhp, newchild[c], + B_FALSE); + print_vdev_stats(zhp, vname, oldnv ? + oldchild[c] : NULL, newchild[c], + cb, depth + 2); + free(vname); + } + } + + } + + /* * Include level 2 ARC devices in iostat output */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, @@ -3439,10 +3469,16 @@ print_dedup_stats(nvlist_t *config) * table continue processing the stats. */ if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS, - (uint64_t **)&ddo, &c) != 0 || ddo->ddo_count == 0) + (uint64_t **)&ddo, &c) != 0) return; (void) printf("\n"); + (void) printf(gettext(" dedup: ")); + if (ddo->ddo_count == 0) { + (void) printf(gettext("no DDT entries\n")); + return; + } + (void) printf("DDT entries %llu, size %llu on disk, %llu in core\n", (u_longlong_t)ddo->ddo_count, (u_longlong_t)ddo->ddo_dspace, From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 09:39:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D4EE106566B; Thu, 5 Jan 2012 09:39:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3350A8FC0A; Thu, 5 Jan 2012 09:39:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q059dUvU024547; Thu, 5 Jan 2012 09:39:30 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q059dTr7024532; Thu, 5 Jan 2012 09:39:29 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050939.q059dTr7024532@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 09:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229566 - in stable/8: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 09:39:30 -0000 Author: mm Date: Thu Jan 5 09:39:29 2012 New Revision: 229566 URL: http://svn.freebsd.org/changeset/base/229566 Log: MFC r226676, r226678, r226700, r226705, r226706, r226707: MFC r226676 (pjd): Allow to rename file systems without remounting if it is possible. It is possible for file systems with 'mountpoint' preperty set to 'legacy' or 'none' - we don't have to change mount directory for them. Currently such file systems are unmounted on rename and not even mounted back. This introduces layering violation, as we need to update 'f_mntfromname' field in statfs structure related to mountpoint (for the dataset we are renaming and all its children). In my opinion it is worth it, as it allow to update FreeBSD in even cleaner way - in ZFS-only configuration root file system is ZFS file system with 'mountpoint' property set to 'legacy'. If root dataset is named system/rootfs, we can snapshot it (system/rootfs@upgrade), clone it (system/oldrootfs), update FreeBSD and if it doesn't boot we can boot back from system/oldrootfs and rename it back to system/rootfs while it is mounted as /. Before it was not possible, because unmounting / was not possible. MFC r227768 (pjd): Include only when compiling kernel module. MFC r226700 (pjd): Don't forget to rename mounted snapshots of the file system being renamed. MFC r226705 (pjd): Extend r226676 to allow rename without unmount even for file systems with non-legacy mountpoints. It is better to be able to rename such file systems and let them be mounted in old places until next reboot than using live CD, etc. to rename with remount. This is implemented by adding -u option to 'zfs rename'. If file system's mountpoint property is set to 'legacy' or 'none', there is no need to specify -u. Update zfs(8) manual page to reflect this addition. MFC r226706 (pjd): Update copyright to include myself. MFC r226707 (pjd): - Use better naming now that we allow to rename any mounted file system (not only legacy). - Update copyright to include myself. Approved by: pjd Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 09:39:29 2012 (r229566) @@ -76,6 +76,11 @@ zfs \- configures ZFS file systems .LP .nf +\fBzfs\fR \fBrename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR +.fi + +.LP +.nf \fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]] [\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ... .fi @@ -1479,6 +1484,10 @@ The snapshot that was cloned, and any sn .na \fB\fBzfs rename\fR [\fB-p\fR] \fIfilesystem\fR|\fIvolume\fR \fIfilesystem\fR|\fIvolume\fR\fR .ad +.br +.na +\fB\fBzfs rename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR\fR +.ad .sp .6 .RS 4n Renames the given dataset. The new target can be located anywhere in the \fBZFS\fR hierarchy, with the exception of snapshots. Snapshots can only be renamed within the parent file system or volume. When renaming a snapshot, the parent file system of the snapshot does not need to be specified as part of the second argument. Renamed file systems can inherit new mount points, in which case they are unmounted and remounted at the new mount point. @@ -1493,6 +1502,17 @@ Renames the given dataset. The new targe Creates all the nonexistent parent datasets. Datasets created in this manner are automatically mounted according to the \fBmountpoint\fR property inherited from their parent. .RE +.sp +.ne 2 +.mk +.na +\fB\fB-u\fR\fR +.ad +.sp .6 +.RS 4n +Do not remount file systems during rename. If a file system's \fBmountpoint\fR property is set to \fBlegacy\fR or \fBnone\fR, file system is not unmounted even if this option is not given. +.RE + .RE .sp Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 09:39:29 2012 (r229566) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -253,7 +255,8 @@ get_usage(zfs_help_t idx) return (gettext("\trename " "\n" "\trename -p \n" - "\trename -r ")); + "\trename -r \n" + "\trename -u [-p] ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: @@ -2852,6 +2855,7 @@ zfs_do_list(int argc, char **argv) * zfs rename * zfs rename -p * zfs rename -r + * zfs rename -u [-p] * * Renames the given dataset to another of the same type. * @@ -2862,19 +2866,21 @@ static int zfs_do_rename(int argc, char **argv) { zfs_handle_t *zhp; - int c; - int ret; - boolean_t recurse = B_FALSE; + renameflags_t flags = { 0 }; + int c, ret, types; boolean_t parents = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, "pr")) != -1) { + while ((c = getopt(argc, argv, "pru")) != -1) { switch (c) { case 'p': parents = B_TRUE; break; case 'r': - recurse = B_TRUE; + flags.recurse = B_TRUE; + break; + case 'u': + flags.nounmount = B_TRUE; break; case '?': default: @@ -2903,20 +2909,32 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } - if (recurse && parents) { + if (flags.recurse && parents) { (void) fprintf(stderr, gettext("-p and -r options are mutually " "exclusive\n")); usage(B_FALSE); } - if (recurse && strchr(argv[0], '@') == 0) { + if (flags.recurse && strchr(argv[0], '@') == 0) { (void) fprintf(stderr, gettext("source dataset for recursive " "rename must be a snapshot\n")); usage(B_FALSE); } - if ((zhp = zfs_open(g_zfs, argv[0], parents ? ZFS_TYPE_FILESYSTEM | - ZFS_TYPE_VOLUME : ZFS_TYPE_DATASET)) == NULL) + if (flags.nounmount && parents) { + (void) fprintf(stderr, gettext("-u and -r options are mutually " + "exclusive\n")); + usage(B_FALSE); + } + + if (flags.nounmount) + types = ZFS_TYPE_FILESYSTEM; + else if (parents) + types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME; + else + types = ZFS_TYPE_DATASET; + + if ((zhp = zfs_open(g_zfs, argv[0], types)) == NULL) return (1); /* If we were asked and the name looks good, try to create ancestors. */ @@ -2926,7 +2944,7 @@ zfs_do_rename(int argc, char **argv) return (1); } - ret = (zfs_rename(zhp, argv[1], recurse) != 0); + ret = (zfs_rename(zhp, argv[1], flags) != 0); zfs_close(zhp); return (ret); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 09:39:29 2012 (r229566) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _LIBZFS_H @@ -517,7 +519,16 @@ extern int zfs_destroy_snaps(zfs_handle_ extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *); extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); -extern int zfs_rename(zfs_handle_t *, const char *, boolean_t); + +typedef struct renameflags { + /* recursive rename */ + int recurse : 1; + + /* don't unmount file systems */ + int nounmount : 1; +} renameflags_t; + +extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags); typedef struct sendflags { /* print informational messages (ie, -v was specified) */ Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Thu Jan 5 09:39:29 2012 (r229566) @@ -24,6 +24,9 @@ * Use is subject to license terms. * * Portions Copyright 2007 Ramprakash Jelari + * + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -122,6 +125,8 @@ changelist_prefix(prop_changelist_t *clp */ switch (clp->cl_prop) { case ZFS_PROP_MOUNTPOINT: + if (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) + break; if (zfs_unmount(cn->cn_handle, NULL, clp->cl_mflags) != 0) { ret = -1; @@ -168,8 +173,10 @@ changelist_postfix(prop_changelist_t *cl if ((cn = uu_list_last(clp->cl_list)) == NULL) return (0); - if (clp->cl_prop == ZFS_PROP_MOUNTPOINT) + if (clp->cl_prop == ZFS_PROP_MOUNTPOINT && + !(clp->cl_gflags & CL_GATHER_DONT_UNMOUNT)) { remove_mountpoint(cn->cn_handle); + } /* * It is possible that the changelist_prefix() used libshare @@ -224,7 +231,8 @@ changelist_postfix(prop_changelist_t *cl shareopts, sizeof (shareopts), NULL, NULL, 0, B_FALSE) == 0) && (strcmp(shareopts, "off") != 0)); - mounted = zfs_is_mounted(cn->cn_handle, NULL); + mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) || + zfs_is_mounted(cn->cn_handle, NULL); if (!mounted && (cn->cn_mounted || ((sharenfs || sharesmb || clp->cl_waslegacy) && Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 5 09:39:29 2012 (r229566) @@ -23,6 +23,8 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -3480,7 +3482,7 @@ zfs_iter_dependents(zfs_handle_t *zhp, b * Renames the given dataset. */ int -zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive) +zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags) { int ret; zfs_cmd_t zc = { 0 }; @@ -3489,6 +3491,7 @@ zfs_rename(zfs_handle_t *zhp, const char zfs_handle_t *zhrp = NULL; char *parentname = NULL; char parent[ZFS_MAXNAMELEN]; + char property[ZFS_MAXPROPLEN]; libzfs_handle_t *hdl = zhp->zfs_hdl; char errbuf[1024]; @@ -3535,7 +3538,7 @@ zfs_rename(zfs_handle_t *zhp, const char if (!zfs_validate_name(hdl, target, zhp->zfs_type, B_TRUE)) return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); } else { - if (recursive) { + if (flags.recurse) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "recursive rename must be a snapshot")); return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); @@ -3576,7 +3579,20 @@ zfs_rename(zfs_handle_t *zhp, const char return (zfs_error(hdl, EZFS_ZONED, errbuf)); } - if (recursive) { + /* + * Avoid unmounting file systems with mountpoint property set to + * 'legacy' or 'none' even if -u option is not given. + */ + if (zhp->zfs_type == ZFS_TYPE_FILESYSTEM && + !flags.recurse && !flags.nounmount && + zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, property, + sizeof (property), NULL, NULL, 0, B_FALSE) == 0 && + (strcmp(property, "legacy") == 0 || + strcmp(property, "none") == 0)) { + flags.nounmount = B_TRUE; + } + + if (flags.recurse) { parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name); if (parentname == NULL) { @@ -3592,8 +3608,10 @@ zfs_rename(zfs_handle_t *zhp, const char } } else { - if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0)) == NULL) + if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, + flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, 0)) == NULL) { return (-1); + } if (changelist_haszonedchild(cl)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -3615,7 +3633,9 @@ zfs_rename(zfs_handle_t *zhp, const char (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); (void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value)); - zc.zc_cookie = recursive; + zc.zc_cookie = flags.recurse ? 1 : 0; + if (flags.nounmount) + zc.zc_cookie |= 2; if ((ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)) != 0) { /* @@ -3625,7 +3645,7 @@ zfs_rename(zfs_handle_t *zhp, const char (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rename '%s'"), zc.zc_name); - if (recursive && errno == EEXIST) { + if (flags.recurse && errno == EEXIST) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "a child dataset already has a snapshot " "with the new name")); @@ -3638,10 +3658,10 @@ zfs_rename(zfs_handle_t *zhp, const char * On failure, we still want to remount any filesystems that * were previously mounted, so we don't alter the system state. */ - if (!recursive) + if (!flags.recurse) (void) changelist_postfix(cl); } else { - if (!recursive) { + if (!flags.recurse) { changelist_rename(cl, zfs_get_name(zhp), target); ret = changelist_postfix(cl); } Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Jan 5 09:39:29 2012 (r229566) @@ -21,6 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _LIBFS_IMPL_H @@ -158,7 +160,11 @@ int zprop_expand_list(libzfs_handle_t *h * on each change node regardless of whether or not it is currently * mounted. */ -#define CL_GATHER_MOUNT_ALWAYS 1 +#define CL_GATHER_MOUNT_ALWAYS 0x01 +/* + * Use this changelist_gather() flag to prevent unmounting of file systems. + */ +#define CL_GATHER_DONT_UNMOUNT 0x02 typedef struct prop_changelist prop_changelist_t; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jan 5 09:39:29 2012 (r229566) @@ -21,6 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -2461,7 +2463,7 @@ dsl_valid_rename(const char *oldname, vo #pragma weak dmu_objset_rename = dsl_dataset_rename int -dsl_dataset_rename(char *oldname, const char *newname, boolean_t recursive) +dsl_dataset_rename(char *oldname, const char *newname, int flags) { dsl_dir_t *dd; dsl_dataset_t *ds; @@ -2481,7 +2483,7 @@ dsl_dataset_rename(char *oldname, const &delta, DS_FIND_CHILDREN | DS_FIND_SNAPSHOTS); if (err == 0) - err = dsl_dir_rename(dd, newname); + err = dsl_dir_rename(dd, newname, flags); dsl_dir_close(dd, FTAG); return (err); } @@ -2502,7 +2504,7 @@ dsl_dataset_rename(char *oldname, const if (strncmp(oldname, newname, tail - newname) != 0) return (EXDEV); - if (recursive) { + if (flags & ZFS_RENAME_RECURSIVE) { err = dsl_recursive_rename(oldname, newname); } else { err = dsl_dataset_hold(oldname, FTAG, &ds); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -37,6 +39,9 @@ #include #include #include +#ifdef _KERNEL +#include +#endif #include "zfs_namecheck.h" static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd); @@ -1245,6 +1250,7 @@ would_change(dsl_dir_t *dd, int64_t delt struct renamearg { dsl_dir_t *newparent; const char *mynewname; + boolean_t allowmounted; }; static int @@ -1263,9 +1269,12 @@ dsl_dir_rename_check(void *arg1, void *a * stats), but any that are present in open context will likely * be gone by syncing context, so only fail from syncing * context. + * Don't check if we allow renaming of busy (mounted) dataset. */ - if (dmu_tx_is_syncing(tx) && dmu_buf_refcount(dd->dd_dbuf) > 1) + if (!ra->allowmounted && dmu_tx_is_syncing(tx) && + dmu_buf_refcount(dd->dd_dbuf) > 1) { return (EBUSY); + } /* check for existing name */ err = zap_lookup(mos, ra->newparent->dd_phys->dd_child_dir_zapobj, @@ -1302,7 +1311,7 @@ dsl_dir_rename_sync(void *arg1, void *ar objset_t *mos = dp->dp_meta_objset; int err; - ASSERT(dmu_buf_refcount(dd->dd_dbuf) <= 2); + ASSERT(ra->allowmounted || dmu_buf_refcount(dd->dd_dbuf) <= 2); if (ra->newparent != dd->dd_parent) { dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD, @@ -1345,6 +1354,7 @@ dsl_dir_rename_sync(void *arg1, void *ar ASSERT3U(err, ==, 0); dsl_dir_name(dd, newname); #ifdef _KERNEL + zfsvfs_update_fromname(oldname, newname); zvol_rename_minors(oldname, newname); #endif @@ -1353,7 +1363,7 @@ dsl_dir_rename_sync(void *arg1, void *ar } int -dsl_dir_rename(dsl_dir_t *dd, const char *newname) +dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags) { struct renamearg ra; int err; @@ -1375,6 +1385,8 @@ dsl_dir_rename(dsl_dir_t *dd, const char goto out; } + ra.allowmounted = !!(flags & ZFS_RENAME_ALLOW_MOUNTED); + err = dsl_sync_task_do(dd->dd_pool, dsl_dir_rename_check, dsl_dir_rename_sync, dd, &ra, 3); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_DSL_DATASET_H @@ -178,6 +180,12 @@ struct dsl_ds_holdarg { char failed[MAXPATHLEN]; }; +/* + * Flags for dsl_dataset_rename(). + */ +#define ZFS_RENAME_RECURSIVE 0x01 +#define ZFS_RENAME_ALLOW_MOUNTED 0x02 + #define dsl_dataset_is_snapshot(ds) \ ((ds)->ds_phys->ds_num_children != 0) @@ -211,7 +219,7 @@ dsl_syncfunc_t dsl_dataset_destroy_sync; dsl_checkfunc_t dsl_dataset_snapshot_check; dsl_syncfunc_t dsl_dataset_snapshot_sync; dsl_syncfunc_t dsl_dataset_user_hold_sync; -int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive); +int dsl_dataset_rename(char *name, const char *newname, int flags); int dsl_dataset_promote(const char *name, char *conflsnap); int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head, boolean_t force); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_DSL_DIR_H @@ -131,7 +133,7 @@ int dsl_dir_set_quota(const char *ddname uint64_t quota); int dsl_dir_set_reservation(const char *ddname, zprop_source_t source, uint64_t reservation); -int dsl_dir_rename(dsl_dir_t *dd, const char *newname); +int dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags); int dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space); int dsl_dir_set_reservation_check(void *arg1, void *arg2, dmu_tx_t *tx); boolean_t dsl_dir_is_clone(dsl_dir_t *dd); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_FS_ZFS_VFSOPS_H @@ -153,6 +155,10 @@ extern void zfsvfs_free(zfsvfs_t *zfsvfs extern int zfs_check_global_label(const char *dsname, const char *hexsl); extern int zfs_vnode_lock(vnode_t *vp, int flags); +#ifdef _KERNEL +extern void zfsvfs_update_fromname(const char *oldname, const char *newname); +#endif + #ifdef __cplusplus } #endif Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ /* @@ -785,7 +787,7 @@ zfsctl_snapdir_rename(vnode_t *sdvp, cha return (ENOENT); } - err = dmu_objset_rename(from, to, B_FALSE); + err = dmu_objset_rename(from, to, 0); if (err == 0) zfsctl_rename_snap(sdp, sep, tnm); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. * Portions Copyright 2011 Martin Matuska */ @@ -3262,7 +3264,12 @@ out: static int zfs_ioc_rename(zfs_cmd_t *zc) { - boolean_t recursive = zc->zc_cookie & 1; + int flags = 0; + + if (zc->zc_cookie & 1) + flags |= ZFS_RENAME_RECURSIVE; + if (zc->zc_cookie & 2) + flags |= ZFS_RENAME_ALLOW_MOUNTED; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || @@ -3274,13 +3281,14 @@ zfs_ioc_rename(zfs_cmd_t *zc) * in which case the dataset code figures out which snapshots * to unmount. */ - if (!recursive && strchr(zc->zc_name, '@') != NULL && + if (!(flags & ZFS_RENAME_RECURSIVE) && + strchr(zc->zc_name, '@') != NULL && zc->zc_objset_type == DMU_OST_ZFS) { int err = zfs_unmount_snap(zc->zc_name, NULL); if (err) return (err); } - return (dmu_objset_rename(zc->zc_name, zc->zc_value, recursive)); + return (dmu_objset_rename(zc->zc_name, zc->zc_value, flags)); } static int Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -2416,3 +2418,35 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t } return (error); } + +#ifdef _KERNEL +void +zfsvfs_update_fromname(const char *oldname, const char *newname) +{ + char tmpbuf[MAXPATHLEN]; + struct mount *mp; + char *fromname; + size_t oldlen; + + oldlen = strlen(oldname); + + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + fromname = mp->mnt_stat.f_mntfromname; + if (strcmp(fromname, oldname) == 0) { + (void)strlcpy(fromname, newname, + sizeof(mp->mnt_stat.f_mntfromname)); + continue; + } + if (strncmp(fromname, oldname, oldlen) == 0 && + (fromname[oldlen] == '/' || fromname[oldlen] == '@')) { + (void)snprintf(tmpbuf, sizeof(tmpbuf), "%s%s", + newname, fromname + oldlen); + (void)strlcpy(fromname, tmpbuf, + sizeof(mp->mnt_stat.f_mntfromname)); + continue; + } + } + mtx_unlock(&mountlist_mtx); +} +#endif From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 09:50:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B71C3106564A; Thu, 5 Jan 2012 09:50:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A01D28FC0C; Thu, 5 Jan 2012 09:50:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q059olYe025010; Thu, 5 Jan 2012 09:50:47 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q059olU0025008; Thu, 5 Jan 2012 09:50:47 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050950.q059olU0025008@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 09:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229567 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 09:50:47 -0000 Author: mm Date: Thu Jan 5 09:50:47 2012 New Revision: 229567 URL: http://svn.freebsd.org/changeset/base/229567 Log: MFC r227110, r227111: MFC r227110 (pjd) [1]: In zvol_open() if the spa_namespace_lock is already held, it means that ZFS is trying to open and taste ZVOL as its VDEV. This is not supported, so return an error instead of panicing on spa_namespace_lock recursion. MFC r227111 (pjd) [2]: Correct typo in comment. PR: kern/162008 Reported by: Robert Millan [1] Fabian Keil [2] Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jan 5 09:39:29 2012 (r229566) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jan 5 09:50:47 2012 (r229567) @@ -875,6 +875,14 @@ zvol_open(struct g_provider *pp, int fla zvol_state_t *zv; int err = 0; + if (MUTEX_HELD(&spa_namespace_lock)) { + /* + * If the spa_namespace_lock is being held, it means that ZFS + * is trying to open ZVOL as its VDEV. This is not supported. + */ + return (EOPNOTSUPP); + } + mutex_enter(&spa_namespace_lock); zv = pp->private; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 10:09:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F8E11065677; Thu, 5 Jan 2012 10:09:23 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F09B8FC08; Thu, 5 Jan 2012 10:09:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05A9NZw025829; Thu, 5 Jan 2012 10:09:23 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05A9NeQ025826; Thu, 5 Jan 2012 10:09:23 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051009.q05A9NeQ025826@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229569 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 10:09:23 -0000 Author: mm Date: Thu Jan 5 10:09:22 2012 New Revision: 229569 URL: http://svn.freebsd.org/changeset/base/229569 Log: MFC r226620, r228392: MFC r226620 (pjd): Update per-thread I/O statistics collection in ZFS. This allows to see processes I/O activity in 'top -m io' output. MFC r228392 (pjd): Move ru_inblock increment into arc_read_nolock() so we don't account for cached reads. PR: kern/156218 Reported by: Marcus Reid Patch by: avg Approved by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 10:03:14 2012 (r229568) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 10:09:22 2012 (r229569) @@ -3103,6 +3103,9 @@ top: ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, data, metadata, misses); +#ifdef _KERNEL + curthread->td_ru.ru_inblock++; +#endif if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 5 10:03:14 2012 (r229568) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 5 10:09:22 2012 (r229569) @@ -397,9 +397,12 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, return (EIO); } /* initiate async i/o */ - if (read) { + if (read) (void) dbuf_read(db, zio, dbuf_flags); - } +#ifdef _KERNEL + else + curthread->td_ru.ru_oublock++; +#endif dbp[i] = &db->db; } rw_exit(&dn->dn_struct_rwlock); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 10:24:07 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76EA6106566C; Thu, 5 Jan 2012 10:24:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F8DE8FC14; Thu, 5 Jan 2012 10:24:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05AO7Sp026472; Thu, 5 Jan 2012 10:24:07 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AO76V026468; Thu, 5 Jan 2012 10:24:07 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051024.q05AO76V026468@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229570 - in stable/8/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 10:24:07 -0000 Author: mm Date: Thu Jan 5 10:24:06 2012 New Revision: 229570 URL: http://svn.freebsd.org/changeset/base/229570 Log: MFC r224171 (gibbs): Add the "zpool labelclear" command. This command can be used to wipe the label data from a drive that is not active in a pool. The optional "-f" argument can be used to treat an exported or foreign vdev as "inactive" thus allowing its label information to be cleared. Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 10:09:22 2012 (r229569) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 10:24:06 2012 (r229570) @@ -82,6 +82,11 @@ zpool \- configures ZFS storage pools .LP .nf +\fBzpool labelclear\fR [\fB-f\fR] \fIdevice\fR +.fi + +.LP +.nf \fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIproperty\fR[,...]] [\fIpool\fR] ... .fi @@ -1205,6 +1210,28 @@ Verbose statistics. Reports usage statis .ne 2 .mk .na +\fB\fBzpool labelclear\fR [\fB-f\fR] \fIdevice\fR +.ad +.sp .6 +.RS 4n +Removes ZFS label information from the specified device. The device must not be part of an active pool configuration. +.sp +.ne 2 +.mk +.na +\fB\fB-f\fR\fR +.ad +.RS 12n +.rt +Treat exported or foreign devices as inactive. +.RE + +.RE + +.sp +.ne 2 +.mk +.na \fB\fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIprops\fR[,...]] [\fIpool\fR] ...\fR .ad .sp .6 Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 10:09:22 2012 (r229569) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 10:24:06 2012 (r229570) @@ -58,6 +58,7 @@ static int zpool_do_destroy(int, char ** static int zpool_do_add(int, char **); static int zpool_do_remove(int, char **); +static int zpool_do_labelclear(int, char **); static int zpool_do_list(int, char **); static int zpool_do_iostat(int, char **); @@ -114,6 +115,7 @@ typedef enum { HELP_HISTORY, HELP_IMPORT, HELP_IOSTAT, + HELP_LABELCLEAR, HELP_LIST, HELP_OFFLINE, HELP_ONLINE, @@ -150,6 +152,8 @@ static zpool_command_t command_table[] = { "add", zpool_do_add, HELP_ADD }, { "remove", zpool_do_remove, HELP_REMOVE }, { NULL }, + { "labelclear", zpool_do_labelclear, HELP_LABELCLEAR }, + { NULL }, { "list", zpool_do_list, HELP_LIST }, { "iostat", zpool_do_iostat, HELP_IOSTAT }, { "status", zpool_do_status, HELP_STATUS }, @@ -216,6 +220,8 @@ get_usage(zpool_help_t idx) { case HELP_IOSTAT: return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " "[count]]\n")); + case HELP_LABELCLEAR: + return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: return (gettext("\tlist [-H] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); @@ -561,6 +567,125 @@ zpool_do_remove(int argc, char **argv) } /* + * zpool labelclear + * + * Verifies that the vdev is not active and zeros out the label information + * on the device. + */ +int +zpool_do_labelclear(int argc, char **argv) +{ + char *vdev, *name; + int c, fd = -1, ret = 0; + pool_state_t state; + boolean_t inuse = B_FALSE; + boolean_t force = B_FALSE; + + /* check options */ + while ((c = getopt(argc, argv, "f")) != -1) { + switch (c) { + case 'f': + force = B_TRUE; + break; + default: + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* get vdev name */ + if (argc < 1) { + (void) fprintf(stderr, gettext("missing vdev device name\n")); + usage(B_FALSE); + } + + vdev = argv[0]; + if ((fd = open(vdev, O_RDWR)) < 0) { + (void) fprintf(stderr, gettext("Unable to open %s\n"), vdev); + return (B_FALSE); + } + + name = NULL; + if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0) { + if (force) + goto wipe_label; + + (void) fprintf(stderr, + gettext("Unable to determine pool state for %s\n" + "Use -f to force the clearing any label data\n"), vdev); + + return (1); + } + + if (inuse) { + switch (state) { + default: + case POOL_STATE_ACTIVE: + case POOL_STATE_SPARE: + case POOL_STATE_L2CACHE: + (void) fprintf(stderr, +gettext("labelclear operation failed.\n" + "\tVdev %s is a member (%s), of pool \"%s\".\n" + "\tTo remove label information from this device, export or destroy\n" + "\tthe pool, or remove %s from the configuration of this pool\n" + "\tand retry the labelclear operation\n"), + vdev, zpool_pool_state_to_name(state), name, vdev); + ret = 1; + goto errout; + + case POOL_STATE_EXPORTED: + if (force) + break; + + (void) fprintf(stderr, +gettext("labelclear operation failed.\n" + "\tVdev %s is a member of the exported pool \"%s\".\n" + "\tUse \"zpool labelclear -f %s\" to force the removal of label\n" + "\tinformation.\n"), + vdev, name, vdev); + ret = 1; + goto errout; + + case POOL_STATE_POTENTIALLY_ACTIVE: + if (force) + break; + + (void) fprintf(stderr, +gettext("labelclear operation failed.\n" + "\tVdev %s is a member of the pool \"%s\".\n" + "\tThis pool is unknown to this system, but may be active on\n" + "\tanother system. Use \'zpool labelclear -f %s\' to force the\n" + "\tremoval of label information.\n"), + vdev, name, vdev); + ret = 1; + goto errout; + + case POOL_STATE_DESTROYED: + /* inuse should never be set for a destoryed pool... */ + break; + } + } + +wipe_label: + if (zpool_clear_label(fd) != 0) { + (void) fprintf(stderr, + gettext("Label clear failed on vdev %s\n"), vdev); + ret = 1; + } + +errout: + close(fd); + if (name != NULL) + free(name); + + return (ret); +} + +/* * zpool create [-fn] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Jan 5 10:09:22 2012 (r229569) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Jan 5 10:24:06 2012 (r229570) @@ -1084,8 +1084,8 @@ zpool_open_func(void *arg) /* * Given a file descriptor, clear (zero) the label information. This function - * is currently only used in the appliance stack as part of the ZFS sysevent - * module. + * is used in the appliance stack as part of the ZFS sysevent module and + * to implement the "zpool labelclear" command. */ int zpool_clear_label(int fd) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 10:55:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B211E1065676; Thu, 5 Jan 2012 10:55:55 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 999188FC1E; Thu, 5 Jan 2012 10:55:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05Attpq030201; Thu, 5 Jan 2012 10:55:55 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AttM3030197; Thu, 5 Jan 2012 10:55:55 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051055.q05AttM3030197@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229577 - in stable/8/cddl/contrib/opensolaris/cmd: zdb zfs zpool zstreamdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 10:55:55 -0000 Author: mm Date: Thu Jan 5 10:55:55 2012 New Revision: 229577 URL: http://svn.freebsd.org/changeset/base/229577 Log: MFC zfs manpage update (r227646, r227648, r227649, r227752, r228019, r228045, r228054, r228055) MFC r227646 (partial): Update and desolarization of zfs(8) and zpool(8) manual pages: - synchronized to match new vendor code (Illumos rev. 13513) [1] - removed references to sun commands (replaced with FreeBSD commands) - removed ATTRIBUTES sections - updated SEE ALSO sections - properly updated copyright information (required by CDDL) zfs(8) only: - replaced "Zones" section with new "Jails" section - removed misleading "ZFS Volumes as Swap or Dump Devices" section - updated shareiscsi and sharesmb option information (not supported on FreeBSD) - replace zoned property with jailed property zpool(8) only: - updated device names in examples MFC r227648: Fix reference to fsync(2). Add more references to SEE ALSO section. MFC r227649: More zfs(8) manpage fixes: - remove shareiscsi property - mark casesensitivity property as unsupported - remove reference to Solaris Administration Guide MFC r227752 (partial): Update and desolarization of zdb(8) and zstreamdump(1) manual pages: - synchronized to match new vendor code [1] - removed ATTRIBUTES sections - updated SEE ALSO sections - properly updated copyright information (required by CDDL) MFC r228019: Update ZFS manual pages to a mdoc(7) reimplementation. The zfs(8) and zpool(8) manual pages now match the state of the ZFS module and have been customized for FreeBSD. The new texts of the "Deduplication" subsection in zfs(8), the zpool "split" command, the zfs "dedup" property and several other missing parts have been added from illumos or OpenSolaris snv_134 (CDDL-licensed). The mdoc(7) reimplementation of whole manual pages, the descriptions of the zpool "readonly" property, "zfs diff" command and descriptions of several other missing command flags and/or options were authored by myself. MFC r228045: Add missing -n flag to "zpool import" description. MFC r228054: Add missing warning to zfs(8) for using "zfs destroy" with -r and -R flags. MFC r228055: Use singular form for zfs destroy snapshot in zfs(8). Obtained from: Illumos (as of rev. 13513:f84d4672fdbd) [1] Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Jan 5 10:55:17 2012 (r229576) +++ stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Jan 5 10:55:55 2012 (r229577) @@ -1,84 +1,79 @@ '\" te +.\" Copyright (c) 2011, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH zdb 1M "31 Oct 2005" "SunOS 5.11" "System Administration Commands" -.SH NAME -zdb \- ZFS debugger -.SH SYNOPSIS -.LP -.nf -\fBzdb\fR \fIpool\fR -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer. -.sp -.LP -If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected. -.sp -.LP -Any options supported by this command are internal to Sun and subject to change at any time. -.SH EXIT STATUS -.sp -.LP +.\" +.\" $FreeBSD$ +.\" +.Dd November 26, 2011 +.Dt ZDB 8 +.Os +.Sh NAME +.Nm zdb +.Nd ZFS debugger +.Sh SYNOPSIS +.Nm +.Ar pool +.Sh DESCRIPTION +The +.Nm +command is used by support engineers to diagnose failures and +gather statistics. Since the +.Tn ZFS +file system is always consistent on disk and is self-repairing, +.Nm +should only be run under the direction by a support engineer. +.Pp +If no arguments are specified, +.Nm +performs basic consistency checks on the pool and associated datasets, and +report any problems detected. +.Nm +Any options supported by this command are internal to Sun and subject to change +at any time. +.Sh EXIT STATUS The following exit values are returned: -.sp -.ne 2 -.mk -.na -\fB\fB0\fR\fR -.ad -.RS 5n -.rt +.Bl -tag -offset 2n -width 2n +.It 0 The pool is consistent. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB1\fR\fR -.ad -.RS 5n -.rt +.It 1 An error was detected. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB2\fR\fR -.ad -.RS 5n -.rt +.It 2 Invalid command line options were specified. -.RE - -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp -.TS -tab() box; -cw(2.75i) |cw(2.75i) -lw(2.75i) |lw(2.75i) -. -ATTRIBUTE TYPEATTRIBUTE VALUE -_ -AvailabilitySUNWzfsu -_ -Interface StabilityUnstable -.TE - -.SH SEE ALSO -.sp -.LP -\fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5) +.El +.Sh SEE ALSO +.Xr zfs 8 , +.Xr zpool 8 +.Sh AUTHORS +This manual page is a +.Xr mdoc 7 +reimplementation of the +.Tn OpenSolaris +manual page +.Em zdb(1M) , +modified and customized for +.Fx +and licensed under the +.Tn Common Development and Distribution License +.Pq Tn CDDL . +.Pp +The +.Xr mdoc 7 +implementation of this manual page was initially written by +.An Martin Matuska Aq mm@FreeBSD.org . Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:55:17 2012 (r229576) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:55:55 2012 (r229577) @@ -1,2701 +1,2726 @@ '\" te -.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.\" Copyright (c) 2011, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. -.\" Copyright 2011 by Delphix. All rights reserved. -.TH zfs 1M "24 Sep 2009" "SunOS 5.11" "System Administration Commands" -.SH NAME -zfs \- configures ZFS file systems -.SH SYNOPSIS -.LP -.nf -\fBzfs\fR [\fB-?\fR] -.fi - -.LP -.nf -\fBzfs\fR \fBcreate\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBcreate\fR [\fB-ps\fR] [\fB-b\fR \fIblocksize\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fB-V\fR \fIsize\fR \fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBdestroy\fR [\fB-rRf\fR] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBdestroy\fR [\fB-rRd\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBsnapshot\fR [\fB-r\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... - \fIfilesystem@snapname\fR|\fIvolume@snapname\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrollback\fR [\fB-rRf\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBclone\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fIsnapshot\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBpromote\fR \fIclone-filesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR - \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR [\fB-p\fR] \fIfilesystem\fR|\fIvolume\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fB-r\fR \fIsnapshot\fR \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]] - [\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ... -.fi - -.LP -.nf -\fBzfs\fR \fBset\fR \fIproperty\fR=\fIvalue\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBget\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR \fIfield\fR[,...]] [\fB-s\fR \fIsource\fR[,...]] - "\fIall\fR" | \fIproperty\fR[,...] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBinherit\fR [\fB-r\fR] \fIproperty\fR \fIfilesystem\fR|\fIvolume|snapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBupgrade\fR [\fB-v\fR] -.fi - -.LP -.nf -\fBzfs\fR \fBupgrade\fR [\fB-r\fR] [\fB-V\fR \fIversion\fR] \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBuserspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBgroupspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBmount\fR -.fi - -.LP -.nf -\fBzfs\fR \fBmount\fR [\fB-vO\fR] [\fB-o \fIoptions\fR\fR] \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunmount\fR [\fB-f\fR] \fB-a\fR | \fIfilesystem\fR|\fImountpoint\fR -.fi - -.LP -.nf -\fBzfs\fR \fBshare\fR \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunshare\fR \fB-a\fR \fIfilesystem\fR|\fImountpoint\fR -.fi - -.LP -.nf -\fBzfs\fR \fBsend\fR [\fB-vR\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] \fB-d\fR \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR [\fB-ldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] \fIperm\fR|\fI@setname\fR[,...] - \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR [\fB-ld\fR] \fB-e\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fB-c\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fB-s\fR @\fIsetname\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-rldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] [\fIperm\fR|@\fIsetname\fR[,... ]] - \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-rld\fR] \fB-e\fR [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-r\fR] \fB-c\fR [\fIperm\fR|@\fIsetname\fR[ ... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-r\fR] \fB-s\fR @\fIsetname\fR [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBhold\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... -.fi - -.LP -.nf -\fBzfs\fR \fBholds\fR [\fB-r\fR] \fIsnapshot\fR... -.fi - -.LP -.nf -\fBzfs\fR \fBrelease\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... -.fi - -\fBzfs\fR \fBjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR -.fi -.LP -.nf -\fBzfs\fR \fBunjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage pool, as described in \fBzpool\fR(1M). A dataset is identified by a unique path within the \fBZFS\fR namespace. For example: -.sp -.in +2 -.nf -pool/{filesystem,volume,snapshot} -.fi -.in -2 -.sp - -.sp -.LP -where the maximum length of a dataset name is \fBMAXNAMELEN\fR (256 bytes). -.sp -.LP +.\" Copyright (c) 2011 by Delphix. All rights reserved. +.\" Copyright (c) 2011, Pawel Jakub Dawidek +.\" +.\" $FreeBSD$ +.\" +.Dd November 26, 2011 +.Dt ZFS 8 +.Os +.Sh NAME +.Nm zfs +.Nd configures ZFS file systems +.Sh SYNOPSIS +.Nm +.Op Fl \&? +.Nm +.Cm create +.Op Fl p +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... filesystem +.Nm +.Cm create +.Op Fl ps +.Op Fl b Ar blocksize +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... +.Fl V +.Ar size volume +.Nm +.Cm destroy +.Op Fl rRf +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm destroy +.Op Fl rRd +.Ar snapshot +.Nm +.Cm snapshot +.Op Fl r +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... filesystem@snapname Ns | Ns Ar volume@snapname +.Nm +.Cm rollback +.Op Fl rRf +.Ar snapshot +.Nm +.Cm clone +.Op Fl p +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... snapshot filesystem Ns | Ns Ar volume +.Nm +.Cm promote +.Ar clone-filesystem +.Nm +.Cm rename +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm rename +.Fl p +.Ar filesystem Ns | Ns Ar volume +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm rename +.Fl r +.Ar snapshot snapshot +.Nm +.Cm rename +.Fl u +.Op Fl p +.Ar filesystem filesystem +.Nm +.Cm list +.Op Fl r Ns | Ns Fl d Ar depth +.Op Fl H +.Op Fl o Ar property Ns Op , Ns Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Op Fl s Ar property +.Ar ... +.Op Fl S Ar property +.Ar ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm set +.Ar property Ns = Ns Ar value +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm get +.Op Fl r Ns | Ns Fl d Ar depth +.Op Fl Hp +.Op Fl o Ar all | field Ns Op , Ns Ar ... +.Op Fl s Ar source Ns Op , Ns Ar ... +.Ar all | property Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm inherit +.Op Fl rS +.Ar property +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm upgrade +.Op Fl v +.Nm +.Cm upgrade +.Op Fl r +.Op Fl V Ar version +.Fl a | Ar filesystem +.Nm +.Cm userspace +.Op Fl niHp +.Op Fl o Ar field Ns Op , Ns Ar ... +.Op Fl sS Ar field +.Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar snapshot +.Nm +.Cm groupspace +.Op Fl niHp +.Op Fl o Ar field Ns Op , Ns Ar ... +.Op Fl sS Ar field +.Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar snapshot +.Nm +.Cm mount +.Nm +.Cm mount +.Op Fl vO +.Op Fl o Ar property Ns Op , Ns Ar ... +.Fl a | Ar filesystem +.Nm +.Cm unmount +.Op Fl f +.Fl a | Ar filesystem Ns | Ns Ar mountpoint +.Nm +.Cm share +.Fl a | Ar filesystem +.Nm +.Cm unshare +.Fl a | Ar filesystem Ns | Ns Ar mountpoint +.Nm +.Cm send +.Op Fl DvRp +.Op Fl i Ar snapshot | Fl I Ar snapshot +.Ar snapshot +.Nm +.Cm receive +.Op Fl vnFu +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm receive +.Op Fl vnFu +.Op Fl d | e +.Ar filesystem +.Nm +.Cm allow +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Op Fl ldug +.Cm everyone Ns | Ns Ar user Ns | Ns Ar group Ns Op , Ns Ar ... +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Op Fl ld +.Fl e +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Fl c +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Fl s +.Ar @setname +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl rldug +.Cm everyone Ns | Ns Ar user Ns | Ns Ar group Ns Op , Ns Ar ... +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl rld +.Fl e +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl r +.Fl c +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl r +.Fl s +.Ar @setname +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm hold +.Op Fl r +.Ar tag snapshot ... +.Nm +.Cm holds +.Op Fl r +.Ar snapshot ... +.Nm +.Cm release +.Op Fl r +.Ar tag snapshot ... +.Nm +.Cm diff +.Op Fl FHt +.Ar snapshot +.Op Ar snapshot Ns | Ns Ar filesystem +.Nm +.Cm jail +.Ar jailid filesystem +.Nm +.Cm unjail +.Ar jailid filesystem +.Sh DESCRIPTION +The +.Nm +command configures +.Tn ZFS +datasets within a +.Tn ZFS +storage pool, as described in +.Xr zpool 8 . +A dataset is identified by a unique path within the +.Tn ZFS +namespace. For example: +.Bd -ragged -offset 4n +.No pool/ Ns Brq filesystem,volume,snapshot +.Ed +.Pp +where the maximum length of a dataset name is +.Dv MAXNAMELEN +(256 bytes). +.Pp A dataset can be one of the following: -.sp -.ne 2 -.mk -.na -\fB\fIfile system\fR\fR -.ad -.sp .6 -.RS 4n -A \fBZFS\fR dataset of type \fBfilesystem\fR can be mounted within the standard system namespace and behaves like other file systems. While \fBZFS\fR file systems are designed to be \fBPOSIX\fR compliant, known issues exist that prevent compliance in some cases. Applications that depend on standards conformance might fail due to nonstandard behavior when checking file system free space. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fIvolume\fR\fR -.ad -.sp .6 -.RS 4n -A logical volume exported as a raw or block device. This type of dataset should only be used under special circumstances. File systems are typically used in most environments. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fIsnapshot\fR\fR -.ad -.sp .6 -.RS 4n -A read-only version of a file system or volume at a given point in time. It is specified as \fIfilesystem@name\fR or \fIvolume@name\fR. -.RE - -.SS "ZFS File System Hierarchy" -.sp -.LP -A \fBZFS\fR storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the \fBZFS\fR file system hierarchy. -.sp -.LP -The root of the pool can be accessed as a file system, such as mounting and unmounting, taking snapshots, and setting properties. The physical storage characteristics, however, are managed by the \fBzpool\fR(1M) command. -.sp -.LP -See \fBzpool\fR(1M) for more information on creating and administering pools. -.SS "Snapshots" -.sp -.LP -A snapshot is a read-only copy of a file system or volume. Snapshots can be created extremely quickly, and initially consume no additional space within the pool. As data within the active dataset changes, the snapshot consumes more data than would otherwise be shared with the active dataset. -.sp -.LP -Snapshots can have arbitrary names. Snapshots of volumes can be cloned or rolled back, but cannot be accessed independently. -.sp -.LP -File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory in the root of the file system. Snapshots are automatically mounted on demand and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR directory can be controlled by the \fBsnapdir\fR property. -.SS "Clones" -.sp -.LP -A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space. -.sp -.LP -Clones can only be created from a snapshot. When a snapshot is cloned, it creates an implicit dependency between the parent and child. Even though the clone is created somewhere else in the dataset hierarchy, the original snapshot cannot be destroyed as long as a clone exists. The \fBorigin\fR property exposes this dependency, and the \fBdestroy\fR command lists any such dependencies, if they exist. -.sp -.LP -The clone parent-child dependency relationship can be reversed by using the \fBpromote\fR subcommand. This causes the "origin" file system to become a clone of the specified file system, which makes it possible to destroy the file system that the clone was created from. -.SS "Mount Points" -.sp -.LP -Creating a \fBZFS\fR file system is a simple operation, so the number of file systems per system is likely to be numerous. To cope with this, \fBZFS\fR automatically manages mounting and unmounting file systems without the need to edit the \fB/etc/vfstab\fR file. All automatically managed file systems are mounted by \fBZFS\fR at boot time. -.sp -.LP -By default, file systems are mounted under \fB/\fIpath\fR\fR, where \fIpath\fR is the name of the file system in the \fBZFS\fR namespace. Directories are created and destroyed as needed. -.sp -.LP -A file system can also have a mount point set in the \fBmountpoint\fR property. This directory is created as needed, and \fBZFS\fR automatically mounts the file system when the \fBzfs mount -a\fR command is invoked (without editing \fB/etc/vfstab\fR). The \fBmountpoint\fR property can be inherited, so if \fBpool/home\fR has a mount point of \fB/export/stuff\fR, then \fBpool/home/user\fR automatically inherits a mount point of \fB/export/stuff/user\fR. -.sp -.LP -A file system \fBmountpoint\fR property of \fBnone\fR prevents the file system from being mounted. -.sp -.LP -If needed, \fBZFS\fR file systems can also be managed with traditional tools (\fBmount\fR, \fBumount\fR, \fB/etc/vfstab\fR). If a file system's mount point is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system. -.SS "Zones" -.sp -.LP -A \fBZFS\fR file system can be added to a non-global zone by using the \fBzonecfg\fR \fBadd fs\fR subcommand. A \fBZFS\fR file system that is added to a non-global zone must have its \fBmountpoint\fR property set to \fBlegacy\fR. -.sp -.LP -The physical properties of an added file system are controlled by the global administrator. However, the zone administrator can create, modify, or destroy files within the added file system, depending on how the file system is mounted. -.sp -.LP -A dataset can also be delegated to a non-global zone by using the \fBzonecfg\fR \fBadd dataset\fR subcommand. You cannot delegate a dataset to one zone and the children of the same dataset to another zone. The zone administrator can change properties of the dataset or any of its children. However, the \fBquota\fR property is controlled by the global administrator. -.sp -.LP -A \fBZFS\fR volume can be added as a device to a non-global zone by using the \fBzonecfg\fR \fBadd device\fR subcommand. However, its physical properties can be modified only by the global administrator. -.sp -.LP -For more information about \fBzonecfg\fR syntax, see \fBzonecfg\fR(1M). -.sp -.LP -After a dataset is delegated to a non-global zone, the \fBzoned\fR property is automatically set. A zoned file system cannot be mounted in the global zone, since the zone administrator might have to set the mount point to an unacceptable value. -.sp -.LP -The global administrator can forcibly clear the \fBzoned\fR property, though this should be done with extreme care. The global administrator should verify that all the mount points are acceptable before clearing the property. -.SS "Native Properties" -.sp -.LP -Properties are divided into two types, native properties and user-defined (or "user") properties. Native properties either export internal statistics or control \fBZFS\fR behavior. In addition, native properties are either editable or read-only. User properties have no effect on \fBZFS\fR behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about user properties, see the "User Properties" section, below. -.sp -.LP -Every dataset has a set of properties that export statistics about the dataset as well as control various behaviors. Properties are inherited from the parent unless overridden by the child. Some properties apply only to certain types of datasets (file systems, volumes, or snapshots). -.sp -.LP -The values of numeric properties can be specified using human-readable suffixes (for example, \fBk\fR, \fBKB\fR, \fBM\fR, \fBGb\fR, and so forth, up to \fBZ\fR for zettabyte). The following are all valid (and equal) specifications: -.sp -.in +2 -.nf +.Bl -hang -width 12n +.It Sy file system +A +.Tn ZFS +dataset of type +.Em filesystem +can be mounted within the standard system namespace and behaves like other file +systems. While +.Tn ZFS +file systems are designed to be +.Tn POSIX +compliant, known issues exist that prevent compliance in some cases. +Applications that depend on standards conformance might fail due to nonstandard +behavior when checking file system free space. +.It Sy volume +A logical volume exported as a raw or block device. This type of dataset should +only be used under special circumstances. File systems are typically used in +most environments. +.It Sy snapshot +A read-only version of a file system or volume at a given point in time. It is +specified as +.Em filesystem@name +or +.Em volume@name . +.El +.Ss ZFS File System Hierarchy +A +.Tn ZFS +storage pool is a logical collection of devices that provide space for +datasets. A storage pool is also the root of the +.Tn ZFS +file system hierarchy. +.Pp +The root of the pool can be accessed as a file system, such as mounting and +unmounting, taking snapshots, and setting properties. The physical storage +characteristics, however, are managed by the +.Xr zpool 8 +command. +.Pp +See +.Xr zpool 8 +for more information on creating and administering pools. +.Ss Snapshots +A snapshot is a read-only copy of a file system or volume. Snapshots can be +created extremely quickly, and initially consume no additional space within the +pool. As data within the active dataset changes, the snapshot consumes more +data than would otherwise be shared with the active dataset. +.Pp +Snapshots can have arbitrary names. Snapshots of volumes can be cloned or +rolled back, but cannot be accessed independently. +.Pp +File system snapshots can be accessed under the +.Pa \&.zfs/snapshot +directory in the root of the file system. Snapshots are automatically mounted +on demand and may be unmounted at regular intervals. The visibility of the +.Pa \&.zfs +directory can be controlled by the +.Sy snapdir +property. +.Ss Clones +A clone is a writable volume or file system whose initial contents are the same +as another dataset. As with snapshots, creating a clone is nearly +instantaneous, and initially consumes no additional space. +.Pp +Clones can only be created from a snapshot. When a snapshot is cloned, it +creates an implicit dependency between the parent and child. Even though the +clone is created somewhere else in the dataset hierarchy, the original snapshot +cannot be destroyed as long as a clone exists. The +.Sy origin +property exposes this dependency, and the +.Cm destroy +command lists any such dependencies, if they exist. +.Pp +The clone parent-child dependency relationship can be reversed by using the +.Cm promote +subcommand. This causes the "origin" file system to become a clone of the +specified file system, which makes it possible to destroy the file system that +the clone was created from. +.Ss Mount Points +Creating a +.Tn ZFS +file system is a simple operation, so the number of file systems per system is +likely to be numerous. To cope with this, +.Tn ZFS +automatically manages mounting and unmounting file systems without the need to +edit the +.Pa /etc/fstab +file. All automatically managed file systems are mounted by +.Tn ZFS +at boot time. +.Pp +By default, file systems are mounted under +.Pa /path , +where +.Ar path +is the name of the file system in the +.Tn ZFS +namespace. Directories are created and destroyed as needed. +.Pp +A file system can also have a mount point set in the +.Sy mountpoint +property. This directory is created as needed, and +.Tn ZFS +automatically mounts the file system when the +.Qq Nm Cm mount Fl a +command is invoked (without editing +.Pa /etc/fstab Ns ). +The +.Sy mountpoint +property can be inherited, so if +.Em pool/home +has a mount point of +.Pa /home , +then +.Em pool/home/user +automatically inherits a mount point of +.Pa /home/user . +.Pp +A file system +.Sy mountpoint +property of +.Cm none +prevents the file system from being mounted. +.Pp +If needed, +.Tn ZFS +file systems can also be managed with traditional tools +.Pq Xr mount 8 , Xr umount 8 , Xr fstab 5 . +If a file system's mount point is set to +.Cm legacy , +.Tn ZFS +makes no attempt to manage the file system, and the administrator is +responsible for mounting and unmounting the file system. +.Ss Jails +.No A Tn ZFS +dataset can be attached to a jail by using the +.Qq Nm Cm jail +subcommand. You cannot attach a dataset to one jail and the children of the +same dataset to another jails. To allow managment of the dataset from within +a jail, the +.Sy jailed +property has to be set. The +.Sy quota +property cannot be changed from within a jail. +.Pp +.No A Tn ZFS +dataset can be detached from a jail using the +.Qq Nm Cm unjail +subcommand. +.Pp +After a dataset is attached to a jail and the jailed property is set, a jailed +file system cannot be mounted outside the jail, since the jail administrator +might have set the mount point to an unacceptable value. +.Ss Deduplication +Deduplication is the process for removing redundant data at the block-level, +reducing the total amount of data stored. If a file system has the +.Cm dedup +property enabled, duplicate data blocks are removed synchronously. The result +is that only unique data is stored and common components are shared among +files. +.Ss Native Properties +Properties are divided into two types, native properties and user-defined (or +"user") properties. Native properties either export internal statistics or +control +.Tn ZFS +behavior. In addition, native properties are either editable or read-only. User +properties have no effect on +.Tn ZFS +behavior, but you can use them to annotate datasets in a way that is meaningful +in your environment. For more information about user properties, see the +.Qq Sx User Properties +section, below. +.Pp +Every dataset has a set of properties that export statistics about the dataset +as well as control various behaviors. Properties are inherited from the parent +unless overridden by the child. Some properties apply only to certain types of +datasets (file systems, volumes, or snapshots). +.Pp +The values of numeric properties can be specified using human-readable suffixes +(for example, +.Sy k , KB , M , Gb , +and so forth, up to +.Sy Z +for zettabyte). The following are all valid (and equal) specifications: +.Bd -ragged -offset 4n 1536M, 1.5g, 1.50GB -.fi -.in -2 -.sp - -.sp -.LP -The values of non-numeric properties are case sensitive and must be lowercase, except for \fBmountpoint\fR, \fBsharenfs\fR, and \fBsharesmb\fR. -.sp -.LP -The following native properties consist of read-only statistics about the dataset. These properties can be neither set, nor inherited. Native properties apply to all dataset types unless otherwise noted. -.sp -.ne 2 -.mk -.na -\fB\fBavailable\fR\fR -.ad -.sp .6 -.RS 4n -The amount of space available to the dataset and all its children, assuming that there is no other activity in the pool. Because space is shared within a pool, availability can be limited by any number of factors, including physical pool size, quotas, reservations, or other datasets within the pool. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 11:07:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95BE21065670; Thu, 5 Jan 2012 11:07:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A0928FC0A; Thu, 5 Jan 2012 11:07:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05B78nt030742; Thu, 5 Jan 2012 11:07:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05B78NF030735; Thu, 5 Jan 2012 11:07:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051107.q05B78NF030735@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:07:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229579 - in stable/8: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/lib/libzfs ... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 11:07:08 -0000 Author: mm Date: Thu Jan 5 11:07:07 2012 New Revision: 229579 URL: http://svn.freebsd.org/changeset/base/229579 Log: MFC r228103, r228104: MFC r228103: Merge new ZFS features from illumos: 1644 add ZFS "clones" property https://www.illumos.org/issues/1644 1645 add ZFS "written" and "written@..." properties https://www.illumos.org/issues/1645 1646 "zfs send" should estimate size of stream https://www.illumos.org/issues/1646 1647 "zfs destroy" should determine space reclaimed by destroying multiple snapshots https://www.illumos.org/issues/1647 1693 persistent 'comment' field for a zpool https://www.illumos.org/issues/1693 1708 adjust size of zpool history data https://www.illumos.org/issues/1708 1748 desire support for reguid in zfs https://www.illumos.org/issues/1748 MFC r228104: Fix typo in copyright notice. Obtained from: illumos (changesets 13514, 13524, 13525) Added: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c - copied unchanged from r228103, head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Deleted: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_graph.c Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/8/cddl/lib/libzfs/Makefile stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:07:07 2012 (r229579) @@ -48,12 +48,16 @@ .Ar size volume .Nm .Cm destroy -.Op Fl rRf +.Op Fl fnpRrv .Ar filesystem Ns | Ns Ar volume .Nm .Cm destroy -.Op Fl rRd +.Op Fl dnpRrv +.Sm off .Ar snapshot +.Ns Op % Ns Ar snapname +.Ns Op , Ns Ar ... +.Sm on .Nm .Cm snapshot .Op Fl r @@ -160,7 +164,7 @@ .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Nm .Cm send -.Op Fl DvRp +.Op Fl DnPpRrv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm @@ -487,6 +491,17 @@ The default value is .Cm off . .It Sy creation The time this dataset was created. +.It Sy clones +For snapshots, this property is a comma-separated list of filesystems or +volumes which are clones of this snapshot. The clones' +.Sy origin +property is this snapshot. If the +.Sy clones +property is not empty, then this snapshot can not be destroyed (even with the +.Fl r +or +.Fl f +options). .It Sy defer_destroy This property is .Cm on @@ -644,6 +659,28 @@ power of 2 from 512 bytes to 128 Kbytes .Pp This property can also be referred to by its shortened column name, .Sy volblock . +.It Sy written +The amount of +.Sy referenced +space written to this dataset since the previous snapshot. +.It Sy written@ Ns Ar snapshot +The amount of +.Sy referenced +space written to this dataset since the specified snapshot. This is the space +that is referenced by this dataset but was not referenced by the specified +snapshot. +.Pp +The +.Ar snapshot +may be specified as a short snapshot name (just the part after the +.Sy @ Ns ), +in which case it will be interpreted as a snapshot in the same filesystem as +this dataset. The +.Ar snapshot +may be a full snapshot name +.Pq Em filesystem@snapshot , +which for clones may be a snapshot in the origin's filesystem (or the origin of +the origin's filesystem, etc). .El .Pp The following native properties can be used to change the behavior of a @@ -1403,7 +1440,7 @@ options. .It Xo .Nm .Cm destroy -.Op Fl rRf +.Op Fl fnpRrv .Ar filesystem Ns | Ns Ar volume .Xc .Pp @@ -1422,6 +1459,17 @@ Force an unmount of any file systems usi .Qq Nm Cm unmount Fl f command. This option has no effect on non-file systems or unmounted file systems. +.It Fl n +Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in +conjunction with the +.Fl v +or +.Fl p +flags to determine what data would be deleted. +.It Fl p +Print machine-parsable verbose information about the deleted data. +.It Fl v +Print verbose information about the deleted data. .El .Pp Extreme care should be taken when applying either the @@ -1433,11 +1481,15 @@ behavior for mounted file systems in use .It Xo .Nm .Cm destroy -.Op Fl rRd +.Op Fl dnpRrv +.Sm off .Ar snapshot +.Ns Op % Ns Ar snapname +.Ns Op , Ns Ar ... +.Sm on .Xc .Pp -The given snapshot is destroyed immediately if and only if the +The given snapshots are destroyed immediately if and only if the .Qq Nm Cm destroy command without the .Fl d @@ -1445,15 +1497,41 @@ option would have destroyed it. Such imm example, if the snapshot had no clones and the user-initiated reference count were zero. .Pp -If the snapshot does not qualify for immediate destruction, it is marked for +If a snapshot does not qualify for immediate destruction, it is marked for deferred deletion. In this state, it exists as a usable, visible snapshot until both of the preconditions listed above are met, at which point it is destroyed. +.Pp +An inclusive range of snapshots may be specified by separating the +first and last snapshots with a percent sign +.Pq Sy % . +The first and/or last snapshots may be left blank, in which case the +filesystem's oldest or newest snapshot will be implied. +.Pp +Multiple snapshots +(or ranges of snapshots) of the same filesystem or volume may be specified +in a comma-separated list of snapshots. +Only the snapshot's short name (the +part after the +.Sy @ ) +should be specified when using a range or comma-separated list to identify +multiple snapshots. .Bl -tag -width indent .It Fl r Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems. .It Fl R Recursively destroy all dependents. +.It Fl n +Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in +conjunction with the +.Fl v +or +.Fl p +flags to determine what data would be deleted. +.It Fl p +Print machine-parsable verbose information about the deleted data. +.It Fl v +Print verbose information about the deleted data. .It Fl d Defer snapshot deletion. .El @@ -2080,7 +2158,7 @@ file system shared on the system. .It Xo .Nm .Cm send -.Op Fl DvRp +.Op Fl DnPpRrv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2151,10 +2229,26 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 Ns ). +.It Fl r +Recursively send all descendant snapshots. This is similar to the +.Fl R +flag, but information about deleted and renamed datasets is not included, and +property information is only included if the +.Fl p +flag is specified. .It Fl p Include the dataset's properties in the stream. This flag is implicit when .Fl R is specified. The receiving system must also support this feature. +.It Fl n +Do a dry-run ("No-op") send. Do not generate any actual send data. This is +useful in conjunction with the +.Fl v +or +.Fl P +flags to determine what data will be sent. +.It Fl P +Print machine-parsable verbose information about the stream package generated. .It Fl v Print verbose information about the stream package generated. .El Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 11:07:07 2012 (r229579) @@ -22,8 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011 Martin Matuska . All rights reserved. */ #include @@ -145,7 +146,7 @@ typedef enum { HELP_HOLD, HELP_HOLDS, HELP_RELEASE, - HELP_DIFF + HELP_DIFF, } zfs_help_t; typedef struct zfs_command { @@ -220,8 +221,9 @@ get_usage(zfs_help_t idx) "\tcreate [-ps] [-b blocksize] [-o property=value] ... " "-V \n")); case HELP_DESTROY: - return (gettext("\tdestroy [-rRf] \n" - "\tdestroy [-rRd] \n")); + return (gettext("\tdestroy [-fnpRrv] \n" + "\tdestroy [-dnpRrv] " + "[%][,...]\n")); case HELP_GET: return (gettext("\tget [-rHp] [-d max] " "[-o \"all\" | field[,...]] [-s source[,...]]\n" @@ -260,7 +262,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DvRp] " + return (gettext("\tsend [-DnPpRrv] " "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " @@ -440,6 +442,8 @@ usage(boolean_t requested) (void) fprintf(fp, "YES NO | none\n"); (void) fprintf(fp, "\t%-15s ", "groupquota@..."); (void) fprintf(fp, "YES NO | none\n"); + (void) fprintf(fp, "\t%-15s ", "written@"); + (void) fprintf(fp, " NO NO \n"); (void) fprintf(fp, gettext("\nSizes are specified in bytes " "with standard units such as K, M, G, etc.\n")); @@ -885,15 +889,23 @@ badusage: */ typedef struct destroy_cbdata { boolean_t cb_first; - int cb_force; - int cb_recurse; - int cb_error; - int cb_needforce; - int cb_doclones; - boolean_t cb_closezhp; + boolean_t cb_force; + boolean_t cb_recurse; + boolean_t cb_error; + boolean_t cb_doclones; zfs_handle_t *cb_target; - char *cb_snapname; boolean_t cb_defer_destroy; + boolean_t cb_verbose; + boolean_t cb_parsable; + boolean_t cb_dryrun; + nvlist_t *cb_nvl; + + /* first snap in contiguous run */ + zfs_handle_t *cb_firstsnap; + /* previous snap in contiguous run */ + zfs_handle_t *cb_prevsnap; + int64_t cb_snapused; + char *cb_snapspec; } destroy_cbdata_t; /* @@ -923,7 +935,7 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-r' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -944,7 +956,8 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-R' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; + cbp->cb_dryrun = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -958,7 +971,20 @@ out: static int destroy_callback(zfs_handle_t *zhp, void *data) { - destroy_cbdata_t *cbp = data; + destroy_cbdata_t *cb = data; + const char *name = zfs_get_name(zhp); + + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } /* * Ignore pools (which we've already flagged as an error before getting @@ -970,13 +996,12 @@ destroy_callback(zfs_handle_t *zhp, void return (0); } - /* - * Bail out on the first error. - */ - if (zfs_unmount(zhp, NULL, cbp->cb_force ? MS_FORCE : 0) != 0 || - zfs_destroy(zhp, cbp->cb_defer_destroy) != 0) { - zfs_close(zhp); - return (-1); + if (!cb->cb_dryrun) { + if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || + zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { + zfs_close(zhp); + return (-1); + } } zfs_close(zhp); @@ -984,39 +1009,142 @@ destroy_callback(zfs_handle_t *zhp, void } static int -destroy_snap_clones(zfs_handle_t *zhp, void *arg) +destroy_print_cb(zfs_handle_t *zhp, void *arg) { - destroy_cbdata_t *cbp = arg; - char thissnap[MAXPATHLEN]; - zfs_handle_t *szhp; - boolean_t closezhp = cbp->cb_closezhp; - int rv; + destroy_cbdata_t *cb = arg; + const char *name = zfs_get_name(zhp); + int err = 0; - (void) snprintf(thissnap, sizeof (thissnap), - "%s@%s", zfs_get_name(zhp), cbp->cb_snapname); + if (nvlist_exists(cb->cb_nvl, name)) { + if (cb->cb_firstsnap == NULL) + cb->cb_firstsnap = zfs_handle_dup(zhp); + if (cb->cb_prevsnap != NULL) + zfs_close(cb->cb_prevsnap); + /* this snap continues the current range */ + cb->cb_prevsnap = zfs_handle_dup(zhp); + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } + } else if (cb->cb_firstsnap != NULL) { + /* end of this range */ + uint64_t used = 0; + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; + } + zfs_close(zhp); + return (err); +} - libzfs_print_on_error(g_zfs, B_FALSE); - szhp = zfs_open(g_zfs, thissnap, ZFS_TYPE_SNAPSHOT); - libzfs_print_on_error(g_zfs, B_TRUE); - if (szhp) { - /* - * Destroy any clones of this snapshot - */ - if (zfs_iter_dependents(szhp, B_FALSE, destroy_callback, - cbp) != 0) { - zfs_close(szhp); - if (closezhp) - zfs_close(zhp); - return (-1); +static int +destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb) +{ + int err; + assert(cb->cb_firstsnap == NULL); + assert(cb->cb_prevsnap == NULL); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + if (cb->cb_firstsnap != NULL) { + uint64_t used = 0; + if (err == 0) { + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); } - zfs_close(szhp); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; } + return (err); +} - cbp->cb_closezhp = B_TRUE; - rv = zfs_iter_filesystems(zhp, destroy_snap_clones, arg); - if (closezhp) - zfs_close(zhp); - return (rv); +static int +snapshot_to_nvl_cb(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + /* Check for clones. */ + if (!cb->cb_doclones) { + cb->cb_target = zhp; + cb->cb_first = B_TRUE; + err = zfs_iter_dependents(zhp, B_TRUE, + destroy_check_dependent, cb); + } + + if (err == 0) { + if (nvlist_add_boolean(cb->cb_nvl, zfs_get_name(zhp))) + nomem(); + } + zfs_close(zhp); + return (err); +} + +static int +gather_snapshots(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + err = zfs_iter_snapspec(zhp, cb->cb_snapspec, snapshot_to_nvl_cb, cb); + if (err == ENOENT) + err = 0; + if (err != 0) + goto out; + + if (cb->cb_verbose) { + err = destroy_print_snapshots(zhp, cb); + if (err != 0) + goto out; + } + + if (cb->cb_recurse) + err = zfs_iter_filesystems(zhp, gather_snapshots, cb); + +out: + zfs_close(zhp); + return (err); +} + +static int +destroy_clones(destroy_cbdata_t *cb) +{ + nvpair_t *pair; + for (pair = nvlist_next_nvpair(cb->cb_nvl, NULL); + pair != NULL; + pair = nvlist_next_nvpair(cb->cb_nvl, pair)) { + zfs_handle_t *zhp = zfs_open(g_zfs, nvpair_name(pair), + ZFS_TYPE_SNAPSHOT); + if (zhp != NULL) { + boolean_t defer = cb->cb_defer_destroy; + int err; + + /* + * We can't defer destroy non-snapshots, so set it to + * false while destroying the clones. + */ + cb->cb_defer_destroy = B_FALSE; + err = zfs_iter_dependents(zhp, B_FALSE, + destroy_callback, cb); + cb->cb_defer_destroy = defer; + zfs_close(zhp); + if (err != 0) + return (err); + } + } + return (0); } static int @@ -1025,25 +1153,35 @@ zfs_do_destroy(int argc, char **argv) destroy_cbdata_t cb = { 0 }; int c; zfs_handle_t *zhp; - char *cp; + char *at; zfs_type_t type = ZFS_TYPE_DATASET; /* check options */ - while ((c = getopt(argc, argv, "dfrR")) != -1) { + while ((c = getopt(argc, argv, "vpndfrR")) != -1) { switch (c) { + case 'v': + cb.cb_verbose = B_TRUE; + break; + case 'p': + cb.cb_verbose = B_TRUE; + cb.cb_parsable = B_TRUE; + break; + case 'n': + cb.cb_dryrun = B_TRUE; + break; case 'd': cb.cb_defer_destroy = B_TRUE; type = ZFS_TYPE_SNAPSHOT; break; case 'f': - cb.cb_force = 1; + cb.cb_force = B_TRUE; break; case 'r': - cb.cb_recurse = 1; + cb.cb_recurse = B_TRUE; break; case 'R': - cb.cb_recurse = 1; - cb.cb_doclones = 1; + cb.cb_recurse = B_TRUE; + cb.cb_doclones = B_TRUE; break; case '?': default: @@ -1058,7 +1196,7 @@ zfs_do_destroy(int argc, char **argv) /* check number of arguments */ if (argc == 0) { - (void) fprintf(stderr, gettext("missing path argument\n")); + (void) fprintf(stderr, gettext("missing dataset argument\n")); usage(B_FALSE); } if (argc > 1) { @@ -1066,91 +1204,117 @@ zfs_do_destroy(int argc, char **argv) usage(B_FALSE); } - /* - * If we are doing recursive destroy of a snapshot, then the - * named snapshot may not exist. Go straight to libzfs. - */ - if (cb.cb_recurse && (cp = strchr(argv[0], '@'))) { - int ret; + at = strchr(argv[0], '@'); + if (at != NULL) { + int err; - *cp = '\0'; - if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL) + /* Build the list of snaps to destroy in cb_nvl. */ + if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); + + *at = '\0'; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) return (1); - *cp = '@'; - cp++; - if (cb.cb_doclones) { - boolean_t defer = cb.cb_defer_destroy; + cb.cb_snapspec = at + 1; + if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || + cb.cb_error) { + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } - /* - * Temporarily ignore the defer_destroy setting since - * it's not supported for clones. - */ - cb.cb_defer_destroy = B_FALSE; - cb.cb_snapname = cp; - if (destroy_snap_clones(zhp, &cb) != 0) { - zfs_close(zhp); - return (1); + if (nvlist_empty(cb.cb_nvl)) { + (void) fprintf(stderr, gettext("could not find any " + "snapshots to destroy; check snapshot names.\n")); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } + + if (cb.cb_verbose) { + char buf[16]; + zfs_nicenum(cb.cb_snapused, buf, sizeof (buf)); + if (cb.cb_parsable) { + (void) printf("reclaim\t%llu\n", + cb.cb_snapused); + } else if (cb.cb_dryrun) { + (void) printf(gettext("would reclaim %s\n"), + buf); + } else { + (void) printf(gettext("will reclaim %s\n"), + buf); } - cb.cb_defer_destroy = defer; } - ret = zfs_destroy_snaps(zhp, cp, cb.cb_defer_destroy); - zfs_close(zhp); - if (ret) { - (void) fprintf(stderr, - gettext("no snapshots destroyed\n")); + if (!cb.cb_dryrun) { + if (cb.cb_doclones) + err = destroy_clones(&cb); + if (err == 0) { + err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl, + cb.cb_defer_destroy); + } } - return (ret != 0); - } - /* Open the given dataset */ - if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) - return (1); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + if (err != 0) + return (1); + } else { + /* Open the given dataset */ + if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) + return (1); - cb.cb_target = zhp; + cb.cb_target = zhp; - /* - * Perform an explicit check for pools before going any further. - */ - if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && - zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { - (void) fprintf(stderr, gettext("cannot destroy '%s': " - "operation does not apply to pools\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zfs destroy -r " - "%s' to destroy all datasets in the pool\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zpool destroy %s' " - "to destroy the pool itself\n"), zfs_get_name(zhp)); - zfs_close(zhp); - return (1); - } + /* + * Perform an explicit check for pools before going any further. + */ + if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && + zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { + (void) fprintf(stderr, gettext("cannot destroy '%s': " + "operation does not apply to pools\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zfs destroy -r " + "%s' to destroy all datasets in the pool\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zpool destroy %s' " + "to destroy the pool itself\n"), zfs_get_name(zhp)); + zfs_close(zhp); + return (1); + } - /* - * Check for any dependents and/or clones. - */ - cb.cb_first = B_TRUE; - if (!cb.cb_doclones && !cb.cb_defer_destroy && - zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, - &cb) != 0) { - zfs_close(zhp); - return (1); - } + /* + * Check for any dependents and/or clones. + */ + cb.cb_first = B_TRUE; + if (!cb.cb_doclones && + zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (cb.cb_error || (!cb.cb_defer_destroy && - (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, &cb) != 0))) { - zfs_close(zhp); - return (1); - } + if (cb.cb_error) { + zfs_close(zhp); + return (1); + } - /* - * Do the real thing. The callback will close the handle regardless of - * whether it succeeds or not. - */ + if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (destroy_callback(zhp, &cb) != 0) - return (1); + /* + * Do the real thing. The callback will close the + * handle regardless of whether it succeeds or not. + */ + if (destroy_callback(zhp, &cb) != 0) + return (1); + } return (0); } @@ -1252,6 +1416,17 @@ get_callback(zfs_handle_t *zhp, void *da zprop_print_one_property(zfs_get_name(zhp), cbp, pl->pl_user_prop, buf, sourcetype, source, NULL); + } else if (zfs_prop_written(pl->pl_user_prop)) { + sourcetype = ZPROP_SRC_LOCAL; + + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + buf, sizeof (buf), cbp->cb_literal) != 0) { + sourcetype = ZPROP_SRC_NONE; + (void) strlcpy(buf, "-", sizeof (buf)); + } + + zprop_print_one_property(zfs_get_name(zhp), cbp, + pl->pl_user_prop, buf, sourcetype, source, NULL); } else { if (nvlist_lookup_nvlist(user_props, pl->pl_user_prop, &propval) != 0) { @@ -1796,8 +1971,8 @@ zfs_do_upgrade(int argc, char **argv) "---------------\n"); (void) printf(gettext(" 1 Initial ZFS filesystem version\n")); (void) printf(gettext(" 2 Enhanced directory entries\n")); - (void) printf(gettext(" 3 Case insensitive and File system " - "unique identifier (FUID)\n")); + (void) printf(gettext(" 3 Case insensitive and filesystem " + "user identifier (FUID)\n")); (void) printf(gettext(" 4 userquota, groupquota " "properties\n")); (void) printf(gettext(" 5 System attributes\n")); @@ -2677,6 +2852,13 @@ print_dataset(zfs_handle_t *zhp, zprop_l else propstr = property; right_justify = B_TRUE; + } else if (zfs_prop_written(pl->pl_user_prop)) { + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + property, sizeof (property), B_FALSE) != 0) + propstr = "-"; + else + propstr = property; + right_justify = B_TRUE; } else { if (nvlist_lookup_nvlist(userprops, pl->pl_user_prop, &propval) != 0) @@ -3303,9 +3485,6 @@ usage: } /* - * zfs send [-vDp] -R [-i|-I <@snap>] - * zfs send [-vDp] [-i|-I <@snap>] - * * Send a backup stream to stdout. */ static int @@ -3317,11 +3496,11 @@ zfs_do_send(int argc, char **argv) zfs_handle_t *zhp; sendflags_t flags = { 0 }; int c, err; - nvlist_t *dbgnv; + nvlist_t *dbgnv = NULL; boolean_t extraverbose = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, ":i:I:RDpv")) != -1) { + while ((c = getopt(argc, argv, ":i:I:RDpvnP")) != -1) { switch (c) { case 'i': if (fromname) @@ -3340,6 +3519,10 @@ zfs_do_send(int argc, char **argv) case 'p': flags.props = B_TRUE; break; + case 'P': + flags.parsable = B_TRUE; + flags.verbose = B_TRUE; + break; case 'v': if (flags.verbose) extraverbose = B_TRUE; @@ -3348,6 +3531,9 @@ zfs_do_send(int argc, char **argv) case 'D': flags.dedup = B_TRUE; break; + case 'n': + flags.dryrun = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -3373,7 +3559,7 @@ zfs_do_send(int argc, char **argv) usage(B_FALSE); } - if (isatty(STDOUT_FILENO)) { + if (!flags.dryrun && isatty(STDOUT_FILENO)) { (void) fprintf(stderr, gettext("Error: Stream can not be written to a terminal.\n" "You must redirect standard output.\n")); @@ -3427,10 +3613,10 @@ zfs_do_send(int argc, char **argv) if (flags.replicate && fromname == NULL) flags.doall = B_TRUE; - err = zfs_send(zhp, fromname, toname, flags, STDOUT_FILENO, NULL, 0, + err = zfs_send(zhp, fromname, toname, &flags, STDOUT_FILENO, NULL, 0, extraverbose ? &dbgnv : NULL); - if (extraverbose) { + if (extraverbose && dbgnv != NULL) { /* * dump_nvlist prints to stdout, but that's been * redirected to a file. Make it print to stderr @@ -3511,7 +3697,7 @@ zfs_do_receive(int argc, char **argv) return (1); } - err = zfs_receive(g_zfs, argv[0], flags, STDIN_FILENO, NULL); + err = zfs_receive(g_zfs, argv[0], &flags, STDIN_FILENO, NULL); return (err != 0); } Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:07:07 2012 (r229579) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 26, 2011 +.Dd November 28, 2011 .Dt ZPOOL 8 .Os .Sh NAME @@ -133,6 +133,9 @@ .Op Fl e .Ar pool device ... .Nm +.Cm reguid +.Ar pool +.Nm .Cm remove .Ar pool device ... .Nm @@ -1346,6 +1349,14 @@ available to the pool. .El .It Xo .Nm +.Cm reguid +.Ar pool +.Xc +.Pp +Generates a new unique identifier for the pool. You must ensure that all +devices in this pool are online and healthy before performing this action. +.It Xo +.Nm .Cm remove .Ar pool device ... .Xc Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 11:07:07 2012 (r229579) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Martin Matuska . All rights reserved. */ #include @@ -68,6 +70,8 @@ static int zpool_do_online(int, char **) static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); +static int zpool_do_reguid(int, char **); + static int zpool_do_attach(int, char **); static int zpool_do_detach(int, char **); static int zpool_do_replace(int, char **); @@ -126,7 +130,8 @@ typedef enum { HELP_UPGRADE, HELP_GET, HELP_SET, - HELP_SPLIT + HELP_SPLIT, + HELP_REGUID } zpool_help_t; @@ -172,6 +177,7 @@ static zpool_command_t command_table[] = { "import", zpool_do_import, HELP_IMPORT }, { "export", zpool_do_export, HELP_EXPORT }, { "upgrade", zpool_do_upgrade, HELP_UPGRADE }, + { "reguid", zpool_do_reguid, HELP_REGUID }, { NULL }, { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, @@ -251,6 +257,8 @@ get_usage(zpool_help_t idx) { return (gettext("\tsplit [-n] [-R altroot] [-o mntopts]\n" "\t [-o property=value] " "[ ...]\n")); + case HELP_REGUID: + return (gettext("\treguid \n")); } abort(); @@ -1453,6 +1461,7 @@ show_import(nvlist_t *config) const char *health; uint_t vsc; int namewidth; + char *comment; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); @@ -1469,9 +1478,9 @@ show_import(nvlist_t *config) reason = zpool_import_status(config, &msgid); - (void) printf(gettext(" pool: %s\n"), name); - (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); - (void) printf(gettext(" state: %s"), health); + (void) printf(gettext(" pool: %s\n"), name); + (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); + (void) printf(gettext(" state: %s"), health); if (pool_state == POOL_STATE_DESTROYED) (void) printf(gettext(" (DESTROYED)")); (void) printf("\n"); @@ -1480,58 +1489,59 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_BAD_GUID_SUM: - (void) printf(gettext("status: One or more devices are missing " - "from the system.\n")); + (void) printf(gettext(" status: One or more devices are " + "missing from the system.\n")); break; case ZPOOL_STATUS_CORRUPT_LABEL_R: case ZPOOL_STATUS_CORRUPT_LABEL_NR: - (void) printf(gettext("status: One or more devices contains " + (void) printf(gettext(" status: One or more devices contains " "corrupted data.\n")); break; case ZPOOL_STATUS_CORRUPT_DATA: - (void) printf(gettext("status: The pool data is corrupted.\n")); + (void) printf( + gettext(" status: The pool data is corrupted.\n")); break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 11:12:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3502A1065670; Thu, 5 Jan 2012 11:12:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BC9C8FC1E; Thu, 5 Jan 2012 11:12:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05BC3Qc031202; Thu, 5 Jan 2012 11:12:03 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BC2fW031199; Thu, 5 Jan 2012 11:12:02 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051112.q05BC2fW031199@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229582 - in stable/8/cddl/contrib/opensolaris/cmd: zfs zpool X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 11:12:03 -0000 Author: mm Date: Thu Jan 5 11:12:02 2012 New Revision: 229582 URL: http://svn.freebsd.org/changeset/base/229582 Log: MFC r228206, r228353: MFC r228206: Remove unnecesary "Ns" macros and add missing command example to zpool(8). MFC r228353: Some mdoc(7) style and typo fixes to zfs(8). Submitted by: Nobuyuki Koganemaru Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:11:46 2012 (r229581) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:12:02 2012 (r229582) @@ -377,7 +377,7 @@ property. This directory is created as n automatically mounts the file system when the .Qq Nm Cm mount Fl a command is invoked (without editing -.Pa /etc/fstab Ns ). +.Pa /etc/fstab ) . The .Sy mountpoint property can be inherited, so if @@ -409,7 +409,7 @@ responsible for mounting and unmounting dataset can be attached to a jail by using the .Qq Nm Cm jail subcommand. You cannot attach a dataset to one jail and the children of the -same dataset to another jails. To allow managment of the dataset from within +same dataset to another jails. To allow management of the dataset from within a jail, the .Sy jailed property has to be set. The @@ -624,10 +624,10 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy userrefs This property is set to the number of user holds on this snapshot. User holds @@ -673,7 +673,7 @@ snapshot. The .Ar snapshot may be specified as a short snapshot name (just the part after the -.Sy @ Ns ), +.Sy @ ) , in which case it will be interpreted as a snapshot in the same filesystem as this dataset. The .Ar snapshot @@ -847,7 +847,7 @@ is an integer from 1 (fastest) to 9 (bes is equivalent to .Cm gzip-6 (which is also the default for -.Xr gzip 1 Ns ). +.Xr gzip 1 ) . The .Cm zle compression algorithm compresses runs of zeros. @@ -952,7 +952,7 @@ space calculation does not include space such as snapshots and clones. User space consumption is identified by the .Sy userspace@ Ns Ar user property. -.sp +.Pp Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the @@ -960,14 +960,14 @@ over quota and begins to refuse addition error message. See the .Cm userspace subcommand for more information. -.sp +.Pp Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the .Sy userquota privilege with .Qq Nm Cm allow , can get and set everyone's quota. -.sp +.Pp This property is not available on volumes, on file systems before version 4, or on pools before version 15. The .Sy userquota@ Ns ... @@ -979,17 +979,17 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy groupquota@ Ns Ar group Ns = Ns Ar size | Cm none Limits the amount of space consumed by the specified group. Group space consumption is identified by the .Sy userquota@ Ns Ar user property. -.sp +.Pp Unprivileged users can access only their own groups' space usage. The root user, or a user who has been granted the .Sy groupquota @@ -1020,7 +1020,7 @@ than or equal to 128 Kbytes. Changing the file system's .Sy recordsize affects only files created afterward; existing files are unaffected. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy recsize . .It Sy refquota Ns = Ns Ar size | Cm none @@ -1036,13 +1036,13 @@ The .Sy refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. -.sp +.Pp If .Sy refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy refreserv . .It Sy reservation Ns = Ns Ar size | Cm none @@ -1161,7 +1161,7 @@ version number of 9 or higher, a is set instead. Any changes to .Sy volsize are reflected in an equivalent change to the reservation (or -.Sy refreservation Ns ). +.Sy refreservation ) . The .Sy volsize can only be set to a multiple of @@ -1174,7 +1174,7 @@ run out of space, resulting in undefined on how the volume is used. These effects can also occur when the volume size is changed while it is in use (particularly when shrinking the size). Extreme care should be used when adjusting the volume size. -.sp +.Pp Though not recommended, a "sparse volume" (also known as "thin provisioning") can be created by specifying the .Fl s @@ -1708,7 +1708,7 @@ Snapshots are displayed if the property is .Cm on (the default is -.Cm off Ns ). +.Cm off ) . The following fields are displayed, .Sy name , used , available , referenced , mountpoint . .Bl -tag -width indent @@ -2168,10 +2168,10 @@ Creates a stream representation of the l argument (not part of .Fl i or -.Fl I Ns ) +.Fl I ) which is written to standard output. The output can be redirected to a file or to a different system (for example, using -.Xr ssh 1 Ns ). +.Xr ssh 1 ) . By default, a full stream is generated. .Bl -tag -width indent .It Fl i Ar snapshot @@ -2180,10 +2180,10 @@ Generate an incremental stream from the to the last .Ar snapshot . The incremental source (the -.Fl i Ar snapshot Ns ) +.Fl i Ar snapshot ) can be specified as the last component of the snapshot name (for example, the part after the -.Sy @ Ns ), +.Sy @ ) , and it is assumed to be from the same file system as the last .Ar snapshot . .Pp @@ -2191,14 +2191,16 @@ If the destination is a clone, the sourc must be fully specified (for example, .Cm pool/fs@origin , not just -.Cm @origin Ns ). +.Cm @origin ) . .It Fl I Ar snapshot Generate a stream package that sends all intermediary snapshots from the -.Fl I Ar snapshot to the last -.Ar snapshot . For example, +.Fl I Ar snapshot +to the last +.Ar snapshot . +For example, .Ic -I @a fs@d is similar to -.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d Ns . +.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d . The incremental source snapshot may be specified as with the .Fl i option. @@ -2223,12 +2225,12 @@ flag is specified when this stream is re .It Fl D Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must -also support this feature to recieve a deduplicated stream. This flag can +also support this feature to receive a deduplicated stream. This flag can be used regardless of the dataset's .Sy dedup property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. -.Sy sha256 Ns ). +.Sy sha256 ) . .It Fl r Recursively send all descendant snapshots. This is similar to the .Fl R @@ -2323,14 +2325,14 @@ option is specified, all but the pool na appended (for example, .Sy b/c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ), +.Sy a/b/c@1 ) , and if the .Fl e option is specified, only the tail of the sent snapshot path is appended (for example, .Sy c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ). +.Sy a/b/c@1 ) . In the case of .Fl d , any file systems needed to replicate the path of the sent snapshot are created @@ -2349,13 +2351,13 @@ Print verbose information about the stre receive operation. .It Fl n Do not actually receive the stream. This can be useful in conjunction with the -.It Fl v +.Fl v option to verify the name the receive operation would use. .It Fl F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by -.Qq Nm Cm send Fl R Fi iI Ns ) , +.Qq Nm Cm send Fl R Fi iI ) , destroy snapshots and file systems that do not exist on the sending side. .El .It Xo @@ -2409,12 +2411,13 @@ option. .Op Fl e .Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... .Xc -Specifies that the permissions be delegated to "everyone." Multiple permissions +Specifies that the permissions be delegated to "everyone". +Multiple permissions may be specified as a comma-separated list. Permission names are the same as .Tn ZFS subcommand and property names. See the property list below. Property set names, which begin with an at sign -.Pq Sy @ Ns , +.Pq Sy @ , may be specified. See the .Fl s form below for details. @@ -2536,7 +2539,7 @@ commands for the specified file system a dynamically, so changes to a set are immediately reflected. Permission sets follow the same naming restrictions as ZFS file systems, but the name must begin with an "at sign" -.Pq Sy @ Ns , +.Pq Sy @ , and can be no more than 64 characters long. .It Xo .Nm @@ -2655,7 +2658,7 @@ Describes differences between a snapshot successor dataset can be a later snapshot or the current filesystem. .Pp The changed files are displayed including the change type. The change type -is displayed ussing a single character. If a file or directory was renamed, +is displayed useing a single character. If a file or directory was renamed, the old and the new names are displayed. .Pp The following change types can be displayed: @@ -2680,9 +2683,9 @@ The following file types can be displaye .It \&B Ta block device .It \&@ Ta symbolic link .It \&= Ta socket -.It \&> Ta door (not supported on Fx Ns ) -.It \&| Ta FIFO (not supported on Fx Ns ) -.It \&P Ta event portal (not supported on Fx Ns ) +.It \&> Ta door (not supported on Fx ) +.It \&| Ta FIFO (not supported on Fx ) +.It \&P Ta event portal (not supported on Fx ) .El .It Fl H Machine-parseable output, fields separated a tab character. Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:11:46 2012 (r229581) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:12:02 2012 (r229582) @@ -195,7 +195,7 @@ are supported: .Bl -tag .It Sy disk A block device, typically located under -.Pa /dev Ns . +.Pa /dev . .Tn ZFS can use individual slices or partitions, though the recommended mode of operation is to use whole disks. A disk can be specified by a full path to the @@ -221,13 +221,14 @@ bytes and can withstand .Pq Em N-1 devices failing before data integrity is compromised. .It Sy raidz -.No ( or Sy raidz1 raidz2 raidz3 Ns ). +(or +.Sy raidz1 raidz2 raidz3 ) . A variation on .Sy RAID-5 that allows for better distribution of parity and eliminates the -.Qq Sy RAID-5 No write hole -(in which data and parity become inconsistent after a power loss). Data and -parity is striped across all disks within a +.Qq Sy RAID-5 +write hole (in which data and parity become inconsistent after a power loss). +Data and parity is striped across all disks within a .No raidz group. .Pp @@ -251,7 +252,7 @@ type specifies a triple-parity group. The .Sy raidz No vdev type is an alias for -.Sy raidz1 Ns . +.Sy raidz1 . .Pp A .No raidz @@ -322,6 +323,9 @@ are used to distinguish where a group en following creates two root .No vdev Ns s, each a mirror of two disks: +.Bd -literal -offset 2n +.Li # Ic zpool create mypool mirror da0 da1 mirror da2 da3 +.Ed .Ss Device Failure and Recovery .Tn ZFS supports a rich set of mechanisms for handling device failure and data @@ -421,7 +425,7 @@ hardware-dependent and might not be supp .Ss Hot Spares .Tn ZFS allows devices to be associated with pools as -.Qq hot spares Ns . +.Qq hot spares . These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot spares, specify a @@ -537,12 +541,13 @@ Number of blocks within the pool that ar A unique identifier for the pool. .It Sy health The current health of the pool. Health can be -.Qq Sy ONLINE Ns , -.Qq Sy DEGRADED Ns , -.Qq Sy FAULTED Ns , -.Qq Sy OFFLINE Ns , -.Qq Sy REMOVED Ns , or -.Qq Sy UNAVAIL Ns . +.Qq Sy ONLINE , +.Qq Sy DEGRADED , +.Qq Sy FAULTED , +.Qq Sy OFFLINE , +.Qq Sy REMOVED , +or +.Qq Sy UNAVAIL . .It Sy size Total size of the storage pool. .It Sy used @@ -577,7 +582,7 @@ is not a persistent property. It is vali Setting .Sy altroot defaults to using -.Cm cachefile=none Ns , +.Cm cachefile=none , though this may be overridden using an explicit setting. .El .Pp @@ -585,7 +590,7 @@ The following property can only be set a .Bl -tag -width 2n .It Sy readonly Ns = Ns Cm on No | Cm off If set to -.Cm on Ns , +.Cm on , pool will be imported in read-only mode with the following restrictions: .Bl -bullet -offset 2n .It @@ -606,7 +611,7 @@ command: .Bl -tag -width 2n .It Sy autoexpand Ns = Ns Cm on No | Cm off Controls automatic pool expansion when the underlying LUN is grown. If set to -.Qq Cm on Ns , +.Qq Cm on , the pool will be resized according to the size of the expanded device. If the device is part of a mirror or .No raidz @@ -614,20 +619,20 @@ then all devices within that .No mirror/ Ns No raidz group must be expanded before the new space is made available to the pool. The default behavior is -.Qq off Ns . +.Qq off . This property can also be referred to by its shortened column name, -.Sy expand Ns . +.Sy expand . .It Sy autoreplace Ns = Ns Cm on No | Cm off Controls automatic device replacement. If set to -.Qq Cm off Ns , +.Qq Cm off , device replacement must be initiated by the administrator by using the .Qq Nm Cm replace command. If set to -.Qq Cm on Ns , +.Qq Cm on , any new device, found in the same physical location as a device that previously belonged to the pool, is automatically formatted and replaced. The default behavior is -.Qq Cm off Ns . +.Qq Cm off . This property can also be referred to by its shortened column name, "replace". .It Sy bootfs Ns = Ns Ar pool Ns / Ns Ar dataset Identifies the default bootable dataset for the root pool. This property is @@ -650,7 +655,7 @@ creates a temporary pool that is never c Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block is automatically stored. Deafult setting is -.Cm 0 Ns . +.Cm 0 . .It Sy delegation Ns = Ns Cm on No | Cm off Controls whether a non-privileged user is granted access based on the dataset permissions defined on the dataset. See @@ -694,7 +699,7 @@ decreased. The preferred method of updat command, though this property can be used when a specific version is needed for backwards compatibility. This property can be any number between 1 and the current version reported by -.Qo Ic zpool upgrade -v Qc Ns . +.Qo Ic zpool upgrade -v Qc . .El .Sh SUBCOMMANDS All subcommands that modify state are logged persistently to the pool in their @@ -731,7 +736,7 @@ subcommand. .Bl -tag -width indent .It Fl f Forces use of -.Ar vdev Ns , +.Ar vdev , even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. .It Fl n @@ -762,7 +767,8 @@ configuration. If is not currently part of a mirrored configuration, .Ar device automatically transforms into a two-way mirror of -.Ar device No and Ar new_device Ns . If +.Ar device No and Ar new_device . +If .Ar device is part of a two-way mirror, attaching .Ar new_device @@ -772,7 +778,7 @@ begins to resilver immediately. .Bl -tag -width indent .It Fl f Forces use of -.Ar new_device Ns , +.Ar new_device , even if its appears to be in use. Not all devices can be overridden in this manner. .El @@ -846,7 +852,7 @@ is specified. Unless the .Fl R option is specified, the default mount point is -.Qq Pa /pool Ns . +.Qq Pa /pool . The mount point must not exist or must be empty, or else the root dataset cannot be mounted. This can be overridden with the .Fl m @@ -890,9 +896,11 @@ or if .Sy altroot is specified. The mount point must be an absolute path, -.Qq Cm legacy Ns , or Qq Cm none Ns . +.Qq Cm legacy , +or +.Qq Cm none . For more information on dataset mount points, see -.Xr zfs 8 Ns \&. +.Xr zfs 8 . .El .It Xo .Nm @@ -1000,7 +1008,7 @@ performed. Lists pools available to import. If the .Fl d option is not specified, this command searches for devices in -.Qq Pa /dev Ns . +.Qq Pa /dev . The .Fl d option can be specified multiple times, and all directories are searched. If @@ -1028,7 +1036,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. @@ -1078,7 +1086,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. This option is incompatible with the @@ -1141,7 +1149,7 @@ Imports a specific pool. A pool can be i identifier. If .Ar newpool is specified, the pool is imported using the name -.Ar newpool Ns . +.Ar newpool . Otherwise, it is imported with the same name as its exported name. .Pp If a device is removed from a system without running @@ -1171,7 +1179,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. This option is incompatible with the @@ -1236,11 +1244,11 @@ Print a timestamp. Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .It Fl v Verbose statistics. Reports usage statistics for individual .No vdev Ns s @@ -1256,7 +1264,7 @@ within the pool, in addition to the pool Removes .Tn ZFS label information from the specified -.Ar device Ns . +.Ar device . The .Ar device must not be part of an active pool configuration. @@ -1295,24 +1303,24 @@ instead of arbitrary space. Comma-separated list of properties to display. See the .Qq Sx Properties section for a list of valid properties. The default list is -.Sy name Ns , -.Sy size Ns , -.Sy used Ns , -.Sy available Ns , -.Sy capacity Ns , -.Sy health Ns , -.Sy altroot Ns . +.Sy name , +.Sy size , +.Sy used , +.Sy available , +.Sy capacity , +.Sy health , +.Sy altroot . .It Fl T Cm d Ns | Ns Cm u Print a timestamp. .Pp Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .El .It Xo .Nm @@ -1380,11 +1388,11 @@ devices cannot be removed from a pool. Replaces .Ar old_device with -.Ar new_device Ns . +.Ar new_device . This is equivalent to attaching -.Ar new_device Ns , +.Ar new_device , waiting for it to resilver, and then detaching -.Ar old_device Ns . +.Ar old_device . .Pp The size of .Ar new_device @@ -1397,7 +1405,7 @@ configuration. is required if the pool is not redundant. If .Ar new_device is not specified, it defaults to -.Ar old_device Ns . +.Ar old_device . This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same .Pa /dev @@ -1407,7 +1415,7 @@ recognizes this. .Bl -tag -width indent .It Fl f Forces use of -.Ar new_device Ns , +.Ar new_device , even if its appears to be in use. Not all devices can be overridden in this manner. .El @@ -1420,7 +1428,7 @@ manner. .Pp Begins a scrub. The scrub examines all data in the specified pools to verify that it checksums correctly. For replicated (mirror or -.No raidz Ns ) +.No raidz ) devices, .Tn ZFS automatically repairs any damage discovered during the scrub. The @@ -1565,11 +1573,11 @@ Print a timestamp. Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .El .It Xo .Nm @@ -1649,7 +1657,7 @@ recommended, a pool based on files can b .It Sy Example 5 No Adding a Mirror to a Tn ZFS No Storage Pool .Pp The following command adds two mirrored disks to the pool -.Em tank Ns , +.Em tank , assuming the pool is already made up of two-way mirrors. The additional space is immediately available to any datasets within the pool. .Bd -literal -offset 2n @@ -1793,7 +1801,7 @@ subcommand as follows: .It Sy Example 15 No Removing a Mirrored Log Device .Pp The following command removes the mirrored log device -.Em mirror-2 Ns . +.Em mirror-2 . .Pp Given this configuration: .Bd -literal -offset 2n From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 11:14:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D23681065703; Thu, 5 Jan 2012 11:14:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC2778FC12; Thu, 5 Jan 2012 11:14:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05BEs5l031427; Thu, 5 Jan 2012 11:14:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BEsEP031425; Thu, 5 Jan 2012 11:14:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201051114.q05BEsEP031425@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Jan 2012 11:14:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229584 - stable/8/sys/dev/uart X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 11:14:54 -0000 Author: kib Date: Thu Jan 5 11:14:54 2012 New Revision: 229584 URL: http://svn.freebsd.org/changeset/base/229584 Log: MFC r200257 (by mav): Add ID for NetMos NM9820 Serial Port chip, found on CardBus serial adapter. MFC r228947: Add PCI Id for the Intel AMT serial interface as found on my DQ67OW. Modified: stable/8/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_pci.c Thu Jan 5 11:14:28 2012 (r229583) +++ stable/8/sys/dev/uart/uart_bus_pci.c Thu Jan 5 11:14:54 2012 (r229584) @@ -111,6 +111,8 @@ static struct pci_id pci_ns8250_ids[] = { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART", 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, +{ 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, +{ 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, { 0x9710, 0x9900, 0xa000, 0x1000, From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 11:45:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 159B310656DB; Thu, 5 Jan 2012 11:45:23 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F105C8FC14; Thu, 5 Jan 2012 11:45:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05BjMML033447; Thu, 5 Jan 2012 11:45:22 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BjMAi033419; Thu, 5 Jan 2012 11:45:22 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051145.q05BjMAi033419@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:45:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229589 - in stable/8: lib/libarchive lib/libarchive/test usr.bin/cpio usr.bin/tar X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 11:45:23 -0000 Author: mm Date: Thu Jan 5 11:45:22 2012 New Revision: 229589 URL: http://svn.freebsd.org/changeset/base/229589 Log: MFC r228744, r228745, r228748: MFC r228744 [1]: Merge vendor revision 3723: Fixes extraction of Zip entries that use length-at-end without specifying either the compressed or uncompressed length. In particular, fixes bsdtar extraction of such files. Reported by: Patrick Lamaiziere (freebsd-stable@) MFC r228745: Update libarchive, tar and cpio to version 2.8.5 The following additional vendor revisions are applied: Revision 3740: Use archive_clear_error() to clear the error markers. Obtained from: http://code.google.com/p/libarchive MFC r228748: Sync libarchive with vendor branch release/2.8: 3730: Fix issue 174 (Windows path names, not relevant for FreeBSD) 3734: Merge r1989: archive_clear_error should set errno to 0. 3735: Merge r3247 from trunk: Clear errors before returning from archive_read_support_format_all() 3799: Check the position before dereferencing the pointer. This avoids dereferencing one byte past the end of a string 3824: Merge r3823 from trunk for issue 199 (hang in iso9660 reading) Obtained from: http://code.google.com/p/libarchive Added: stable/8/lib/libarchive/test/test_read_format_iso_Z.c - copied unchanged from r228745, head/lib/libarchive/test/test_read_format_iso_Z.c Deleted: stable/8/lib/libarchive/test/test_read_format_iso_gz.c Modified: stable/8/lib/libarchive/archive.h stable/8/lib/libarchive/archive_read.c stable/8/lib/libarchive/archive_read_extract.c stable/8/lib/libarchive/archive_read_support_compression_bzip2.c stable/8/lib/libarchive/archive_read_support_compression_uu.c stable/8/lib/libarchive/archive_read_support_format_all.c stable/8/lib/libarchive/archive_read_support_format_cpio.c stable/8/lib/libarchive/archive_read_support_format_iso9660.c stable/8/lib/libarchive/archive_read_support_format_tar.c stable/8/lib/libarchive/archive_read_support_format_zip.c stable/8/lib/libarchive/archive_string.c stable/8/lib/libarchive/archive_string.h stable/8/lib/libarchive/archive_util.c stable/8/lib/libarchive/archive_write_disk.c stable/8/lib/libarchive/archive_write_set_compression_xz.c stable/8/lib/libarchive/archive_write_set_format_ar.c stable/8/lib/libarchive/archive_write_set_format_shar.c stable/8/lib/libarchive/archive_write_set_format_ustar.c stable/8/lib/libarchive/config_freebsd.h stable/8/lib/libarchive/libarchive-formats.5 stable/8/lib/libarchive/libarchive.3 stable/8/lib/libarchive/test/Makefile stable/8/lib/libarchive/test/test_compat_zip.c stable/8/usr.bin/cpio/Makefile stable/8/usr.bin/tar/Makefile stable/8/usr.bin/tar/tree.c Directory Properties: stable/8/lib/libarchive/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/tar/ (props changed) Modified: stable/8/lib/libarchive/archive.h ============================================================================== --- stable/8/lib/libarchive/archive.h Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive.h Thu Jan 5 11:45:22 2012 (r229589) @@ -52,7 +52,7 @@ /* These should match the types used in 'struct stat' */ #if defined(_WIN32) && !defined(__CYGWIN__) #define __LA_INT64_T __int64 -# if defined(_SSIZE_T_DEFINED) +# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) # define __LA_SSIZE_T ssize_t # elif defined(_WIN64) # define __LA_SSIZE_T __int64 @@ -98,6 +98,13 @@ # define __LA_DECL #endif +#if defined(__GNUC__) && __GNUC__ >= 3 +#define __LA_PRINTF(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#else +#define __LA_PRINTF(fmtarg, firstvararg) /* nothing */ +#endif + #ifdef __cplusplus extern "C" { #endif @@ -129,13 +136,13 @@ extern "C" { * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_NUMBER 2008004 +#define ARCHIVE_VERSION_NUMBER 2008005 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 2.8.4" +#define ARCHIVE_VERSION_STRING "libarchive 2.8.5" __LA_DECL const char * archive_version_string(void); #if ARCHIVE_VERSION_NUMBER < 3000000 @@ -717,7 +724,7 @@ __LA_DECL const char *archive_format_nam __LA_DECL int archive_format(struct archive *); __LA_DECL void archive_clear_error(struct archive *); __LA_DECL void archive_set_error(struct archive *, int _err, - const char *fmt, ...); + const char *fmt, ...) __LA_PRINTF(3, 4); __LA_DECL void archive_copy_error(struct archive *dest, struct archive *src); __LA_DECL int archive_file_count(struct archive *); Modified: stable/8/lib/libarchive/archive_read.c ============================================================================== --- stable/8/lib/libarchive/archive_read.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read.c Thu Jan 5 11:45:22 2012 (r229589) @@ -715,7 +715,7 @@ archive_read_data_block(struct archive * /* * Close the file and release most resources. * - * Be careful: client might just call read_new and then read_finish. + * Be careful: client might just call read_new and then read_free. * Don't assume we actually read anything or performed any non-trivial * initialization. */ Modified: stable/8/lib/libarchive/archive_read_extract.c ============================================================================== --- stable/8/lib/libarchive/archive_read_extract.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_extract.c Thu Jan 5 11:45:22 2012 (r229589) @@ -108,7 +108,7 @@ archive_read_extract2(struct archive *_a if (r != ARCHIVE_OK) /* If _write_header failed, copy the error. */ archive_copy_error(&a->archive, ad); - else if (archive_entry_size(entry) > 0) + else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) /* Otherwise, pour data into the entry. */ r = copy_data(_a, ad); r2 = archive_write_finish_entry(ad); Modified: stable/8/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 11:45:22 2012 (r229589) @@ -350,4 +350,4 @@ bzip2_filter_close(struct archive_read_f return (ret); } -#endif /* HAVE_BZLIB_H */ +#endif /* HAVE_BZLIB_H && BZ_CONFIG_ERROR */ Modified: stable/8/lib/libarchive/archive_read_support_compression_uu.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_compression_uu.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_compression_uu.c Thu Jan 5 11:45:22 2012 (r229589) @@ -488,9 +488,9 @@ read_more: switch (uudecode->state) { default: case ST_FIND_HEAD: - if (len - nl > 13 && memcmp(b, "begin ", 6) == 0) + if (len - nl >= 11 && memcmp(b, "begin ", 6) == 0) l = 6; - else if (len - nl > 18 && + else if (len - nl >= 18 && memcmp(b, "begin-base64 ", 13) == 0) l = 13; else Modified: stable/8/lib/libarchive/archive_read_support_format_all.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_all.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_all.c Thu Jan 5 11:45:22 2012 (r229589) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2011 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,5 +39,13 @@ archive_read_support_format_all(struct a archive_read_support_format_tar(a); archive_read_support_format_xar(a); archive_read_support_format_zip(a); + + /* Note: We always return ARCHIVE_OK here, even if some of the + * above return ARCHIVE_WARN. The intent here is to enable + * "as much as possible." Clients who need specific + * compression should enable those individually so they can + * verify the level of support. */ + /* Clear any warning messages set by the above functions. */ + archive_clear_error(a); return (ARCHIVE_OK); } Modified: stable/8/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_cpio.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_cpio.c Thu Jan 5 11:45:22 2012 (r229589) @@ -264,9 +264,9 @@ archive_read_format_cpio_read_header(str /* Compare name to "TRAILER!!!" to test for end-of-archive. */ if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) { - /* TODO: Store file location of start of block. */ - archive_set_error(&a->archive, 0, NULL); - return (ARCHIVE_EOF); + /* TODO: Store file location of start of block. */ + archive_clear_error(&a->archive); + return (ARCHIVE_EOF); } /* Detect and record hardlinks to previously-extracted entries. */ Modified: stable/8/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_iso9660.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_iso9660.c Thu Jan 5 11:45:22 2012 (r229589) @@ -302,6 +302,8 @@ struct file_info { struct file_info *first; struct file_info **last; } rede_files; + /* To check a ininity loop. */ + struct file_info *loop_by; }; struct heap_queue { @@ -934,14 +936,14 @@ read_children(struct archive_read *a, st archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order directory (%s) %jd > %jd", parent->name.s, - iso9660->current_position, - parent->offset); + (intmax_t)iso9660->current_position, + (intmax_t)parent->offset); return (ARCHIVE_WARN); } if (parent->offset + parent->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Directory is beyond end-of-media: %s", - parent->name); + parent->name.s); return (ARCHIVE_WARN); } if (iso9660->current_position < parent->offset) { @@ -1139,7 +1141,7 @@ archive_read_format_iso9660_read_header( if (file->offset + file->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "File is beyond end-of-media: %s", file->name); + "File is beyond end-of-media: %s", file->name.s); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; return (ARCHIVE_WARN); @@ -1198,10 +1200,10 @@ archive_read_format_iso9660_read_header( if ((file->mode & AE_IFMT) != AE_IFDIR && file->offset < iso9660->current_position) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Ignoring out-of-order file @%x (%s) %jd < %jd", - file, + "Ignoring out-of-order file (%s) %jd < %jd", iso9660->pathname.s, - file->offset, iso9660->current_position); + (intmax_t)file->offset, + (intmax_t)iso9660->current_position); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; return (ARCHIVE_WARN); @@ -1524,8 +1526,8 @@ archive_read_format_iso9660_read_data(st archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order file (%s) %jd < %jd", iso9660->pathname.s, - iso9660->entry_content->offset, - iso9660->current_position); + (intmax_t)iso9660->entry_content->offset, + (intmax_t)iso9660->current_position); *buff = NULL; *size = 0; *offset = iso9660->entry_sparse_offset; @@ -1626,8 +1628,8 @@ parse_file_info(struct archive_read *a, */ if (location > 0 && (location + ((fsize + iso9660->logical_block_size -1) - / iso9660->logical_block_size)) > - (unsigned int)iso9660->volume_block) { + / iso9660->logical_block_size)) + > (uint32_t)iso9660->volume_block) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid location of extent of file"); return (NULL); @@ -2699,8 +2701,14 @@ rede_add_entry(struct file_info *file) struct file_info *re; re = file->parent; - while (re != NULL && !re->re) + while (re != NULL && !re->re) { + /* Sanity check to prevent a infinity loop + * cause by a currupted iso file. */ + if (re->loop_by == file) + return (-1); + re->loop_by = file; re = re->parent; + } if (re == NULL) return (-1); Modified: stable/8/lib/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_tar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_tar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -576,7 +576,7 @@ tar_read_header(struct archive_read *a, h = __archive_read_ahead(a, 512, NULL); if (h != NULL) __archive_read_consume(a, 512); - archive_set_error(&a->archive, 0, NULL); + archive_clear_error(&a->archive); if (a->archive.archive_format_name == NULL) { a->archive.archive_format = ARCHIVE_FORMAT_TAR; a->archive.archive_format_name = "tar"; Modified: stable/8/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_zip.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_zip.c Thu Jan 5 11:45:22 2012 (r229589) @@ -211,7 +211,7 @@ archive_read_format_zip_bid(struct archi /* Get 4k of data beyond where we stopped. */ buff = __archive_read_ahead(a, offset + 4096, &bytes_avail); - if (bytes_avail < offset + 1) + if (buff == NULL) break; p = (const char *)buff + offset; while (p + 9 < (const char *)buff + bytes_avail) { Modified: stable/8/lib/libarchive/archive_string.c ============================================================================== --- stable/8/lib/libarchive/archive_string.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_string.c Thu Jan 5 11:45:22 2012 (r229589) @@ -152,7 +152,7 @@ __archive_strncat(struct archive_string /* Like strlen(p), except won't examine positions beyond p[n]. */ s = 0; pp = p; - while (*pp && s < n) { + while (s < n && *pp) { pp++; s++; } Modified: stable/8/lib/libarchive/archive_string.h ============================================================================== --- stable/8/lib/libarchive/archive_string.h Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_string.h Thu Jan 5 11:45:22 2012 (r229589) @@ -44,6 +44,8 @@ #include #endif +#include "archive.h" + /* * Basic resizable/reusable string support a la Java's "StringBuffer." * @@ -134,10 +136,11 @@ void __archive_string_free(struct archiv /* Like 'vsprintf', but resizes the underlying string as necessary. */ void __archive_string_vsprintf(struct archive_string *, const char *, - va_list); + va_list) __LA_PRINTF(2, 0); #define archive_string_vsprintf __archive_string_vsprintf -void __archive_string_sprintf(struct archive_string *, const char *, ...); +void __archive_string_sprintf(struct archive_string *, const char *, ...) + __LA_PRINTF(2, 3); #define archive_string_sprintf __archive_string_sprintf /* Allocates a fresh buffer and converts as (assumed to be UTF-8) into it. Modified: stable/8/lib/libarchive/archive_util.c ============================================================================== --- stable/8/lib/libarchive/archive_util.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_util.c Thu Jan 5 11:45:22 2012 (r229589) @@ -155,6 +155,7 @@ archive_clear_error(struct archive *a) { archive_string_empty(&a->error_string); a->error = NULL; + a->archive_error_number = 0; } void Modified: stable/8/lib/libarchive/archive_write_disk.c ============================================================================== --- stable/8/lib/libarchive/archive_write_disk.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_disk.c Thu Jan 5 11:45:22 2012 (r229589) @@ -1513,6 +1513,22 @@ check_symlinks(struct archive_write_disk } #if defined(_WIN32) || defined(__CYGWIN__) +static int +guidword(const char *p, int n) +{ + int i; + + for (i = 0; i < n; i++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'a' && *p <= 'f') || + (*p >= 'A' && *p <= 'F')) + p++; + else + return (-1); + } + return (0); +} + /* * 1. Convert a path separator from '\' to '/' . * We shouldn't check multi-byte character directly because some @@ -1521,26 +1537,92 @@ check_symlinks(struct archive_write_disk * 2. Replace unusable characters in Windows with underscore('_'). * See also : http://msdn.microsoft.com/en-us/library/aa365247.aspx */ -static void +static int cleanup_pathname_win(struct archive_write_disk *a) { wchar_t wc; char *p; size_t alen, l; - alen = 0; - l = 0; - for (p = a->name; *p != '\0'; p++) { - ++alen; - if (*p == '\\') - l = 1; + p = a->name; + /* Skip leading "\\.\" or "\\?\" or "\\?\UNC\" or + * "\\?\Volume{GUID}\" + * (absolute path prefixes used by Windows API) */ + if ((p[0] == '\\' || p[0] == '/') && (p[1] == '\\' || p[1] == '/' ) && + (p[2] == '.' || p[2] == '?') && (p[3] == '\\' || p[3] == '/')) + { + /* A path begin with "\\?\UNC\" */ + if (p[2] == '?' && + (p[4] == 'U' || p[4] == 'u') && + (p[5] == 'N' || p[5] == 'n') && + (p[6] == 'C' || p[6] == 'c') && + (p[7] == '\\' || p[7] == '/')) + p += 8; + /* A path begin with "\\?\Volume{GUID}\" */ + else if (p[2] == '?' && + (p[4] == 'V' || p[4] == 'v') && + (p[5] == 'O' || p[5] == 'o') && + (p[6] == 'L' || p[6] == 'l') && + (p[7] == 'U' || p[7] == 'u') && + (p[8] == 'M' || p[8] == 'm') && + (p[9] == 'E' || p[9] == 'e') && + p[10] == '{') { + if (guidword(p+11, 8) == 0 && p[19] == '-' && + guidword(p+20, 4) == 0 && p[24] == '-' && + guidword(p+25, 4) == 0 && p[29] == '-' && + guidword(p+30, 4) == 0 && p[34] == '-' && + guidword(p+35, 12) == 0 && p[47] == '}' && + (p[48] == '\\' || p[48] == '/')) + p += 49; + else + p += 4; + /* A path begin with "\\.\PhysicalDriveX" */ + } else if (p[2] == '.' && + (p[4] == 'P' || p[4] == 'p') && + (p[5] == 'H' || p[5] == 'h') && + (p[6] == 'Y' || p[6] == 'y') && + (p[7] == 'S' || p[7] == 's') && + (p[8] == 'I' || p[8] == 'i') && + (p[9] == 'C' || p[9] == 'c') && + (p[9] == 'A' || p[9] == 'a') && + (p[9] == 'L' || p[9] == 'l') && + (p[9] == 'D' || p[9] == 'd') && + (p[9] == 'R' || p[9] == 'r') && + (p[9] == 'I' || p[9] == 'i') && + (p[9] == 'V' || p[9] == 'v') && + (p[9] == 'E' || p[9] == 'e') && + (p[10] >= '0' && p[10] <= '9') && + p[11] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a physical drive name"); + return (ARCHIVE_FAILED); + } else + p += 4; + } + + /* Skip leading drive letter from archives created + * on Windows. */ + if (((p[0] >= 'a' && p[0] <= 'z') || + (p[0] >= 'A' && p[0] <= 'Z')) && + p[1] == ':') { + if (p[2] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a drive name"); + return (ARCHIVE_FAILED); + } + if (p[2] == '\\' || p[2] == '/') + p += 3; + } + + for (; *p != '\0'; p++) { /* Rewrite the path name if its character is a unusable. */ if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|') *p = '_'; } - if (alen == 0 || l == 0) - return; + alen = p - a->name; + if (alen == 0 || strchr(a->name, '\\') == NULL) + return (ARCHIVE_OK); /* * Convert path separator. */ @@ -1560,6 +1642,7 @@ cleanup_pathname_win(struct archive_writ p += l; alen -= l; } + return (ARCHIVE_OK); } #endif @@ -1583,7 +1666,8 @@ cleanup_pathname(struct archive_write_di } #if defined(_WIN32) || defined(__CYGWIN__) - cleanup_pathname_win(a); + if (cleanup_pathname_win(a) != ARCHIVE_OK) + return (ARCHIVE_FAILED); #endif /* Skip leading '/'. */ if (*src == '/') @@ -1730,7 +1814,7 @@ create_dir(struct archive_write_disk *a, if (unlink(path) != 0) { archive_set_error(&a->archive, errno, "Can't create directory '%s': " - "Conflicting file cannot be removed"); + "Conflicting file cannot be removed", path); return (ARCHIVE_FAILED); } } else if (errno != ENOENT && errno != ENOTDIR) { Modified: stable/8/lib/libarchive/archive_write_set_compression_xz.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_compression_xz.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_compression_xz.c Thu Jan 5 11:45:22 2012 (r229589) @@ -132,9 +132,10 @@ static int archive_compressor_xz_init_stream(struct archive_write *a, struct private_data *state) { + static const lzma_stream lzma_stream_init_data = LZMA_STREAM_INIT; int ret; - state->stream = (lzma_stream)LZMA_STREAM_INIT; + state->stream = lzma_stream_init_data; state->stream.next_out = state->compressed; state->stream.avail_out = state->compressed_buffer_size; if (a->archive.compression_code == ARCHIVE_COMPRESSION_XZ) Modified: stable/8/lib/libarchive/archive_write_set_format_ar.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_ar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_format_ar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -440,7 +440,7 @@ archive_write_ar_finish_entry(struct arc if (ar->entry_padding != 1) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Padding wrong size: %d should be 1 or 0", - ar->entry_padding); + (int)ar->entry_padding); return (ARCHIVE_WARN); } Modified: stable/8/lib/libarchive/archive_write_set_format_shar.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_shar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_format_shar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -537,8 +537,7 @@ archive_write_shar_finish_entry(struct a } if ((p = archive_entry_fflags_text(shar->entry)) != NULL) { - archive_string_sprintf(&shar->work, "chflags %s ", - p, archive_entry_pathname(shar->entry)); + archive_string_sprintf(&shar->work, "chflags %s ", p); shar_quote(&shar->work, archive_entry_pathname(shar->entry), 1); archive_strcat(&shar->work, "\n"); Modified: stable/8/lib/libarchive/archive_write_set_format_ustar.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_ustar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_format_ustar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -168,7 +168,7 @@ archive_write_set_format_ustar(struct ar /* Basic internal sanity test. */ if (sizeof(template_header) != 512) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", sizeof(template_header)); + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", (int)sizeof(template_header)); return (ARCHIVE_FATAL); } Modified: stable/8/lib/libarchive/config_freebsd.h ============================================================================== --- stable/8/lib/libarchive/config_freebsd.h Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/config_freebsd.h Thu Jan 5 11:45:22 2012 (r229589) @@ -68,6 +68,7 @@ #endif #define HAVE_BSDXML_H 1 +#define HAVE_BZLIB_H 1 #define HAVE_CHFLAGS 1 #define HAVE_CHOWN 1 #define HAVE_DECL_EXTATTR_NAMESPACE_USER 1 Modified: stable/8/lib/libarchive/libarchive-formats.5 ============================================================================== --- stable/8/lib/libarchive/libarchive-formats.5 Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/libarchive-formats.5 Thu Jan 5 11:45:22 2012 (r229589) @@ -65,6 +65,7 @@ Later variants have extended this by eit areas of the header record, extending the header to multiple records, or by storing special entries that modify the interpretation of subsequent entries. +.Pp .Bl -tag -width indent .It Cm gnutar The Modified: stable/8/lib/libarchive/libarchive.3 ============================================================================== --- stable/8/lib/libarchive/libarchive.3 Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/libarchive.3 Thu Jan 5 11:45:22 2012 (r229589) @@ -177,6 +177,8 @@ which provides a slightly more efficient You may prefer to use the higher-level .Fn archive_read_data_skip , which reads and discards the data for this entry, +.Fn archive_read_data_to_buffer , +which reads the data into an in-memory buffer, .Fn archive_read_data_to_file , which copies the data to the provided file descriptor, or .Fn archive_read_extract , Modified: stable/8/lib/libarchive/test/Makefile ============================================================================== --- stable/8/lib/libarchive/test/Makefile Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/test/Makefile Thu Jan 5 11:45:22 2012 (r229589) @@ -52,7 +52,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ - test_read_format_iso_gz.c \ + test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_isorr_rr_moved.c \ test_read_format_isojoliet_bz2.c \ Modified: stable/8/lib/libarchive/test/test_compat_zip.c ============================================================================== --- stable/8/lib/libarchive/test/test_compat_zip.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/test/test_compat_zip.c Thu Jan 5 11:45:22 2012 (r229589) @@ -67,7 +67,7 @@ finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); #endif } Copied: stable/8/lib/libarchive/test/test_read_format_iso_Z.c (from r228745, head/lib/libarchive/test/test_read_format_iso_Z.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libarchive/test/test_read_format_iso_Z.c Thu Jan 5 11:45:22 2012 (r229589, copy of r228745, head/lib/libarchive/test/test_read_format_iso_Z.c) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static void +test1(void) +{ + struct archive_entry *ae; + struct archive *a; + const char *name = "test_read_format_iso.iso.Z"; + + extract_reference_file(name); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, name, 512)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualInt(archive_compression(a), + ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +static +void test2(void) +{ + struct archive_entry *ae; + struct archive *a; + const char *name = "test_read_format_iso_2.iso.Z"; + + extract_reference_file(name); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, name, 512)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString(".", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("A", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("A/B", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("C", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("C/D", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_next_header(a, &ae)); + assertEqualInt(archive_compression(a), + ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +DEFINE_TEST(test_read_format_iso_Z) +{ + test1(); + test2(); +} + + Modified: stable/8/usr.bin/cpio/Makefile ============================================================================== --- stable/8/usr.bin/cpio/Makefile Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/usr.bin/cpio/Makefile Thu Jan 5 11:45:22 2012 (r229589) @@ -3,7 +3,7 @@ .include PROG= bsdcpio -BSDCPIO_VERSION_STRING=2.8.4 +BSDCPIO_VERSION_STRING=2.8.5 SRCS= cpio.c cmdline.c Modified: stable/8/usr.bin/tar/Makefile ============================================================================== --- stable/8/usr.bin/tar/Makefile Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/usr.bin/tar/Makefile Thu Jan 5 11:45:22 2012 (r229589) @@ -2,7 +2,7 @@ .include PROG= bsdtar -BSDTAR_VERSION_STRING=2.8.4 +BSDTAR_VERSION_STRING=2.8.5 SRCS= bsdtar.c \ cmdline.c \ getdate.c \ Modified: stable/8/usr.bin/tar/tree.c ============================================================================== --- stable/8/usr.bin/tar/tree.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/usr.bin/tar/tree.c Thu Jan 5 11:45:22 2012 (r229589) @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_DIRECT_H +#include +#endif #ifdef HAVE_DIRENT_H #include #endif @@ -66,6 +69,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UNISTD_H #include #endif +#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__) +#include +#endif #include "tree.h" @@ -76,27 +82,38 @@ __FBSDID("$FreeBSD$"); */ struct tree_entry { + int depth; struct tree_entry *next; struct tree_entry *parent; char *name; size_t dirname_length; dev_t dev; ino_t ino; + int flags; + /* How to return back to the parent of a symlink. */ #ifdef HAVE_FCHDIR - int fd; + int symlink_parent_fd; #elif defined(_WIN32) && !defined(__CYGWIN__) - char *fullpath; + char *symlink_parent_path; #else #error fchdir function required. #endif - int flags; }; /* Definitions for tree_entry.flags bitmap. */ #define isDir 1 /* This entry is a regular directory. */ #define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsPreVisit 4 /* This entry needs to be previsited. */ -#define needsPostVisit 8 /* This entry needs to be postvisited. */ +#define needsFirstVisit 4 /* This is an initial entry. */ +#define needsDescent 8 /* This entry needs to be previsited. */ +#define needsOpen 16 /* This is a directory that needs to be opened. */ +#define needsAscent 32 /* This entry needs to be postvisited. */ + +/* + * On Windows, "first visit" is handled as a pattern to be handed to + * _findfirst(). This is consistent with Windows conventions that + * file patterns are handled within the application. On Posix, + * "first visit" is just returned to the client. + */ /* * Local data for this package. @@ -104,21 +121,28 @@ struct tree_entry { struct tree { struct tree_entry *stack; struct tree_entry *current; +#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__) + HANDLE d; + BY_HANDLE_FILE_INFORMATION fileInfo; +#define INVALID_DIR_HANDLE INVALID_HANDLE_VALUE + WIN32_FIND_DATA _findData; + WIN32_FIND_DATA *findData; +#else DIR *d; -#ifdef HAVE_FCHDIR - int initialDirFd; -#elif defined(_WIN32) && !defined(__CYGWIN__) - char *initialDir; +#define INVALID_DIR_HANDLE NULL + struct dirent *de; #endif int flags; int visit_type; int tree_errno; /* Error code from last failed operation. */ + /* Dynamically-sized buffer for holding path */ char *buff; - const char *basename; size_t buff_length; - size_t path_length; - size_t dirname_length; + + const char *basename; /* Last path element */ + size_t dirname_length; /* Leading dir length */ + size_t path_length; /* Total path length */ int depth; int openCount; @@ -129,10 +153,17 @@ struct tree { }; /* Definitions for tree.flags bitmap. */ -#define needsReturn 8 /* Marks first entry as not having been returned yet. */ -#define hasStat 16 /* The st entry is set. */ -#define hasLstat 32 /* The lst entry is set. */ +#define hasStat 16 /* The st entry is valid. */ +#define hasLstat 32 /* The lst entry is valid. */ +#define hasFileInfo 64 /* The Windows fileInfo entry is valid. */ +#if defined(_WIN32) && !defined(__CYGWIN__) +static int +tree_dir_next_windows(struct tree *t, const char *pattern); +#else +static int +tree_dir_next_posix(struct tree *t); +#endif #ifdef HAVE_DIRENT_D_NAMLEN /* BSD extension; avoids need for a strlen() call. */ @@ -141,25 +172,32 @@ struct tree { #define D_NAMELEN(dp) (strlen((dp)->d_name)) #endif -#if 0 #include void tree_dump(struct tree *t, FILE *out) { + char buff[300]; struct tree_entry *te; fprintf(out, "\tdepth: %d\n", t->depth); fprintf(out, "\tbuff: %s\n", t->buff); - fprintf(out, "\tpwd: "); fflush(stdout); system("pwd"); - fprintf(out, "\taccess: %s\n", t->basename); + fprintf(out, "\tpwd: %s\n", getcwd(buff, sizeof(buff))); + fprintf(out, "\tbasename: %s\n", t->basename); fprintf(out, "\tstack:\n"); for (te = t->stack; te != NULL; te = te->next) { - fprintf(out, "\t\tte->name: %s%s%s\n", te->name, - te->flags & needsPreVisit ? "" : " *", - t->current == te ? " (current)" : ""); + fprintf(out, "\t\t%s%d:\"%s\" %s%s%s%s%s%s\n", + t->current == te ? "*" : " ", + te->depth, + te->name, + te->flags & needsFirstVisit ? "V" : "", + te->flags & needsDescent ? "D" : "", + te->flags & needsOpen ? "O" : "", + te->flags & needsAscent ? "A" : "", + te->flags & isDirLink ? "L" : "", + (t->current == te && t->d) ? "+" : "" + ); } } -#endif /* * Add a directory path to the current stack. @@ -172,24 +210,29 @@ tree_push(struct tree *t, const char *pa te = malloc(sizeof(*te)); memset(te, 0, sizeof(*te)); te->next = t->stack; + te->parent = t->current; + if (te->parent) + te->depth = te->parent->depth + 1; t->stack = te; #ifdef HAVE_FCHDIR - te->fd = -1; + te->symlink_parent_fd = -1; + te->name = strdup(path); #elif defined(_WIN32) && !defined(__CYGWIN__) - te->fullpath = NULL; -#endif + te->symlink_parent_path = NULL; te->name = strdup(path); - te->flags = needsPreVisit | needsPostVisit; +#endif + te->flags = needsDescent | needsOpen | needsAscent; te->dirname_length = t->dirname_length; } /* - * Append a name to the current path. + * Append a name to the current dir path. */ static void tree_append(struct tree *t, const char *name, size_t name_length) { char *p; + size_t size_needed; if (t->buff != NULL) t->buff[t->dirname_length] = '\0'; @@ -198,12 +241,16 @@ tree_append(struct tree *t, const char * name_length--; /* Resize pathname buffer as needed. */ - while (name_length + 1 + t->dirname_length >= t->buff_length) { - t->buff_length *= 2; + size_needed = name_length + 1 + t->dirname_length; + if (t->buff_length < size_needed) { if (t->buff_length < 1024) t->buff_length = 1024; + while (t->buff_length < size_needed) + t->buff_length *= 2; t->buff = realloc(t->buff, t->buff_length); } + if (t->buff == NULL) + abort(); p = t->buff + t->dirname_length; t->path_length = t->dirname_length + name_length; /* Add a separating '/' if it's needed. */ @@ -211,7 +258,11 @@ tree_append(struct tree *t, const char * *p++ = '/'; t->path_length ++; } +#if HAVE_STRNCPY_S + strncpy_s(p, t->buff_length - (p - t->buff), name, name_length); +#else strncpy(p, name, name_length); +#endif p[name_length] = '\0'; t->basename = p; } @@ -222,24 +273,55 @@ tree_append(struct tree *t, const char * struct tree * tree_open(const char *path) { +#ifdef HAVE_FCHDIR struct tree *t; t = malloc(sizeof(*t)); memset(t, 0, sizeof(*t)); - tree_append(t, path, strlen(path)); -#ifdef HAVE_FCHDIR - t->initialDirFd = open(".", O_RDONLY); + /* First item is set up a lot like a symlink traversal. */ + tree_push(t, path); + t->stack->flags = needsFirstVisit | isDirLink | needsAscent; + t->stack->symlink_parent_fd = open(".", O_RDONLY); + t->openCount++; + t->d = INVALID_DIR_HANDLE; + return (t); #elif defined(_WIN32) && !defined(__CYGWIN__) - t->initialDir = getcwd(NULL, 0); -#endif - /* - * During most of the traversal, items are set up and then - * returned immediately from tree_next(). That doesn't work - * for the very first entry, so we set a flag for this special - * case. - */ - t->flags = needsReturn; + struct tree *t; + char *cwd = _getcwd(NULL, 0); + char *pathname = strdup(path), *p, *base; + + if (pathname == NULL) + abort(); + for (p = pathname; *p != '\0'; ++p) { + if (*p == '\\') + *p = '/'; + } + base = pathname; + + t = malloc(sizeof(*t)); + memset(t, 0, sizeof(*t)); + /* First item is set up a lot like a symlink traversal. */ + /* printf("Looking for wildcard in %s\n", path); */ + /* TODO: wildcard detection here screws up on \\?\c:\ UNC names */ + if (strchr(base, '*') || strchr(base, '?')) { + // It has a wildcard in it... + // Separate the last element. + p = strrchr(base, '/'); + if (p != NULL) { + *p = '\0'; + chdir(base); + tree_append(t, base, p - base); + t->dirname_length = t->path_length; + base = p + 1; + } + } + tree_push(t, base); + free(pathname); + t->stack->flags = needsFirstVisit | isDirLink | needsAscent; + t->stack->symlink_parent_path = cwd; + t->d = INVALID_DIR_HANDLE; return (t); +#endif } /* @@ -255,22 +337,26 @@ tree_ascend(struct tree *t) t->depth--; if (te->flags & isDirLink) { #ifdef HAVE_FCHDIR - if (fchdir(te->fd) != 0) { + if (fchdir(te->symlink_parent_fd) != 0) { t->tree_errno = errno; r = TREE_ERROR_FATAL; } - close(te->fd); + close(te->symlink_parent_fd); #elif defined(_WIN32) && !defined(__CYGWIN__) - if (chdir(te->fullpath) != 0) { + if (SetCurrentDirectory(te->symlink_parent_path) == 0) { t->tree_errno = errno; r = TREE_ERROR_FATAL; } - free(te->fullpath); - te->fullpath = NULL; + free(te->symlink_parent_path); + te->symlink_parent_path = NULL; #endif t->openCount--; } else { +#if defined(_WIN32) && !defined(__CYGWIN__) + if (SetCurrentDirectory("..") == 0) { +#else if (chdir("..") != 0) { +#endif t->tree_errno = errno; r = TREE_ERROR_FATAL; } @@ -286,16 +372,18 @@ tree_pop(struct tree *t) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 12:07:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88744106564A; Thu, 5 Jan 2012 12:07:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DB248FC17; Thu, 5 Jan 2012 12:07:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05C7hXI034661; Thu, 5 Jan 2012 12:07:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05C7ghw034598; Thu, 5 Jan 2012 12:07:42 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051207.q05C7ghw034598@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 12:07:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229593 - in stable/8/contrib/libarchive: . build contrib cpio cpio/test doc examples libarchive libarchive/test libarchive_fe tar tar/test X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 12:07:43 -0000 Author: mm Date: Thu Jan 5 12:07:42 2012 New Revision: 229593 URL: http://svn.freebsd.org/changeset/base/229593 Log: MFC contrib/libarchive: r228761-r228764, r228770-r228777, r228835, r228911: MFC r228761: Copy libarchive from vendor branch to contrib MFC r228762: Add FREEBSD-Xlist and FREEBSD-upgrade to contrib/libarchive MFC r228763: Set svn:keywords to FreeBSD=%H for contrib/libarchive MFC r228764: Strip unnecessary files and directories from contrib/libarchive according to FREEBSD-Xlist MFC r228770: Remove libarchive/archive_entry_copy_bhfi.c and libarchive/mtree.5 Add these files to FREEBSD-Xlist MFC r228771: Partial merge of r224691 from lib/libarchive: Add compatibility for ISO images created with unfixed makefs that violated ECMA-119 (ISO9660): allow reserved4 to be 0x20 in PVD. This allows tar to read FreeBSD distribution ISO images created with makefs prior to NetBSD bin/45217 bugfix (up to 9.0-BETA1). MFC r228772: Add missing integer casts to comparsions in libarchive read. MFC r228773: Merge FreeBSD changes from lib/libarchive to contrib/libarchive: r204111 (uqs): Fix common misspelling of hierarchy r208027 (uqs): mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the bottom of the manpages and order them consistently. GNU groff doesn't care about the ordering, and doesn't even mention CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put them. r208291 (uqs): mdoc: consistently spell our email addresses r209031 (uqs): mdoc nitpicking: the title argument shall be uppercase r214822 (kientzle): Clarify the naming: Methods that free an object should be called "free". Retain the old "finish" names to preserve source compatibility for now. r214905 (kientzle): If the Zip reader doesn't see a PK signature block because there's inter-entry garbage, just scan forward to find the next one. This allows us to handle a lot of Zip archives that have been modified in-place. Thanks to: Gleb Kurtsou for sending me a sample archive r216258 (kientzle): Don't write data into an empty "file." In particular, this check avoids a warning when extracting directory entries from certain GNU tar archives that store directory contents. r225525 (kientzle): Fix cpio on ARM. MFC r228774: Add $FreeBSD$ to libarchive_fe headers where missing. MFC r228775: Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/libarchive_fe: r213469: Recognize both ! and ^ as markers for negated character classes. MFC r228776: Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/tar: r204111 (uqs): Fix common misspelling of hierarchy r207786 (kientzle): Various manpage updates, including many long-option synonyms that were previously undocumented. r208028 (uqs): mdoc: move remaining sections into consistent order This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections. r209152 (kientzle): If the compressed data is larger than the uncompressed, report the compression ratio as 0% instead of displaying nonsense triggered by numeric overflow. This is common when dealing with uncompressed files when the I/O blocking causes there to be small transient differences in the accounting. r210720 (joel): Fix typos. r223541 (kientzle): If there is a read error reading Y/N confirmation from the keyboard, exit immediately with an error. If there is an error opening or reading a file to put into the archive, set the return value for a deferred error exit. r223573 (kientzle): The --newer-than test should descend into old directories to look for new files. r226636 (kientzle): Typo from previous commit. Urgh. r224153 (mm, partial): Update bsdtar.1 manpage MFC r228777: Merge FreeBSD changes from usr.bin/cpio to contrib/libarchive/cpio: r204111 (uqs): Fix common misspelling of hierarchy r211054 (kientzle); Fix -R when used with -p. Previously, the uname and gname weren't overwritten, so the disk restore would use those to lookup the original uid/gid again. Clearing the uname and gname prevents this. r212263 (gjb): Fix typo in bsdcpio manual: s/libarchive_formats/libarchive-formats MFC r228835: Fix typo s/xz/libarchive/ Reported by: Emil Mikulic (private e-mail) MFC r228911: Update to vendor revision 4016. Vendor has integrated most of our local changes in revisions 3976-3979 so future updates are going to be easier. Thanks to Tim Kientzle . Added: - copied from r228761, head/contrib/libarchive/ stable/8/contrib/libarchive/FREEBSD-Xlist - copied, changed from r228762, head/contrib/libarchive/FREEBSD-Xlist stable/8/contrib/libarchive/FREEBSD-upgrade - copied, changed from r228762, head/contrib/libarchive/FREEBSD-upgrade stable/8/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu - copied unchanged from r228911, head/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu Directory Properties: stable/8/contrib/libarchive/ (props changed) Deleted: stable/8/contrib/libarchive/CMakeLists.txt stable/8/contrib/libarchive/CTestConfig.cmake stable/8/contrib/libarchive/INSTALL stable/8/contrib/libarchive/Makefile.am stable/8/contrib/libarchive/build/ stable/8/contrib/libarchive/configure.ac stable/8/contrib/libarchive/contrib/ stable/8/contrib/libarchive/cpio/CMakeLists.txt stable/8/contrib/libarchive/cpio/cpio_windows.c stable/8/contrib/libarchive/cpio/cpio_windows.h stable/8/contrib/libarchive/cpio/test/CMakeLists.txt stable/8/contrib/libarchive/doc/ stable/8/contrib/libarchive/examples/ stable/8/contrib/libarchive/libarchive/CMakeLists.txt stable/8/contrib/libarchive/libarchive/archive_entry_copy_bhfi.c stable/8/contrib/libarchive/libarchive/archive_windows.c stable/8/contrib/libarchive/libarchive/archive_windows.h stable/8/contrib/libarchive/libarchive/filter_fork_windows.c stable/8/contrib/libarchive/libarchive/mtree.5 stable/8/contrib/libarchive/libarchive/test/.cvsignore stable/8/contrib/libarchive/libarchive/test/CMakeLists.txt stable/8/contrib/libarchive/tar/CMakeLists.txt stable/8/contrib/libarchive/tar/bsdtar_windows.c stable/8/contrib/libarchive/tar/bsdtar_windows.h stable/8/contrib/libarchive/tar/test/CMakeLists.txt stable/8/contrib/libarchive/tar/test/test_windows.c Modified: stable/8/contrib/libarchive/cpio/bsdcpio.1 (contents, props changed) stable/8/contrib/libarchive/cpio/cmdline.c (contents, props changed) stable/8/contrib/libarchive/cpio/config_freebsd.h (contents, props changed) stable/8/contrib/libarchive/cpio/cpio.c (contents, props changed) stable/8/contrib/libarchive/cpio/cpio.h (contents, props changed) stable/8/contrib/libarchive/cpio/cpio_platform.h (contents, props changed) stable/8/contrib/libarchive/cpio/test/main.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test.h (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_basic.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_format_newc.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_L_upper.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_a.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_tv.stdout.uu (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_y.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_passthrough_dotdot.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_passthrough_reverse.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_check_magic.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_crc32.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_endian.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_copy_stat.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_link_resolver.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_stat.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_strmode.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_xattr.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_hash.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_platform.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_data_into_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_extract.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_all.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_compress.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_none.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_uu.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_all.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_raw.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_tar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_xar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_string.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_string.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_string_sprintf.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_util.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_util.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_virtual.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk_set_standard_lookup.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_compress.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_none.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_by_name.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_pax.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_shar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_ustar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/config_freebsd.h (contents, props changed) stable/8/contrib/libarchive/libarchive/cpio.5 (contents, props changed) stable/8/contrib/libarchive/libarchive/filter_fork.c (contents, props changed) stable/8/contrib/libarchive/libarchive/filter_fork.h (contents, props changed) stable/8/contrib/libarchive/libarchive/libarchive-formats.5 (contents, props changed) stable/8/contrib/libarchive/libarchive/libarchive.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/libarchive_internals.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/tar.5 (contents, props changed) stable/8/contrib/libarchive/libarchive/test/README (contents, props changed) stable/8/contrib/libarchive/libarchive/test/main.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/read_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test.h (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_acl_basic.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_acl_freebsd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_acl_pax.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_archive_api_feature.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_bad_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_bzip2_1.tbz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_bzip2_2.tbz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_cpio_1.cpio.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gtar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gtar_1.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gzip_1.tgz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gzip_2.tgz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma_1.tlz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma_2.tlz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma_3.tlz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_tar_hardlink.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_tar_hardlink_1.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_xz_1.txz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_zip_1.zip.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_empty_write.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_entry.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_entry_strmode.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_extattr_freebsd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_fuzz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_fuzz_1.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_link_resolver.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_open_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_open_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_open_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_pax_filename_encoding.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_pax_filename_encoding.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_compress_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_data_large.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_disk_entry_from_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_extract.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_file_nonexistent.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_ar.ar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_Z.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.cpio.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_gz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_odc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4c_Z.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_gz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_Z.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_joliet.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isojoliet_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isojoliet_long.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isojoliet_rr.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_ce.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_new_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_rr_moved.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isozisofs_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_mtree.mtree.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_pax_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_raw.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_raw.data.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_raw.data.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tbz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tgz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tlz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_txz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_zip.zip.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_large.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_pax_truncated.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_position.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_truncated.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_uu.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_tar_filenames.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_tar_large.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_ustar_filenames.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_failures.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_hardlink.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_perms.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_secure.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_sparse.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_symlink.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_times.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio_newc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio_odc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_shar_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_tar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_tar_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_tar_ustar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_zip_no_compression.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/err.h (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/lafe_platform.h (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/line_reader.h (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/matching.c (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/pathmatch.c (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar.1 (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar.c (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar.h (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar_platform.h (contents, props changed) stable/8/contrib/libarchive/tar/config_freebsd.h (contents, props changed) stable/8/contrib/libarchive/tar/read.c (contents, props changed) stable/8/contrib/libarchive/tar/subst.c (contents, props changed) stable/8/contrib/libarchive/tar/test/main.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test.h (contents, props changed) stable/8/contrib/libarchive/tar/test/test_0.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_basic.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_copy.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_getdate.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_help.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_option_T_upper.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_option_q.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_option_s.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_patterns.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_stdio.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_strip_components.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_symlink_dir.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_version.c (contents, props changed) stable/8/contrib/libarchive/tar/tree.c (contents, props changed) stable/8/contrib/libarchive/tar/tree.h (contents, props changed) stable/8/contrib/libarchive/tar/util.c (contents, props changed) stable/8/contrib/libarchive/tar/write.c (contents, props changed) Directory Properties: stable/8/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/libarchive/COPYING (props changed) stable/8/contrib/libarchive/NEWS (props changed) stable/8/contrib/libarchive/README (props changed) stable/8/contrib/libarchive/cpio/ (props changed) stable/8/contrib/libarchive/cpio/test/test_0.c (props changed) stable/8/contrib/libarchive/cpio/test/test_cmdline.c (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.bin.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.crc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.newc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.ustar.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.bin.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.crc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.newc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_B_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_C_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_J_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_Z_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_c.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_d.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_f.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_f.cpio.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_help.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_l.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_lzma.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_m.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_m.cpio.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_t.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_t.cpio.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_t.stdout.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_u.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_version.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_z.c (props changed) stable/8/contrib/libarchive/cpio/test/test_owner_parse.c (props changed) stable/8/contrib/libarchive/cpio/test/test_pathmatch.c (props changed) stable/8/contrib/libarchive/libarchive/ (props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_rpm.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_open_failure.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_2.iso.Z.uu (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_xar.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_pax.c (props changed) stable/8/contrib/libarchive/libarchive_fe/ (props changed) stable/8/contrib/libarchive/libarchive_fe/err.c (props changed) stable/8/contrib/libarchive/libarchive_fe/line_reader.c (props changed) stable/8/contrib/libarchive/libarchive_fe/matching.h (props changed) stable/8/contrib/libarchive/libarchive_fe/pathmatch.h (props changed) stable/8/contrib/libarchive/tar/ (props changed) stable/8/contrib/libarchive/tar/cmdline.c (props changed) stable/8/contrib/libarchive/tar/getdate.c (props changed) stable/8/contrib/libarchive/tar/test/test_empty_mtree.c (props changed) stable/8/contrib/libarchive/tar/test/test_option_r.c (props changed) stable/8/contrib/libarchive/tar/test/test_patterns_2.tar.uu (props changed) stable/8/contrib/libarchive/tar/test/test_patterns_3.tar.uu (props changed) stable/8/contrib/libarchive/tar/test/test_patterns_4.tar.uu (props changed) Copied and modified: stable/8/contrib/libarchive/FREEBSD-Xlist (from r228762, head/contrib/libarchive/FREEBSD-Xlist) ============================================================================== --- head/contrib/libarchive/FREEBSD-Xlist Wed Dec 21 11:11:51 2011 (r228762, copy source) +++ stable/8/contrib/libarchive/FREEBSD-Xlist Thu Jan 5 12:07:42 2012 (r229593) @@ -13,9 +13,11 @@ cpio/test/CMakeLists.txt doc examples libarchive/CMakeLists.txt +libarchive/archive_entry_copy_bhfi.c libarchive/archive_windows.c libarchive/archive_windows.h libarchive/filter_fork_windows.c +libarchive/mtree.5 libarchive/test/.cvsignore libarchive/test/CMakeLists.txt tar/CMakeLists.txt Copied and modified: stable/8/contrib/libarchive/FREEBSD-upgrade (from r228762, head/contrib/libarchive/FREEBSD-upgrade) ============================================================================== --- head/contrib/libarchive/FREEBSD-upgrade Wed Dec 21 11:11:51 2011 (r228762, copy source) +++ stable/8/contrib/libarchive/FREEBSD-upgrade Thu Jan 5 12:07:42 2012 (r229593) @@ -17,7 +17,7 @@ at FreeBSD wiki: http://wiki.freebsd.org/SubversionPrimer/VendorImports -To make local changes to xz, simply patch and commit to the trunk +To make local changes to libarchive, simply patch and commit to the trunk branch (aka HEAD). Never make local changes on the vendor branch. mm@FreeBSD.org Modified: stable/8/contrib/libarchive/cpio/bsdcpio.1 ============================================================================== --- head/contrib/libarchive/cpio/bsdcpio.1 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/bsdcpio.1 Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2007 +.Dd September 5, 2010 .Dt BSDCPIO 1 .Os .Sh NAME @@ -140,7 +140,7 @@ The POSIX.1 tar format. The default format is .Ar odc . See -.Xr libarchive_formats 5 +.Xr libarchive-formats 5 for more complete information about the formats currently supported by the underlying .Xr libarchive 3 @@ -295,7 +295,7 @@ for more information. .Sh EXAMPLES The .Nm -command is traditionally used to copy file heirarchies in conjunction +command is traditionally used to copy file hierarchies in conjunction with the .Xr find 1 command. Modified: stable/8/contrib/libarchive/cpio/cmdline.c ============================================================================== --- head/contrib/libarchive/cpio/cmdline.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cmdline.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -285,6 +285,8 @@ cpio_getopt(struct cpio *cpio) * A period can be used instead of the colon. * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. + * TODO: If the spec uses uname/gname, then return those to the caller + * as well. If the spec provides uid/gid, just return names as NULL. * * Returns NULL if no error, otherwise returns error string for display. * Modified: stable/8/contrib/libarchive/cpio/config_freebsd.h ============================================================================== --- head/contrib/libarchive/cpio/config_freebsd.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/config_freebsd.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/config_freebsd.h,v 1.3 2008/12/06 07:30:40 kientzle Exp $ + * $FreeBSD$ */ /* A hand-tooled configuration for FreeBSD. */ Modified: stable/8/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cpio.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -273,15 +273,21 @@ main(int argc, char *argv[]) cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ + /* TODO: owner_parse should return uname/gname + * also; use that to set [ug]name_override. */ errmsg = owner_parse(cpio->optarg, &uid, &gid); if (errmsg) { lafe_warnc(-1, "%s", errmsg); usage(); } - if (uid != -1) + if (uid != -1) { cpio->uid_override = uid; - if (gid != -1) + cpio->uname_override = NULL; + } + if (gid != -1) { cpio->gid_override = gid; + cpio->gname_override = NULL; + } break; case 'r': /* POSIX 1997 */ cpio->option_rename = 1; @@ -575,10 +581,14 @@ file_to_archive(struct cpio *cpio, const return (r); } - if (cpio->uid_override >= 0) + if (cpio->uid_override >= 0) { archive_entry_set_uid(entry, cpio->uid_override); - if (cpio->gid_override >= 0) + archive_entry_set_uname(entry, cpio->uname_override); + } + if (cpio->gid_override >= 0) { archive_entry_set_gid(entry, cpio->gid_override); + archive_entry_set_gname(entry, cpio->gname_override); + } /* * Generate a destination path for this entry. Modified: stable/8/contrib/libarchive/cpio/cpio.h ============================================================================== --- head/contrib/libarchive/cpio/cpio.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cpio.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.7 2008/12/06 07:30:40 kientzle Exp $ + * $FreeBSD$ */ #ifndef CPIO_H_INCLUDED @@ -68,7 +68,9 @@ struct cpio { size_t pass_destpath_alloc; char *pass_destpath; int uid_override; + char *uname_override; int gid_override; + char *gname_override; int day_first; /* true if locale prefers day/mon */ /* If >= 0, then close this when done. */ Modified: stable/8/contrib/libarchive/cpio/cpio_platform.h ============================================================================== --- head/contrib/libarchive/cpio/cpio_platform.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cpio_platform.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/cpio_platform.h,v 1.2 2008/12/06 07:15:42 kientzle Exp $ + * $FreeBSD$ */ /* Modified: stable/8/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/main.c Thu Jan 5 12:07:42 2012 (r229593) @@ -36,7 +36,7 @@ * TODO: Move this into a separate configuration header, have all test * suites share one copy of this file. */ -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #define KNOWNREF "test_option_f.cpio.uu" #define ENVBASE "BSDCPIO" /* Prefix for environment variables. */ #define PROGRAM "bsdcpio" /* Name of program being tested. */ Modified: stable/8/contrib/libarchive/cpio/test/test.h ============================================================================== --- head/contrib/libarchive/cpio/test/test.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/test/test.h,v 1.2 2008/06/21 02:17:18 kientzle Exp $ + * $FreeBSD$ */ /* Every test program should #include "test.h" as the first thing. */ Modified: stable/8/contrib/libarchive/cpio/test/test_basic.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_basic.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_basic.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_basic.c,v 1.4 2008/08/25 06:39:29 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static void verify_files(const char *msg) Modified: stable/8/contrib/libarchive/cpio/test/test_format_newc.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_format_newc.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_format_newc.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_format_newc.c,v 1.2 2008/08/22 02:09:10 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* Number of bytes needed to pad 'n' to multiple of 'block', assuming * that 'block' is a power of two. This trick can be more easily Modified: stable/8/contrib/libarchive/cpio/test/test_gcpio_compat.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_gcpio_compat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_gcpio_compat.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_gcpio_compat.c,v 1.2 2008/08/22 02:27:06 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static void unpack_test(const char *from, const char *options, const char *se) Modified: stable/8/contrib/libarchive/cpio/test/test_option_L_upper.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_L_upper.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_L_upper.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_L.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* This is a little pointless, as Windows doesn't support symlinks * (except for the seriously crippled CreateSymbolicLink API) so these Modified: stable/8/contrib/libarchive/cpio/test/test_option_a.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_a.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_a.c Thu Jan 5 12:07:42 2012 (r229593) @@ -28,7 +28,7 @@ #elif defined(HAVE_SYS_UTIME_H) #include #endif -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_a.c,v 1.3 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static struct { const char *name; Modified: stable/8/contrib/libarchive/cpio/test/test_option_tv.stdout.uu ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_tv.stdout.uu Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_tv.stdout.uu Thu Jan 5 12:07:42 2012 (r229593) @@ -1,4 +1,4 @@ -$FreeBSD: src/usr.bin/cpio/test/test_option_tv.stdout.uu,v 1.2 2008/11/29 20:22:02 kientzle Exp $ +$FreeBSD$ begin 644 test_option_tv.stdout M+7)W+7(M+7(M+2`@(#$@=&EM("`@("`@=&EM("`@("`@("`@("`@(#`@1&5C /(#,Q("`Q.38Y(&9I;&4* Modified: stable/8/contrib/libarchive/cpio/test/test_option_y.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_y.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_y.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_y.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); DEFINE_TEST(test_option_y) { Modified: stable/8/contrib/libarchive/cpio/test/test_passthrough_dotdot.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_passthrough_dotdot.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_passthrough_dotdot.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_dotdot.c,v 1.4 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* * Verify that "cpio -p .." works. Modified: stable/8/contrib/libarchive/cpio/test/test_passthrough_reverse.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_passthrough_reverse.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_passthrough_reverse.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_reverse.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* * As reported by Bernd Walter: Some people are in the habit of Modified: stable/8/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $ + * $FreeBSD$ */ #ifndef ARCHIVE_H_INCLUDED @@ -493,11 +493,10 @@ __LA_DECL void archive_read_extract_set /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ -/* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Erroneously declared to return void in libarchive 1.x */ -__LA_DECL void archive_read_finish(struct archive *); -#else +/* Note that archive_read_free will call archive_read_close for you. */ +__LA_DECL int archive_read_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_read_free() for backwards compatibility. */ __LA_DECL int archive_read_finish(struct archive *); #endif @@ -514,7 +513,7 @@ __LA_DECL int archive_read_finish(stru * - archive_write_header to write the header * - archive_write_data to write the entry data * 5) archive_write_close to close the output - * 6) archive_write_finish to cleanup the writer and release resources + * 6) archive_write_free to cleanup the writer and release resources */ __LA_DECL struct archive *archive_write_new(void); __LA_DECL int archive_write_set_bytes_per_block(struct archive *, @@ -595,13 +594,12 @@ __LA_DECL __LA_SSIZE_T archive_write_da #endif __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Return value was incorrect in libarchive 1.x. */ -__LA_DECL void archive_write_finish(struct archive *); -#else -/* Libarchive 2.x and later returns an error if this fails. */ -/* It can fail if the archive wasn't already closed, in which case - * archive_write_finish() will implicitly call archive_write_close(). */ + +/* This can fail if the archive wasn't already closed, in which case + * archive_write_free() will implicitly call archive_write_close(). */ +__LA_DECL int archive_write_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_write_free() for backwards compatibility. */ __LA_DECL int archive_write_finish(struct archive *); #endif @@ -630,7 +628,7 @@ __LA_DECL int archive_write_set_options * - construct an appropriate struct archive_entry structure * - archive_write_header to create the file/dir/etc on disk * - archive_write_data to write the entry data - * 4) archive_write_finish to cleanup the writer and release resources + * 4) archive_write_free to cleanup the writer and release resources * * In particular, you can use this in conjunction with archive_read() * to pull entries out of an archive and create them on disk. Modified: stable/8/contrib/libarchive/libarchive/archive_check_magic.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_check_magic.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_check_magic.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_check_magic.c 201089 2009-12-28 02:20:23Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_crc32.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_crc32.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_crc32.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_crc32.h 201102 2009-12-28 03:11:36Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_endian.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_endian.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_endian.h Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_endian.h 201085 2009-12-28 02:17:15Z kientzle $ + * $FreeBSD$ * * Borrowed from FreeBSD's */ Modified: stable/8/contrib/libarchive/libarchive/archive_entry.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry.3 Thu Jan 5 12:07:42 2012 (r229593) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $ +.\" $FreeBSD$ .\" .Dd May 12, 2008 -.Dt archive_entry 3 +.Dt ARCHIVE_ENTRY 3 .Os .Sh NAME .Nm archive_entry_acl_add_entry , Modified: stable/8/contrib/libarchive/libarchive/archive_entry.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $ + * $FreeBSD$ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED Modified: stable/8/contrib/libarchive/libarchive/archive_entry_copy_stat.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_copy_stat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_copy_stat.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_copy_stat.c 189466 2009-03-07 00:52:02Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_link_resolver.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_link_resolver.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_link_resolver.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_link_resolver.c 201100 2009-12-28 03:05:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_entry_stat.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_stat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_stat.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_stat.c 201100 2009-12-28 03:05:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_strmode.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_strmode.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_strmode.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.4 2008/06/15 05:14:01 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_xattr.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_xattr.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_xattr.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_xattr.c 201096 2009-12-28 02:41:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_hash.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_hash.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_hash.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_hash.h 201171 2009-12-29 06:39:07Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_platform.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_platform.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_platform.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_platform.h 201090 2009-12-28 02:22:04Z kientzle $ + * $FreeBSD$ */ /* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */ Modified: stable/8/contrib/libarchive/libarchive/archive_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_private.h 201098 2009-12-28 02:58:14Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD @@ -58,7 +58,7 @@ struct archive_vtable { int (*archive_close)(struct archive *); - int (*archive_finish)(struct archive *); + int (*archive_free)(struct archive *); int (*archive_write_header)(struct archive *, struct archive_entry *); int (*archive_write_finish_entry)(struct archive *); Modified: stable/8/contrib/libarchive/libarchive/archive_read.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read.3 Thu Jan 5 12:07:42 2012 (r229593) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $ +.\" $FreeBSD$ .\" .Dd April 13, 2009 -.Dt archive_read 3 +.Dt ARCHIVE_READ 3 .Os .Sh NAME .Nm archive_read_new , @@ -69,7 +69,7 @@ .Nm archive_read_extract2 , .Nm archive_read_extract_set_progress_callback , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading streaming archives .Sh SYNOPSIS .In archive.h @@ -196,7 +196,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for reading streaming archives. The general process is to first create the @@ -457,7 +457,7 @@ object and the archive_entry object so t can be retrieved for the progress display. .It Fn archive_read_close Complete the archive and invoke the close callback. -.It Fn archive_read_finish +.It Fn archive_read_free Invokes .Fn archive_read_close if it was not invoked manually, then release all resources. @@ -600,7 +600,7 @@ list_archive(const char *name) printf("%s\en",archive_entry_pathname(entry)); archive_read_data_skip(a); } - archive_read_finish(a); + archive_read_free(a); free(mydata); } Modified: stable/8/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read.c Thu Jan 5 12:07:42 2012 (r229593) @@ -32,7 +32,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read.c 201157 2009-12-29 05:30:23Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -60,7 +60,7 @@ static int choose_format(struct archive_ static int cleanup_filters(struct archive_read *); static struct archive_vtable *archive_read_vtable(void); static int _archive_read_close(struct archive *); -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static struct archive_vtable * archive_read_vtable(void) @@ -69,7 +69,7 @@ archive_read_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -779,7 +779,7 @@ cleanup_filters(struct archive_read *a) * Release memory and other resources. */ static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int i; @@ -787,7 +787,7 @@ _archive_read_finish(struct archive *_a) int r = ARCHIVE_OK; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY, - "archive_read_finish"); + "archive_read_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_read_close(&a->archive); Modified: stable/8/contrib/libarchive/libarchive/archive_read_data_into_fd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_data_into_fd.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_data_into_fd.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_fd.c,v 1.16 2008/05/23 05:01:29 cperciva Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk.3 Thu Jan 5 12:07:42 2012 (r229593) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/lib/libarchive/archive_read_disk.3 190957 2009-04-12 05:04:02Z kientzle $ +.\" $FreeBSD$ .\" .Dd March 10, 2009 -.Dt archive_read_disk 3 +.Dt ARCHIVE_READ_DISK 3 .Os .Sh NAME .Nm archive_read_disk_new , @@ -39,7 +39,7 @@ .Nm archive_read_disk_set_gname_lookup , .Nm archive_read_disk_set_standard_lookup , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading objects from disk .Sh SYNOPSIS .In archive.h @@ -81,7 +81,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide an API for reading information about objects on disk. @@ -178,9 +178,9 @@ This affects the file ownership fields a object. .It Fn archive_read_close This currently does nothing. -.It Fn archive_write_finish +.It Fn archive_read_free Invokes -.Fn archive_write_close +.Fn archive_read_close if it was not invoked manually, then releases all resources. .El More information about the @@ -213,7 +213,7 @@ file_to_archive(struct archive *a, const while ((bytes_read = read(fd, buff, sizeof(buff))) > 0) archive_write_data(a, buff, bytes_read); archive_write_finish_entry(a); - archive_read_finish(ard); + archive_read_free(ard); archive_entry_free(entry); } .Ed @@ -276,7 +276,7 @@ and first appeared in The .Nm libarchive library was written by -.An Tim Kientzle Aq kientzle@freebsd.org . +.An Tim Kientzle Aq kientzle@FreeBSD.org . .Sh BUGS The .Dq standard Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk.c Thu Jan 5 12:07:42 2012 (r229593) @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk.c 189429 2009-03-06 04:35:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" #include "archive_string.h" @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_disk_private.h" -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static const char *trivial_lookup_gname(void *, gid_t gid); static const char *trivial_lookup_uname(void *, uid_t uid); @@ -45,7 +45,7 @@ archive_read_disk_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -129,7 +129,7 @@ archive_read_disk_new(void) } static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_entry_from_file.c 201084 2009-12-28 02:14:09Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H /* Mac OSX requires sys/types.h before sys/acl.h. */ Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_read_disk_private.h 201105 2009-12-28 03:20:54Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_set_standard_lookup.c 201109 2009-12-28 03:30:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_extract.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_extract.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_extract.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include @@ -173,10 +173,7 @@ archive_read_extract_cleanup(struct arch { int ret = ARCHIVE_OK; -#if ARCHIVE_API_VERSION > 1 - ret = -#endif - archive_write_finish(a->extract->ad); + ret = archive_write_free(a->extract->ad); free(a->extract); a->extract = NULL; return (ret); Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_fd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_fd.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_fd.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_fd.c 201103 2009-12-28 03:13:49Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_file.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_file.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_file.c 201093 2009-12-28 02:28:44Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_filename.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_filename.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_filename.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_filename.c 201093 2009-12-28 02:28:44Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_memory.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_memory.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_memory.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_memory.c,v 1.6 2007/07/06 15:51:59 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #include #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_read_private.h 201088 2009-12-28 02:18:55Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_all.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_all.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_all.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_all.c 201248 2009-12-30 06:12:03Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 12:07:42 2012 (r229593) @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_bzip2.c 201108 2009-12-28 03:28:21Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_compress.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_compress.c Thu Jan 5 12:07:42 2012 (r229593) @@ -64,7 +64,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_compress.c 201094 2009-12-28 02:29:21Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c Thu Jan 5 12:07:42 2012 (r229593) @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_gzip.c 201082 2009-12-28 02:05:28Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_none.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_none.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_none.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_none.c 185679 2008-12-06 06:45:15Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_program.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_program.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_program.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_program.c 201112 2009-12-28 06:59:35Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_WAIT_H # include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_uu.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_uu.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_uu.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_uu.c 201248 2009-12-30 06:12:03Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_xz.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_xz.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_xz.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_xz.c 201167 2009-12-29 06:06:20Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_format_all.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_all.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_format_all.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_all.c 174991 2007-12-30 04:58:22Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_format_ar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_ar.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_format_ar.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_ar.c 201101 2009-12-28 03:06:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_cpio.c 201163 2009-12-29 05:50:34Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -42,6 +42,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_private.h" +#ifdef _MSC_VER +#define __packed +#pragma pack(push, 1) +#endif struct cpio_bin_header { unsigned char c_magic[2]; unsigned char c_dev[2]; @@ -54,7 +58,7 @@ struct cpio_bin_header { unsigned char c_mtime[4]; unsigned char c_namesize[2]; unsigned char c_filesize[4]; -}; +} __packed; struct cpio_odc_header { char c_magic[6]; @@ -68,7 +72,7 @@ struct cpio_odc_header { char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; -}; +} __packed; struct cpio_newc_header { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 12:57:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5DDC106566C; Thu, 5 Jan 2012 12:57:15 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B6238FC0A; Thu, 5 Jan 2012 12:57:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05CvFUm036511; Thu, 5 Jan 2012 12:57:15 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05CvFwU036504; Thu, 5 Jan 2012 12:57:15 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051257.q05CvFwU036504@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 12:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229596 - in stable/8: lib/libarchive lib/libarchive/libarchive_fe lib/libarchive/test usr.bin/cpio usr.bin/cpio/test usr.bin/tar usr.bin/tar/test X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 12:57:15 -0000 Author: mm Date: Thu Jan 5 12:57:14 2012 New Revision: 229596 URL: http://svn.freebsd.org/changeset/base/229596 Log: MFC r228797: Use contrib sources for building libarchive, tar and cpio. Make "make test" fully operational. Deleted: stable/8/lib/libarchive/COPYING stable/8/lib/libarchive/README stable/8/lib/libarchive/archive.h stable/8/lib/libarchive/archive_check_magic.c stable/8/lib/libarchive/archive_crc32.h stable/8/lib/libarchive/archive_endian.h stable/8/lib/libarchive/archive_entry.3 stable/8/lib/libarchive/archive_entry.c stable/8/lib/libarchive/archive_entry.h stable/8/lib/libarchive/archive_entry_copy_stat.c stable/8/lib/libarchive/archive_entry_link_resolver.c stable/8/lib/libarchive/archive_entry_private.h stable/8/lib/libarchive/archive_entry_stat.c stable/8/lib/libarchive/archive_entry_strmode.c stable/8/lib/libarchive/archive_entry_xattr.c stable/8/lib/libarchive/archive_hash.h stable/8/lib/libarchive/archive_platform.h stable/8/lib/libarchive/archive_private.h stable/8/lib/libarchive/archive_read.3 stable/8/lib/libarchive/archive_read.c stable/8/lib/libarchive/archive_read_data_into_fd.c stable/8/lib/libarchive/archive_read_disk.3 stable/8/lib/libarchive/archive_read_disk.c stable/8/lib/libarchive/archive_read_disk_entry_from_file.c stable/8/lib/libarchive/archive_read_disk_private.h stable/8/lib/libarchive/archive_read_disk_set_standard_lookup.c stable/8/lib/libarchive/archive_read_extract.c stable/8/lib/libarchive/archive_read_open_fd.c stable/8/lib/libarchive/archive_read_open_file.c stable/8/lib/libarchive/archive_read_open_filename.c stable/8/lib/libarchive/archive_read_open_memory.c stable/8/lib/libarchive/archive_read_private.h stable/8/lib/libarchive/archive_read_support_compression_all.c stable/8/lib/libarchive/archive_read_support_compression_bzip2.c stable/8/lib/libarchive/archive_read_support_compression_compress.c stable/8/lib/libarchive/archive_read_support_compression_gzip.c stable/8/lib/libarchive/archive_read_support_compression_none.c stable/8/lib/libarchive/archive_read_support_compression_program.c stable/8/lib/libarchive/archive_read_support_compression_rpm.c stable/8/lib/libarchive/archive_read_support_compression_uu.c stable/8/lib/libarchive/archive_read_support_compression_xz.c stable/8/lib/libarchive/archive_read_support_format_all.c stable/8/lib/libarchive/archive_read_support_format_ar.c stable/8/lib/libarchive/archive_read_support_format_cpio.c stable/8/lib/libarchive/archive_read_support_format_empty.c stable/8/lib/libarchive/archive_read_support_format_iso9660.c stable/8/lib/libarchive/archive_read_support_format_mtree.c stable/8/lib/libarchive/archive_read_support_format_raw.c stable/8/lib/libarchive/archive_read_support_format_tar.c stable/8/lib/libarchive/archive_read_support_format_xar.c stable/8/lib/libarchive/archive_read_support_format_zip.c stable/8/lib/libarchive/archive_string.c stable/8/lib/libarchive/archive_string.h stable/8/lib/libarchive/archive_string_sprintf.c stable/8/lib/libarchive/archive_util.3 stable/8/lib/libarchive/archive_util.c stable/8/lib/libarchive/archive_virtual.c stable/8/lib/libarchive/archive_write.3 stable/8/lib/libarchive/archive_write.c stable/8/lib/libarchive/archive_write_disk.3 stable/8/lib/libarchive/archive_write_disk.c stable/8/lib/libarchive/archive_write_disk_private.h stable/8/lib/libarchive/archive_write_disk_set_standard_lookup.c stable/8/lib/libarchive/archive_write_open_fd.c stable/8/lib/libarchive/archive_write_open_file.c stable/8/lib/libarchive/archive_write_open_filename.c stable/8/lib/libarchive/archive_write_open_memory.c stable/8/lib/libarchive/archive_write_private.h stable/8/lib/libarchive/archive_write_set_compression_bzip2.c stable/8/lib/libarchive/archive_write_set_compression_compress.c stable/8/lib/libarchive/archive_write_set_compression_gzip.c stable/8/lib/libarchive/archive_write_set_compression_none.c stable/8/lib/libarchive/archive_write_set_compression_program.c stable/8/lib/libarchive/archive_write_set_compression_xz.c stable/8/lib/libarchive/archive_write_set_format.c stable/8/lib/libarchive/archive_write_set_format_ar.c stable/8/lib/libarchive/archive_write_set_format_by_name.c stable/8/lib/libarchive/archive_write_set_format_cpio.c stable/8/lib/libarchive/archive_write_set_format_cpio_newc.c stable/8/lib/libarchive/archive_write_set_format_mtree.c stable/8/lib/libarchive/archive_write_set_format_pax.c stable/8/lib/libarchive/archive_write_set_format_shar.c stable/8/lib/libarchive/archive_write_set_format_ustar.c stable/8/lib/libarchive/archive_write_set_format_zip.c stable/8/lib/libarchive/cpio.5 stable/8/lib/libarchive/filter_fork.c stable/8/lib/libarchive/filter_fork.h stable/8/lib/libarchive/libarchive-formats.5 stable/8/lib/libarchive/libarchive.3 stable/8/lib/libarchive/libarchive_fe/ stable/8/lib/libarchive/libarchive_internals.3 stable/8/lib/libarchive/tar.5 stable/8/lib/libarchive/test/.cvsignore stable/8/lib/libarchive/test/README stable/8/lib/libarchive/test/main.c stable/8/lib/libarchive/test/read_open_memory.c stable/8/lib/libarchive/test/test.h stable/8/lib/libarchive/test/test_acl_basic.c stable/8/lib/libarchive/test/test_acl_freebsd.c stable/8/lib/libarchive/test/test_acl_pax.c stable/8/lib/libarchive/test/test_archive_api_feature.c stable/8/lib/libarchive/test/test_bad_fd.c stable/8/lib/libarchive/test/test_compat_bzip2.c stable/8/lib/libarchive/test/test_compat_bzip2_1.tbz.uu stable/8/lib/libarchive/test/test_compat_bzip2_2.tbz.uu stable/8/lib/libarchive/test/test_compat_cpio.c stable/8/lib/libarchive/test/test_compat_cpio_1.cpio.uu stable/8/lib/libarchive/test/test_compat_gtar.c stable/8/lib/libarchive/test/test_compat_gtar_1.tar.uu stable/8/lib/libarchive/test/test_compat_gzip.c stable/8/lib/libarchive/test/test_compat_gzip_1.tgz.uu stable/8/lib/libarchive/test/test_compat_gzip_2.tgz.uu stable/8/lib/libarchive/test/test_compat_lzma.c stable/8/lib/libarchive/test/test_compat_lzma_1.tlz.uu stable/8/lib/libarchive/test/test_compat_lzma_2.tlz.uu stable/8/lib/libarchive/test/test_compat_lzma_3.tlz.uu stable/8/lib/libarchive/test/test_compat_solaris_tar_acl.c stable/8/lib/libarchive/test/test_compat_solaris_tar_acl.tar.uu stable/8/lib/libarchive/test/test_compat_tar_hardlink.c stable/8/lib/libarchive/test/test_compat_tar_hardlink_1.tar.uu stable/8/lib/libarchive/test/test_compat_xz.c stable/8/lib/libarchive/test/test_compat_xz_1.txz.uu stable/8/lib/libarchive/test/test_compat_zip.c stable/8/lib/libarchive/test/test_compat_zip_1.zip.uu stable/8/lib/libarchive/test/test_compat_zip_2.zip.uu stable/8/lib/libarchive/test/test_empty_write.c stable/8/lib/libarchive/test/test_entry.c stable/8/lib/libarchive/test/test_entry_strmode.c stable/8/lib/libarchive/test/test_extattr_freebsd.c stable/8/lib/libarchive/test/test_fuzz.c stable/8/lib/libarchive/test/test_fuzz_1.iso.Z.uu stable/8/lib/libarchive/test/test_link_resolver.c stable/8/lib/libarchive/test/test_open_failure.c stable/8/lib/libarchive/test/test_open_fd.c stable/8/lib/libarchive/test/test_open_file.c stable/8/lib/libarchive/test/test_open_filename.c stable/8/lib/libarchive/test/test_pax_filename_encoding.c stable/8/lib/libarchive/test/test_pax_filename_encoding.tar.uu stable/8/lib/libarchive/test/test_read_compress_program.c stable/8/lib/libarchive/test/test_read_data_large.c stable/8/lib/libarchive/test/test_read_disk.c stable/8/lib/libarchive/test/test_read_disk_entry_from_file.c stable/8/lib/libarchive/test/test_read_extract.c stable/8/lib/libarchive/test/test_read_file_nonexistent.c stable/8/lib/libarchive/test/test_read_format_ar.ar.uu stable/8/lib/libarchive/test/test_read_format_ar.c stable/8/lib/libarchive/test/test_read_format_cpio_bin.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_Z.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_be.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_be.cpio.uu stable/8/lib/libarchive/test/test_read_format_cpio_bin_bz2.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_gz.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_lzma.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_xz.c stable/8/lib/libarchive/test/test_read_format_cpio_odc.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu stable/8/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu stable/8/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c stable/8/lib/libarchive/test/test_read_format_empty.c stable/8/lib/libarchive/test/test_read_format_gtar_gz.c stable/8/lib/libarchive/test/test_read_format_gtar_lzma.c stable/8/lib/libarchive/test/test_read_format_gtar_sparse.c stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu stable/8/lib/libarchive/test/test_read_format_iso.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_Z.c stable/8/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_multi_extent.c stable/8/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_isojoliet_bz2.c stable/8/lib/libarchive/test/test_read_format_isojoliet_long.c stable/8/lib/libarchive/test/test_read_format_isojoliet_rr.c stable/8/lib/libarchive/test/test_read_format_isorr_bz2.c stable/8/lib/libarchive/test/test_read_format_isorr_ce.c stable/8/lib/libarchive/test/test_read_format_isorr_new_bz2.c stable/8/lib/libarchive/test/test_read_format_isorr_rr_moved.c stable/8/lib/libarchive/test/test_read_format_isozisofs_bz2.c stable/8/lib/libarchive/test/test_read_format_mtree.c stable/8/lib/libarchive/test/test_read_format_mtree.mtree.uu stable/8/lib/libarchive/test/test_read_format_pax_bz2.c stable/8/lib/libarchive/test/test_read_format_raw.c stable/8/lib/libarchive/test/test_read_format_raw.data.Z.uu stable/8/lib/libarchive/test/test_read_format_raw.data.uu stable/8/lib/libarchive/test/test_read_format_tar.c stable/8/lib/libarchive/test/test_read_format_tar_empty_filename.c stable/8/lib/libarchive/test/test_read_format_tar_empty_filename.tar.uu stable/8/lib/libarchive/test/test_read_format_tbz.c stable/8/lib/libarchive/test/test_read_format_tgz.c stable/8/lib/libarchive/test/test_read_format_tlz.c stable/8/lib/libarchive/test/test_read_format_txz.c stable/8/lib/libarchive/test/test_read_format_tz.c stable/8/lib/libarchive/test/test_read_format_xar.c stable/8/lib/libarchive/test/test_read_format_zip.c stable/8/lib/libarchive/test/test_read_format_zip.zip.uu stable/8/lib/libarchive/test/test_read_large.c stable/8/lib/libarchive/test/test_read_pax_truncated.c stable/8/lib/libarchive/test/test_read_position.c stable/8/lib/libarchive/test/test_read_truncated.c stable/8/lib/libarchive/test/test_read_uu.c stable/8/lib/libarchive/test/test_tar_filenames.c stable/8/lib/libarchive/test/test_tar_large.c stable/8/lib/libarchive/test/test_ustar_filenames.c stable/8/lib/libarchive/test/test_write_compress.c stable/8/lib/libarchive/test/test_write_compress_bzip2.c stable/8/lib/libarchive/test/test_write_compress_gzip.c stable/8/lib/libarchive/test/test_write_compress_lzma.c stable/8/lib/libarchive/test/test_write_compress_program.c stable/8/lib/libarchive/test/test_write_compress_xz.c stable/8/lib/libarchive/test/test_write_disk.c stable/8/lib/libarchive/test/test_write_disk_failures.c stable/8/lib/libarchive/test/test_write_disk_hardlink.c stable/8/lib/libarchive/test/test_write_disk_perms.c stable/8/lib/libarchive/test/test_write_disk_secure.c stable/8/lib/libarchive/test/test_write_disk_sparse.c stable/8/lib/libarchive/test/test_write_disk_symlink.c stable/8/lib/libarchive/test/test_write_disk_times.c stable/8/lib/libarchive/test/test_write_format_ar.c stable/8/lib/libarchive/test/test_write_format_cpio.c stable/8/lib/libarchive/test/test_write_format_cpio_empty.c stable/8/lib/libarchive/test/test_write_format_cpio_newc.c stable/8/lib/libarchive/test/test_write_format_cpio_odc.c stable/8/lib/libarchive/test/test_write_format_mtree.c stable/8/lib/libarchive/test/test_write_format_pax.c stable/8/lib/libarchive/test/test_write_format_shar_empty.c stable/8/lib/libarchive/test/test_write_format_tar.c stable/8/lib/libarchive/test/test_write_format_tar_empty.c stable/8/lib/libarchive/test/test_write_format_tar_ustar.c stable/8/lib/libarchive/test/test_write_format_zip.c stable/8/lib/libarchive/test/test_write_format_zip_empty.c stable/8/lib/libarchive/test/test_write_format_zip_no_compression.c stable/8/lib/libarchive/test/test_write_open_memory.c stable/8/usr.bin/cpio/bsdcpio.1 stable/8/usr.bin/cpio/cmdline.c stable/8/usr.bin/cpio/cpio.c stable/8/usr.bin/cpio/cpio.h stable/8/usr.bin/cpio/cpio_platform.h stable/8/usr.bin/cpio/test/main.c stable/8/usr.bin/cpio/test/test.h stable/8/usr.bin/cpio/test/test_0.c stable/8/usr.bin/cpio/test/test_basic.c stable/8/usr.bin/cpio/test/test_cmdline.c stable/8/usr.bin/cpio/test/test_format_newc.c stable/8/usr.bin/cpio/test/test_gcpio_compat.c stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.bin.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.crc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.newc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.ustar.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.bin.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.crc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.newc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu stable/8/usr.bin/cpio/test/test_option_B_upper.c stable/8/usr.bin/cpio/test/test_option_C_upper.c stable/8/usr.bin/cpio/test/test_option_J_upper.c stable/8/usr.bin/cpio/test/test_option_L_upper.c stable/8/usr.bin/cpio/test/test_option_Z_upper.c stable/8/usr.bin/cpio/test/test_option_a.c stable/8/usr.bin/cpio/test/test_option_c.c stable/8/usr.bin/cpio/test/test_option_d.c stable/8/usr.bin/cpio/test/test_option_f.c stable/8/usr.bin/cpio/test/test_option_f.cpio.uu stable/8/usr.bin/cpio/test/test_option_help.c stable/8/usr.bin/cpio/test/test_option_l.c stable/8/usr.bin/cpio/test/test_option_lzma.c stable/8/usr.bin/cpio/test/test_option_m.c stable/8/usr.bin/cpio/test/test_option_m.cpio.uu stable/8/usr.bin/cpio/test/test_option_t.c stable/8/usr.bin/cpio/test/test_option_t.cpio.uu stable/8/usr.bin/cpio/test/test_option_t.stdout.uu stable/8/usr.bin/cpio/test/test_option_tv.stdout.uu stable/8/usr.bin/cpio/test/test_option_u.c stable/8/usr.bin/cpio/test/test_option_version.c stable/8/usr.bin/cpio/test/test_option_y.c stable/8/usr.bin/cpio/test/test_option_z.c stable/8/usr.bin/cpio/test/test_owner_parse.c stable/8/usr.bin/cpio/test/test_passthrough_dotdot.c stable/8/usr.bin/cpio/test/test_passthrough_reverse.c stable/8/usr.bin/cpio/test/test_pathmatch.c stable/8/usr.bin/tar/COPYING stable/8/usr.bin/tar/bsdtar.1 stable/8/usr.bin/tar/bsdtar.c stable/8/usr.bin/tar/bsdtar.h stable/8/usr.bin/tar/bsdtar_platform.h stable/8/usr.bin/tar/cmdline.c stable/8/usr.bin/tar/getdate.c stable/8/usr.bin/tar/read.c stable/8/usr.bin/tar/subst.c stable/8/usr.bin/tar/test/main.c stable/8/usr.bin/tar/test/test.h stable/8/usr.bin/tar/test/test_0.c stable/8/usr.bin/tar/test/test_basic.c stable/8/usr.bin/tar/test/test_copy.c stable/8/usr.bin/tar/test/test_empty_mtree.c stable/8/usr.bin/tar/test/test_getdate.c stable/8/usr.bin/tar/test/test_help.c stable/8/usr.bin/tar/test/test_option_T_upper.c stable/8/usr.bin/tar/test/test_option_q.c stable/8/usr.bin/tar/test/test_option_r.c stable/8/usr.bin/tar/test/test_option_s.c stable/8/usr.bin/tar/test/test_patterns.c stable/8/usr.bin/tar/test/test_patterns_2.tar.uu stable/8/usr.bin/tar/test/test_patterns_3.tar.uu stable/8/usr.bin/tar/test/test_patterns_4.tar.uu stable/8/usr.bin/tar/test/test_stdio.c stable/8/usr.bin/tar/test/test_strip_components.c stable/8/usr.bin/tar/test/test_symlink_dir.c stable/8/usr.bin/tar/test/test_version.c stable/8/usr.bin/tar/tree.c stable/8/usr.bin/tar/tree.h stable/8/usr.bin/tar/util.c stable/8/usr.bin/tar/write.c Modified: stable/8/lib/libarchive/Makefile stable/8/lib/libarchive/test/Makefile stable/8/usr.bin/cpio/Makefile stable/8/usr.bin/cpio/test/Makefile stable/8/usr.bin/tar/Makefile stable/8/usr.bin/tar/test/Makefile Directory Properties: stable/8/lib/libarchive/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/tar/ (props changed) Modified: stable/8/lib/libarchive/Makefile ============================================================================== --- stable/8/lib/libarchive/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/lib/libarchive/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,6 +1,8 @@ # $FreeBSD$ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + LIB= archive DPADD= ${LIBZ} LDADD= -lz @@ -20,7 +22,7 @@ LDADD+= -lbsdxml # It has no real relation to the libarchive version number. SHLIB_MAJOR= 5 -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" CFLAGS+= -I${.OBJDIR} .if ${MK_OPENSSL} != "no" @@ -32,7 +34,7 @@ DPADD+= ${LIBMD} LDADD+= -lmd .endif -WARNS?= 6 +.PATH: ${LIBARCHIVEDIR}/libarchive # Headers to be installed in /usr/include INCS= archive.h archive_entry.h @@ -275,8 +277,11 @@ MLINKS+= archive_write_disk.3 archive_wr MLINKS+= archive_write_disk.3 archive_write_disk_set_user_lookup.3 MLINKS+= libarchive.3 archive.3 -.PHONY: check test +.PHONY: check test clean-test check test: - cd ${.CURDIR}/test && make test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/8/lib/libarchive/test/Makefile ============================================================================== --- stable/8/lib/libarchive/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/lib/libarchive/test/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,8 +1,23 @@ # $FreeBSD$ -# Where to find the libarchive sources -LA_SRCDIR=${.CURDIR}/.. +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive +NO_MAN=yes + +PROG=libarchive_test +INTERNALPROG=yes # Don't install this; it's just for testing +DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} +LDADD= -L ${.OBJDIR}/.. -larchive +LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml +CFLAGS+= -g +CFLAGS+= -I${.CURDIR}/.. -I${LIBARCHIVEDIR} -I${.OBJDIR} +CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 + +# Uncomment to link against dmalloc +#LDADD+= -L/usr/local/lib -ldmalloc +#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC + +.PATH: ${LIBARCHIVEDIR}/libarchive/test TESTS= \ test_acl_basic.c \ test_acl_freebsd.c \ @@ -120,28 +135,14 @@ SRCS= \ main.c \ read_open_memory.c -NO_MAN=yes - -PROG=libarchive_test -INTERNALPROG=yes # Don't install this; it's just for testing -DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} -LDADD= -L ${.OBJDIR}/.. -larchive -LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml -CFLAGS+= -g -CFLAGS+= -I${LA_SRCDIR} -I. -CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 - -# Uncomment to link against dmalloc -#LDADD+= -L/usr/local/lib -ldmalloc -#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC - # Build libarchive_test and run it. check test: libarchive_test - ./libarchive_test -r ${.CURDIR} + ./libarchive_test -r ${LIBARCHIVEDIR}/libarchive/test # list.h is just a list of all tests, as indicated by DEFINE_TEST macro lines list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat test_*.c) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/libarchive/test; cat test_*.c) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h CLEANFILES += *.out *.o *.core *~ list.h .dirstamp .depend CLEANDIRS += .deps .libs Modified: stable/8/usr.bin/cpio/Makefile ============================================================================== --- stable/8/usr.bin/cpio/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/cpio/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -2,19 +2,22 @@ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + PROG= bsdcpio BSDCPIO_VERSION_STRING=2.8.5 +.PATH: ${LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c -.PATH: ${.CURDIR}/../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe SRCS+= err.c line_reader.c matching.c pathmatch.c WARNS?= 6 DPADD= ${LIBARCHIVE} ${LIBZ} ${LIBBZ2} CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\" -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive/libarchive_fe +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" +CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe .ifdef RELEASE_CRUNCH # FreeBSD's installer uses cpio in crunched binaries that are @@ -34,9 +37,12 @@ LDADD+= -lmd SYMLINKS=bsdcpio ${BINDIR}/cpio MLINKS= bsdcpio.1 cpio.1 -.PHONY: check test +.PHONY: check test clean-test check test: $(PROG) bsdcpio.1.gz - cd ${.CURDIR}/test && make clean test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/8/usr.bin/cpio/test/Makefile ============================================================================== --- stable/8/usr.bin/cpio/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/cpio/test/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,14 +1,14 @@ # $FreeBSD$ -# Where to find the cpio sources (for the internal unit tests) -CPIO_SRCDIR=${.CURDIR}/.. +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive -.PATH: ${CPIO_SRCDIR} +.PATH: ${LIBARCHIVEDIR}/cpio CPIO_SRCS= cmdline.c -.PATH: ${.CURDIR}/../../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe CPIO_SRCS+= err.c pathmatch.c +.PATH: ${LIBARCHIVEDIR}/cpio/test TESTS= \ test_0.c \ test_basic.c \ @@ -49,14 +49,13 @@ NO_MAN=yes PROG=bsdcpio_test DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I.. +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\" +CFLAGS+= -I${.CURDIR}/.. LDADD= -larchive -lz -lbz2 #CFLAGS+= -static -g -O2 -Wall CFLAGS+= -g -O2 -Wall CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${CPIO_SRCDIR} -CFLAGS+= -I${.CURDIR}/../../../lib/libarchive/libarchive_fe +CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc @@ -64,15 +63,17 @@ CFLAGS+= -I${.CURDIR}/../../../lib/libar WARNS=6 check test: bsdcpio_test - ${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio -r ${.CURDIR} + ${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio \ + -r ${LIBARCHIVEDIR}/cpio/test ${.OBJDIR}/list.h list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/cpio/test; cat ${TESTS}) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h clean: rm -f ${CLEANFILES} rm -f *~ -chmod -R +w /tmp/bsdcpio_test.* - rm -rf /tmp/bsdcpio_test.* + rm -rf /tmp/bsdcpio_test .include Modified: stable/8/usr.bin/tar/Makefile ============================================================================== --- stable/8/usr.bin/tar/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/tar/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,8 +1,12 @@ # $FreeBSD$ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + PROG= bsdtar BSDTAR_VERSION_STRING=2.8.5 + +.PATH: ${LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ cmdline.c \ getdate.c \ @@ -12,7 +16,7 @@ SRCS= bsdtar.c \ util.c \ write.c -.PATH: ${.CURDIR}/../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe SRCS+= err.c \ line_reader.c \ matching.c \ @@ -30,15 +34,18 @@ LDADD+= -lmd .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive -CFLAGS+= -I${.CURDIR}/../../lib/libarchive/libarchive_fe +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" +CFLAGS+= -I${LIBARCHIVEDIR}/tar -I${LIBARCHIVEDIR}/libarchive +CFLAGS+= -I${LIBARCHIVEDIR}/libarchive_fe SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 DEBUG_FLAGS=-g -.PHONY: check test +.PHONY: check test clean-test check test: $(PROG) bsdtar.1.gz - cd ${.CURDIR}/test && make test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/8/usr.bin/tar/test/Makefile ============================================================================== --- stable/8/usr.bin/tar/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/tar/test/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,13 +1,13 @@ # $FreeBSD$ -# Where to find the tar sources (for the internal unit tests) -TAR_SRCDIR=${.CURDIR}/.. -.PATH: ${TAR_SRCDIR} +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive +.PATH: ${LIBARCHIVEDIR}/tar # Some tar sources are pulled in for white-box tests -TAR_SRCS= \ +TAR_SRCS= \ getdate.c +.PATH: ${LIBARCHIVEDIR}/tar/test TESTS= \ test_0.c \ test_basic.c \ @@ -26,7 +26,7 @@ TESTS= \ test_version.c # Build the test program -SRCS= ${TAR_SRCS} \ +SRCS= ${TAR_SRCS} \ ${TESTS} \ list.h \ main.c @@ -37,24 +37,25 @@ NO_MAN=yes PROG=bsdtar_test DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I.. +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\" LDADD= -larchive -lz -lbz2 CFLAGS+= -static -g -O2 -Wall -CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${TAR_SRCDIR} +CFLAGS+= -I${.CURDIR}/.. -I${.OBJDIR} +CFLAGS+= -I${LIBARCHIVEDIR}/tar # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC check test: bsdtar_test - ./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${.CURDIR} + ./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${LIBARCHIVEDIR}/tar/test list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/tar/test; cat ${TESTS}) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h clean: + rm -f ${CLEANFILES} rm -f *.out rm -f *.o rm -f *.core From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 17:20:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04DAD106564A; Thu, 5 Jan 2012 17:20:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDBAE8FC13; Thu, 5 Jan 2012 17:20:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05HK3Jp046155; Thu, 5 Jan 2012 17:20:03 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HK34b046154; Thu, 5 Jan 2012 17:20:03 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201051720.q05HK34b046154@svn.freebsd.org> From: Rick Macklem Date: Thu, 5 Jan 2012 17:20:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229603 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 17:20:04 -0000 Author: rmacklem Date: Thu Jan 5 17:20:03 2012 New Revision: 229603 URL: http://svn.freebsd.org/changeset/base/229603 Log: MFC: r227744 Since the nfscl_cleanup() function isn't used by the FreeBSD NFSv4 client, delete the code and fix up the related comments. This should not have any functional effect on the client. Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 17:14:13 2012 (r229602) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 17:20:03 2012 (r229603) @@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$"); * the granularity of the OpenOwner, then code must be added to * serialize Ops on the OpenOwner.) * - When to get rid of OpenOwners and LockOwners. - * - When a process exits, it calls nfscl_cleanup(), which goes - * through the client list looking for all Open and Lock Owners. + * - The function nfscl_cleanup_common() is executed after a process exits. + * It goes through the client list looking for all Open and Lock Owners. * When one is found, it is marked "defunct" or in the case of * an OpenOwner without any Opens, freed. * The renew thread scans for defunct Owners and gets rid of them, @@ -1630,33 +1630,9 @@ nfscl_expireclient(struct nfsclclient *c } } -#ifndef __FreeBSD__ /* - * Called from exit() upon process termination. - */ -APPLESTATIC void -nfscl_cleanup(NFSPROC_T *p) -{ - struct nfsclclient *clp; - u_int8_t own[NFSV4CL_LOCKNAMELEN]; - - if (!nfscl_inited) - return; - nfscl_filllockowner(p->td_proc, own, F_POSIX); - - NFSLOCKCLSTATE(); - /* - * Loop through all the clientids, looking for the OpenOwners. - */ - LIST_FOREACH(clp, &nfsclhead, nfsc_list) - nfscl_cleanup_common(clp, own); - NFSUNLOCKCLSTATE(); -} -#endif /* !__FreeBSD__ */ - -/* - * Common code used by nfscl_cleanup() and nfscl_cleanupkext(). - * Must be called with CLSTATE lock held. + * This function must be called after the process represented by "own" has + * exited. Must be called with CLSTATE lock held. */ static void nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) @@ -1707,9 +1683,7 @@ nfscl_cleanup_common(struct nfsclclient #if defined(APPLEKEXT) || defined(__FreeBSD__) /* - * Simulate the call nfscl_cleanup() by looking for open owners associated - * with processes that no longer exist, since a call to nfscl_cleanup() - * can't be patched into exit(). + * Find open/lock owners for processes that have exited. */ static void nfscl_cleanupkext(struct nfsclclient *clp) @@ -2556,8 +2530,8 @@ tryagain: #if defined(APPLEKEXT) || defined(__FreeBSD__) /* - * Simulate the calls to nfscl_cleanup() when a process - * exits, since the call can't be patched into exit(). + * Call nfscl_cleanupkext() once per second to check for + * open/lock owners where the process has exited. */ { struct timespec mytime; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 18:22:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55989106566B; Thu, 5 Jan 2012 18:22:49 +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 38F4D8FC08; Thu, 5 Jan 2012 18:22:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05IMnsS048416; Thu, 5 Jan 2012 18:22:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IMnFF048413; Thu, 5 Jan 2012 18:22:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201051822.q05IMnFF048413@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 18:22:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229608 - stable/8/sys/dev/vr X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 18:22:49 -0000 Author: yongari Date: Thu Jan 5 18:22:48 2012 New Revision: 229608 URL: http://svn.freebsd.org/changeset/base/229608 Log: MFC r228084: Reuse flag variable to represent driver internal states rather than using member variables in softc. While I'm here change media after setting IFF_DRV_RUNNING. This will remove unnecessary link state handling in vr_tick() if controller established a link immediately. Modified: stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/vr/if_vrreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Thu Jan 5 18:21:17 2012 (r229607) +++ stable/8/sys/dev/vr/if_vr.c Thu Jan 5 18:22:48 2012 (r229608) @@ -309,20 +309,20 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_link = 0; + sc->vr_flags &= ~VR_F_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: case IFM_100_TX: - sc->vr_link = 1; + sc->vr_flags |= VR_F_LINK; break; default: break; } } - if (sc->vr_link != 0) { + if ((sc->vr_flags & VR_F_LINK) != 0) { cr0 = CSR_READ_1(sc, VR_CR0); cr1 = CSR_READ_1(sc, VR_CR1); mfdx = (cr1 & VR_CR1_FULLDUPLEX) != 0; @@ -825,7 +825,7 @@ vr_detach(device_t dev) /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { VR_LOCK(sc); - sc->vr_detach = 1; + sc->vr_flags |= VR_F_DETACHED; vr_stop(sc); VR_UNLOCK(sc); callout_drain(&sc->vr_stat_callout); @@ -1546,7 +1546,7 @@ vr_tick(void *xsc) mii = device_get_softc(sc->vr_miibus); mii_tick(mii); - if (sc->vr_link == 0) + if ((sc->vr_flags & VR_F_LINK) == 0) vr_miibus_statchg(sc->vr_dev); vr_watchdog(sc); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -1656,7 +1656,7 @@ vr_intr(void *arg) VR_LOCK(sc); - if (sc->vr_suspended != 0) + if ((sc->vr_flags & VR_F_SUSPENDED) != 0) goto done_locked; status = CSR_READ_2(sc, VR_ISR); @@ -1937,7 +1937,7 @@ vr_start_locked(struct ifnet *ifp) VR_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->vr_link == 0) + IFF_DRV_RUNNING || (sc->vr_flags & VR_F_LINK) == 0) return; for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && @@ -2107,12 +2107,12 @@ vr_init_locked(struct vr_softc *sc) if (sc->vr_revid > REV_ID_VT6102_A) CSR_WRITE_2(sc, VR_MII_IMR, 0); - sc->vr_link = 0; - mii_mediachg(mii); - ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->vr_flags &= ~VR_F_LINK; + mii_mediachg(mii); + callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); } @@ -2181,7 +2181,7 @@ vr_ioctl(struct ifnet *ifp, u_long comma (IFF_PROMISC | IFF_ALLMULTI)) vr_set_filter(sc); } else { - if (sc->vr_detach == 0) + if ((sc->vr_flags & VR_F_DETACHED) == 0) vr_init_locked(sc); } } else { @@ -2269,7 +2269,7 @@ vr_watchdog(struct vr_softc *sc) if (sc->vr_cdata.vr_tx_cnt == 0) return; - if (sc->vr_link == 0) { + if ((sc->vr_flags & VR_F_LINK) == 0) { if (bootverbose) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); @@ -2447,7 +2447,7 @@ vr_suspend(device_t dev) VR_LOCK(sc); vr_stop(sc); vr_setwol(sc); - sc->vr_suspended = 1; + sc->vr_flags |= VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); @@ -2468,7 +2468,7 @@ vr_resume(device_t dev) if (ifp->if_flags & IFF_UP) vr_init_locked(sc); - sc->vr_suspended = 0; + sc->vr_flags &= ~VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); Modified: stable/8/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 18:21:17 2012 (r229607) +++ stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 18:22:48 2012 (r229608) @@ -720,20 +720,20 @@ struct vr_softc { void *vr_intrhand; device_t vr_miibus; uint8_t vr_revid; /* Rhine chip revision */ - uint8_t vr_flags; /* See VR_F_* below */ -#define VR_F_RESTART 0x01 /* Restart unit on next tick */ + int vr_flags; /* See VR_F_* below */ +#define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_SUSPENDED 0x2000 +#define VR_F_DETACHED 0x4000 +#define VR_F_LINK 0x8000 int vr_if_flags; struct vr_chain_data vr_cdata; struct vr_ring_data vr_rdata; struct vr_statistics vr_stat; struct callout vr_stat_callout; struct mtx vr_mtx; - int vr_suspended; /* if 1, sleeping/detaching */ int vr_quirks; - int vr_link; int vr_watchdog_timer; int vr_txthresh; - int vr_detach; #ifdef DEVICE_POLLING int rxcycles; #endif From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 18:26:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBE2F106568E; Thu, 5 Jan 2012 18:26:44 +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 AF89B8FC27; Thu, 5 Jan 2012 18:26:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05IQixw048648; Thu, 5 Jan 2012 18:26:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IQiqL048643; Thu, 5 Jan 2012 18:26:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051826.q05IQiqL048643@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229610 - in stable/8: sbin/mount_nfs sys/fs/nfsclient sys/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 18:26:44 -0000 Author: jhb Date: Thu Jan 5 18:26:44 2012 New Revision: 229610 URL: http://svn.freebsd.org/changeset/base/229610 Log: MFC 227507: Finish making 'wcommitsize' an NFS client mount option. Modified: stable/8/sbin/mount_nfs/mount_nfs.8 stable/8/sbin/mount_nfs/mount_nfs.c stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/8/sbin/mount_nfs/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.8 Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sbin/mount_nfs/mount_nfs.8 Thu Jan 5 18:26:44 2012 (r229610) @@ -314,6 +314,10 @@ tune the timeout interval.) .It Cm udp Use UDP transport. +.It Cm wcommitsize Ns = Ns Aq Ar value +Set the maximum pending write commit size to the specified value. +This determines the maximum amount of pending write data that the NFS +client is willing to cache for each file. .It Cm wsize Ns = Ns Aq Ar value Set the write data size to the specified value. Ditto the comments w.r.t.\& the Modified: stable/8/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.c Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sbin/mount_nfs/mount_nfs.c Thu Jan 5 18:26:44 2012 (r229610) @@ -616,6 +616,13 @@ fallback_mount(struct iovec *iov, int io } args.flags |= NFSMNT_ACDIRMAX; } + if (findopt(iov, iovlen, "wcommitsize", &opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + errx(1, "illegal wcommitsize: %s", opt); + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 5 18:26:44 2012 (r229610) @@ -711,7 +711,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", "nocto", + "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -945,6 +945,15 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_ACDIRMAX; } + if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + vfs_mount_error(mp, "illegal wcommitsize: %s", opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.timeo); if (ret != 1 || args.timeo <= 0) { Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sys/nfsclient/nfs_vfsops.c Thu Jan 5 18:26:44 2012 (r229610) @@ -785,7 +785,7 @@ static const char *nfs_opts[] = { "from" "readahead", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", - "sec", "maxgroups", "principal", "negnametimeo", "nocto", + "sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -1017,6 +1017,15 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_ACDIRMAX; } + if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + vfs_mount_error(mp, "illegal wcommitsize: %s", opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (vfs_getopt(mp->mnt_optnew, "deadthresh", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 18:31:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCBA106566B; Thu, 5 Jan 2012 18:31: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 0AA378FC0C; Thu, 5 Jan 2012 18:31:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05IV8fT048907; Thu, 5 Jan 2012 18:31:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IV8MN048901; Thu, 5 Jan 2012 18:31:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051831.q05IV8MN048901@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229612 - stable/8/sys/dev/mfi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 18:31:09 -0000 Author: jhb Date: Thu Jan 5 18:31:08 2012 New Revision: 229612 URL: http://svn.freebsd.org/changeset/base/229612 Log: MFC 227562: Add single-message MSI support to mfi(4). It is disabled by default but can be enabled via the hw.mfi.msi tunable. Many mfi(4) controllers also support MSI-X, but in testing it seems that many adapters do not work with MSI-X but do work with MSI. Modified: stable/8/sys/dev/mfi/mfi.c stable/8/sys/dev/mfi/mfi_cam.c stable/8/sys/dev/mfi/mfi_disk.c stable/8/sys/dev/mfi/mfi_pci.c stable/8/sys/dev/mfi/mfivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi.c Thu Jan 5 18:31:08 2012 (r229612) @@ -484,15 +484,8 @@ mfi_attach(struct mfi_softc *sc) mtx_unlock(&sc->mfi_io_lock); /* - * Set up the interrupt handler. XXX This should happen in - * mfi_pci.c + * Set up the interrupt handler. */ - sc->mfi_irq_rid = 0; - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); - return (EINVAL); - } if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); Modified: stable/8/sys/dev/mfi/mfi_cam.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_cam.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi_cam.c Thu Jan 5 18:31:08 2012 (r229612) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/8/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_disk.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi_disk.c Thu Jan 5 18:31:08 2012 (r229612) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/8/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_pci.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi_pci.c Thu Jan 5 18:31:08 2012 (r229612) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -107,6 +108,11 @@ static devclass_t mfi_devclass; DRIVER_MODULE(mfi, pci, mfi_pci_driver, mfi_devclass, 0, 0); MODULE_VERSION(mfi, 1); +static int mfi_msi = 0; +TUNABLE_INT("hw.mfi.msi", &mfi_msi); +SYSCTL_INT(_hw_mfi, OID_AUTO, msi, CTLFLAG_RDTUN, &mfi_msi, 0, + "Enable use of MSI interrupts"); + struct mfi_ident { uint16_t vendor; uint16_t device; @@ -169,7 +175,7 @@ mfi_pci_attach(device_t dev) struct mfi_softc *sc; struct mfi_ident *m; uint32_t command; - int error; + int count, error; sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); @@ -226,6 +232,20 @@ mfi_pci_attach(device_t dev) goto out; } + /* Allocate IRQ resource. */ + sc->mfi_irq_rid = 0; + count = 1; + if (mfi_msi && pci_alloc_msi(sc->mfi_dev, &count) == 0) { + device_printf(sc->mfi_dev, "Using MSI\n"); + sc->mfi_irq_rid = 1; + } + if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, + &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); + error = EINVAL; + goto out; + } + error = mfi_attach(sc); out: if (error) { @@ -280,6 +300,8 @@ mfi_pci_free(struct mfi_softc *sc) bus_release_resource(sc->mfi_dev, SYS_RES_MEMORY, sc->mfi_regs_rid, sc->mfi_regs_resource); } + if (sc->mfi_irq_rid != 0) + pci_release_msi(sc->mfi_dev); return; } Modified: stable/8/sys/dev/mfi/mfivar.h ============================================================================== --- stable/8/sys/dev/mfi/mfivar.h Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfivar.h Thu Jan 5 18:31:08 2012 (r229612) @@ -378,6 +378,7 @@ mfi_print_sense(struct mfi_softc *sc, vo (sc)->mfi_bhandle, (reg)) MALLOC_DECLARE(M_MFIBUF); +SYSCTL_DECL(_hw_mfi); #define MFI_CMD_TIMEOUT 30 #define MFI_MAXPHYS (128 * 1024) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 18:38:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9275A1065690; Thu, 5 Jan 2012 18:38:24 +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 811A08FC14; Thu, 5 Jan 2012 18:38:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05IcODr049364; Thu, 5 Jan 2012 18:38:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IcOU1049362; Thu, 5 Jan 2012 18:38:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051838.q05IcOU1049362@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229616 - stable/8/sbin/sysctl X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 18:38:24 -0000 Author: jhb Date: Thu Jan 5 18:38:23 2012 New Revision: 229616 URL: http://svn.freebsd.org/changeset/base/229616 Log: MFC 228181: If the -d flag is specified, ignore any new values specified and only display the descriptions of specified nodes. Modified: stable/8/sbin/sysctl/sysctl.c Directory Properties: stable/8/sbin/sysctl/ (props changed) Modified: stable/8/sbin/sysctl/sysctl.c ============================================================================== --- stable/8/sbin/sysctl/sysctl.c Thu Jan 5 18:38:13 2012 (r229615) +++ stable/8/sbin/sysctl/sysctl.c Thu Jan 5 18:38:23 2012 (r229616) @@ -201,7 +201,7 @@ parse(char *string) if (oidfmt(mib, len, fmt, &kind)) err(1, "couldn't find format of oid '%s'", bufp); - if (newval == NULL) { + if (newval == NULL || dflag) { if ((kind & CTLTYPE) == CTLTYPE_NODE) { if (dflag) { i = show_var(mib, len); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 18:50:38 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D7531065675; Thu, 5 Jan 2012 18:50:38 +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 D66C98FC14; Thu, 5 Jan 2012 18:50:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05IobKk049844; Thu, 5 Jan 2012 18:50:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Iob3g049841; Thu, 5 Jan 2012 18:50:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051850.q05Iob3g049841@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229618 - in stable/8/sys: fs/nfsserver nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 18:50:38 -0000 Author: jhb Date: Thu Jan 5 18:50:37 2012 New Revision: 229618 URL: http://svn.freebsd.org/changeset/base/229618 Log: MFC 228185: Enhance the sequential access heuristic used to perform readahead in the NFS server and reuse it for writes as well to allow writes to the backing store to be clustered. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/nfsserver/nfs_serv.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 5 18:50:12 2012 (r229617) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 5 18:50:37 2012 (r229618) @@ -86,20 +86,78 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, issue_ SYSCTL_INT(_vfs_newnfs, OID_AUTO, enable_locallocks, CTLFLAG_RW, &nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on files"); -#define NUM_HEURISTIC 1017 +#define MAX_REORDERED_RPC 16 +#define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 static struct nfsheur { struct vnode *nh_vp; /* vp to match (unreferenced pointer) */ - off_t nh_nextr; /* next offset for sequential detection */ + off_t nh_nextoff; /* next offset for sequential detection */ int nh_use; /* use count for selection */ int nh_seqcount; /* heuristic */ } nfsheur[NUM_HEURISTIC]; /* + * Heuristic to detect sequential operation. + */ +static struct nfsheur * +nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp) +{ + struct nfsheur *nh; + int hi, try; + + /* Locate best candidate. */ + try = 32; + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; + nh = &nfsheur[hi]; + while (try--) { + if (nfsheur[hi].nh_vp == vp) { + nh = &nfsheur[hi]; + break; + } + if (nfsheur[hi].nh_use > 0) + --nfsheur[hi].nh_use; + hi = (hi + 1) % NUM_HEURISTIC; + if (nfsheur[hi].nh_use < nh->nh_use) + nh = &nfsheur[hi]; + } + + /* Initialize hint if this is a new file. */ + if (nh->nh_vp != vp) { + nh->nh_vp = vp; + nh->nh_nextoff = uio->uio_offset; + nh->nh_use = NHUSE_INIT; + if (uio->uio_offset == 0) + nh->nh_seqcount = 4; + else + nh->nh_seqcount = 1; + } + + /* Calculate heuristic. */ + if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) || + uio->uio_offset == nh->nh_nextoff) { + /* See comments in vfs_vnops.c:sequential_heuristic(). */ + nh->nh_seqcount += howmany(uio->uio_resid, 16384); + if (nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; + } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC * + imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) { + /* Probably a reordered RPC, leave seqcount alone. */ + } else if (nh->nh_seqcount > 1) { + nh->nh_seqcount /= 2; + } else { + nh->nh_seqcount = 0; + } + nh->nh_use += NHUSE_INC; + if (nh->nh_use > NHUSE_MAX) + nh->nh_use = NHUSE_MAX; + return (nh); +} + +/* * Get attributes into nfsvattr structure. */ int @@ -562,60 +620,11 @@ nfsvno_read(struct vnode *vp, off_t off, int i; struct iovec *iv; struct iovec *iv2; - int error = 0, len, left, siz, tlen, ioflag = 0, hi, try = 32; + int error = 0, len, left, siz, tlen, ioflag = 0; struct mbuf *m2 = NULL, *m3; struct uio io, *uiop = &io; struct nfsheur *nh; - /* - * Calculate seqcount for heuristic - */ - /* - * Locate best candidate - */ - - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; - nh = &nfsheur[hi]; - - while (try--) { - if (nfsheur[hi].nh_vp == vp) { - nh = &nfsheur[hi]; - break; - } - if (nfsheur[hi].nh_use > 0) - --nfsheur[hi].nh_use; - hi = (hi + 1) % NUM_HEURISTIC; - if (nfsheur[hi].nh_use < nh->nh_use) - nh = &nfsheur[hi]; - } - - if (nh->nh_vp != vp) { - nh->nh_vp = vp; - nh->nh_nextr = off; - nh->nh_use = NHUSE_INIT; - if (off == 0) - nh->nh_seqcount = 4; - else - nh->nh_seqcount = 1; - } - - /* - * Calculate heuristic - */ - - if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > IO_SEQMAX) - nh->nh_seqcount = IO_SEQMAX; - } else if (nh->nh_seqcount > 1) { - nh->nh_seqcount = 1; - } else { - nh->nh_seqcount = 0; - } - nh->nh_use += NHUSE_INC; - if (nh->nh_use > NHUSE_MAX) - nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << IO_SEQSHIFT; - len = left = NFSM_RNDUP(cnt); m3 = NULL; /* @@ -660,6 +669,8 @@ nfsvno_read(struct vnode *vp, off_t off, uiop->uio_resid = len; uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); FREE((caddr_t)iv2, M_TEMP); if (error) { @@ -667,6 +678,7 @@ nfsvno_read(struct vnode *vp, off_t off, *mpp = NULL; goto out; } + nh->nh_nextoff = uiop->uio_offset; tlen = len - uiop->uio_resid; cnt = cnt < tlen ? cnt : tlen; tlen = NFSM_RNDUP(cnt); @@ -695,6 +707,7 @@ nfsvno_write(struct vnode *vp, off_t off struct iovec *iv; int ioflags, error; struct uio io, *uiop = &io; + struct nfsheur *nh; MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, M_WAITOK); @@ -728,7 +741,11 @@ nfsvno_write(struct vnode *vp, off_t off uiop->uio_segflg = UIO_SYSSPACE; NFSUIOPROC(uiop, p); uiop->uio_offset = off; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflags |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_WRITE(vp, uiop, ioflags, cred); + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; FREE((caddr_t)iv, M_TEMP); NFSEXITCODE(error); Modified: stable/8/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/8/sys/nfsserver/nfs_serv.c Thu Jan 5 18:50:12 2012 (r229617) +++ stable/8/sys/nfsserver/nfs_serv.c Thu Jan 5 18:50:37 2012 (r229618) @@ -105,14 +105,15 @@ __FBSDID("$FreeBSD$"); #define MAX_COMMIT_COUNT (1024 * 1024) -#define NUM_HEURISTIC 1017 +#define MAX_REORDERED_RPC 16 +#define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 static struct nfsheur { struct vnode *nh_vp; /* vp to match (unreferenced pointer) */ - off_t nh_nextr; /* next offset for sequential detection */ + off_t nh_nextoff; /* next offset for sequential detection */ int nh_use; /* use count for selection */ int nh_seqcount; /* heuristic */ } nfsheur[NUM_HEURISTIC]; @@ -184,6 +185,63 @@ nfsrv_lockedpair_nd(int vfs1, struct nam } /* + * Heuristic to detect sequential operation. + */ +static struct nfsheur * +nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp) +{ + struct nfsheur *nh; + int hi, try; + + /* Locate best candidate. */ + try = 32; + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; + nh = &nfsheur[hi]; + while (try--) { + if (nfsheur[hi].nh_vp == vp) { + nh = &nfsheur[hi]; + break; + } + if (nfsheur[hi].nh_use > 0) + --nfsheur[hi].nh_use; + hi = (hi + 1) % NUM_HEURISTIC; + if (nfsheur[hi].nh_use < nh->nh_use) + nh = &nfsheur[hi]; + } + + /* Initialize hint if this is a new file. */ + if (nh->nh_vp != vp) { + nh->nh_vp = vp; + nh->nh_nextoff = uio->uio_offset; + nh->nh_use = NHUSE_INIT; + if (uio->uio_offset == 0) + nh->nh_seqcount = 4; + else + nh->nh_seqcount = 1; + } + + /* Calculate heuristic. */ + if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) || + uio->uio_offset == nh->nh_nextoff) { + /* See comments in vfs_vnops.c:sequential_heuristic(). */ + nh->nh_seqcount += howmany(uio->uio_resid, 16384); + if (nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; + } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC * + imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) { + /* Probably a reordered RPC, leave seqcount alone. */ + } else if (nh->nh_seqcount > 1) { + nh->nh_seqcount /= 2; + } else { + nh->nh_seqcount = 0; + } + nh->nh_use += NHUSE_INC; + if (nh->nh_use > NHUSE_MAX) + nh->nh_use = NHUSE_MAX; + return (nh); +} + +/* * nfs v3 access service */ int @@ -840,7 +898,6 @@ nfsrv_read(struct nfsrv_descript *nfsd, /* * Calculate byte count to read */ - if (off >= vap->va_size) cnt = 0; else if ((off + reqlen) > vap->va_size) @@ -848,61 +905,6 @@ nfsrv_read(struct nfsrv_descript *nfsd, else cnt = reqlen; - /* - * Calculate seqcount for heuristic - */ - - { - int hi; - int try = 32; - - /* - * Locate best candidate - */ - - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; - nh = &nfsheur[hi]; - - while (try--) { - if (nfsheur[hi].nh_vp == vp) { - nh = &nfsheur[hi]; - break; - } - if (nfsheur[hi].nh_use > 0) - --nfsheur[hi].nh_use; - hi = (hi + 1) % NUM_HEURISTIC; - if (nfsheur[hi].nh_use < nh->nh_use) - nh = &nfsheur[hi]; - } - - if (nh->nh_vp != vp) { - nh->nh_vp = vp; - nh->nh_nextr = off; - nh->nh_use = NHUSE_INIT; - if (off == 0) - nh->nh_seqcount = 4; - else - nh->nh_seqcount = 1; - } - - /* - * Calculate heuristic - */ - - if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > IO_SEQMAX) - nh->nh_seqcount = IO_SEQMAX; - } else if (nh->nh_seqcount > 1) { - nh->nh_seqcount = 1; - } else { - nh->nh_seqcount = 0; - } - nh->nh_use += NHUSE_INC; - if (nh->nh_use > NHUSE_MAX) - nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << IO_SEQSHIFT; - } - nfsm_reply(NFSX_POSTOPORFATTR(v3) + 3 * NFSX_UNSIGNED+nfsm_rndup(cnt)); if (v3) { tl = nfsm_build(u_int32_t *, NFSX_V3FATTR + 4 * NFSX_UNSIGNED); @@ -960,9 +962,11 @@ nfsrv_read(struct nfsrv_descript *nfsd, uiop->uio_resid = len; uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); - off = uiop->uio_offset; - nh->nh_nextr = off; + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; free((caddr_t)iv2, M_TEMP); if (error || (getret = VOP_GETATTR(vp, vap, cred))) { if (!error) @@ -1027,6 +1031,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, int v3 = (nfsd->nd_flag & ND_NFSV3); struct mbuf *mb, *mreq; struct vnode *vp = NULL; + struct nfsheur *nh; nfsfh_t nfh; fhandle_t *fhp; struct uio io, *uiop = &io; @@ -1167,7 +1172,11 @@ nfsrv_write(struct nfsrv_descript *nfsd, uiop->uio_segflg = UIO_SYSSPACE; uiop->uio_td = NULL; uiop->uio_offset = off; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflags |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_WRITE(vp, uiop, ioflags, cred); + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; /* Unlocked write. */ nfsrvstats.srvvop_writes++; free((caddr_t)iv, M_TEMP); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 18:56:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF5EF1065670; Thu, 5 Jan 2012 18:56:23 +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 DE1B28FC15; Thu, 5 Jan 2012 18:56:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05IuNsc050121; Thu, 5 Jan 2012 18:56:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IuN05050119; Thu, 5 Jan 2012 18:56:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051856.q05IuN05050119@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229620 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 18:56:24 -0000 Author: jhb Date: Thu Jan 5 18:56:23 2012 New Revision: 229620 URL: http://svn.freebsd.org/changeset/base/229620 Log: MFC 228207: When changing the user priority of a thread, change the real priority in addition to the user priority for threads whose current real priority is equal to the previous user priority or if the new priority is a real-time priority. This allows priority changes of other threads to have an immediate effect. Modified: stable/8/sys/kern/kern_resource.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_resource.c ============================================================================== --- stable/8/sys/kern/kern_resource.c Thu Jan 5 18:55:59 2012 (r229619) +++ stable/8/sys/kern/kern_resource.c Thu Jan 5 18:56:23 2012 (r229620) @@ -497,8 +497,9 @@ rtp_to_pri(struct rtprio *rtp, struct th sched_class(td, rtp->type); /* XXX fix */ oldpri = td->td_user_pri; sched_user_prio(td, newpri); - if (curthread == td) - sched_prio(curthread, td->td_user_pri); /* XXX dubious */ + if (td->td_user_pri != oldpri && (td == curthread || + td->td_priority == oldpri || td->td_user_pri >= PRI_MAX_REALTIME)) + sched_prio(td, td->td_user_pri); if (TD_ON_UPILOCK(td) && oldpri != newpri) { thread_unlock(td); umtx_pi_adjust(td, oldpri); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 19:14:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E83F01065672; Thu, 5 Jan 2012 19:14:11 +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 D64A88FC13; Thu, 5 Jan 2012 19:14:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05JEBaN050858; Thu, 5 Jan 2012 19:14:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JEBDG050856; Thu, 5 Jan 2012 19:14:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051914.q05JEBDG050856@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229624 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:14:12 -0000 Author: jhb Date: Thu Jan 5 19:14:11 2012 New Revision: 229624 URL: http://svn.freebsd.org/changeset/base/229624 Log: MFC 228278: Use the correct volume identifier field when parsing MR_EVT_ARG_LD_STRIP arguments. Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_evt.c Thu Jan 5 19:14:02 2012 (r229623) +++ stable/8/usr.sbin/mfiutil/mfi_evt.c Thu Jan 5 19:14:11 2012 (r229624) @@ -438,7 +438,7 @@ mfi_decode_evt(int fd, struct mfi_evt_de printf(": "); break; case MR_EVT_ARGS_LD_STRIP: - printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld)); + printf("VOL %s", volume_name(fd, &detail->args.ld_strip.ld)); if (verbose) { printf(" strip %lld", (long long)detail->args.ld_strip.strip); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 19:18:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752AC106566B; Thu, 5 Jan 2012 19:18:42 +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 63ABA8FC1C; Thu, 5 Jan 2012 19:18:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05JIghr051099; Thu, 5 Jan 2012 19:18:42 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JIgpo051097; Thu, 5 Jan 2012 19:18:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051918.q05JIgpo051097@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:18:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229626 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:18:42 -0000 Author: jhb Date: Thu Jan 5 19:18:41 2012 New Revision: 229626 URL: http://svn.freebsd.org/changeset/base/229626 Log: MFC 228496: Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls bus_generic_probe() and bus_generic_attach() to handle drivers that add new children via identify methods. Modified: stable/8/sys/dev/pci/isa_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/pci/isa_pci.c ============================================================================== --- stable/8/sys/dev/pci/isa_pci.c Thu Jan 5 19:18:20 2012 (r229625) +++ stable/8/sys/dev/pci/isa_pci.c Thu Jan 5 19:18:41 2012 (r229626) @@ -57,6 +57,7 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 19:36:38 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C21101065680; Thu, 5 Jan 2012 19:36:38 +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 B07168FC21; Thu, 5 Jan 2012 19:36:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05JacQS051738; Thu, 5 Jan 2012 19:36:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Jactn051736; Thu, 5 Jan 2012 19:36:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051936.q05Jactn051736@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229628 - stable/8/sys/fs/devfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:36:38 -0000 Author: jhb Date: Thu Jan 5 19:36:38 2012 New Revision: 229628 URL: http://svn.freebsd.org/changeset/base/229628 Log: MFC 228361: Explicitly use curthread while manipulating td_fpop during last close of a devfs file descriptor in devfs_close_f(). The passed in td argument may be NULL if the close was invoked by garbage collection of open file descriptors in pending control messages in the socket buffer of a UNIX domain socket after it was closed. Modified: stable/8/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:36:23 2012 (r229627) +++ stable/8/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:36:38 2012 (r229628) @@ -548,10 +548,14 @@ devfs_close_f(struct file *fp, struct th int error; struct file *fpop; - fpop = td->td_fpop; - td->td_fpop = fp; + /* + * NB: td may be NULL if this descriptor is closed due to + * garbage collection from a closed UNIX domain socket. + */ + fpop = curthread->td_fpop; + curthread->td_fpop = fp; error = vnops.fo_close(fp, td); - td->td_fpop = fpop; + curthread->td_fpop = fpop; /* * The f_cdevpriv cannot be assigned non-NULL value while we From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 19:50:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 912CB106564A; Thu, 5 Jan 2012 19:50:47 +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 7E9118FC17; Thu, 5 Jan 2012 19:50:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05Jolap052409; Thu, 5 Jan 2012 19:50:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Jol9O052407; Thu, 5 Jan 2012 19:50:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051950.q05Jol9O052407@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229634 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:50:47 -0000 Author: jhb Date: Thu Jan 5 19:50:47 2012 New Revision: 229634 URL: http://svn.freebsd.org/changeset/base/229634 Log: MFC 228089: Change the if_vlan driver to use if_transmit for forwarding packets to the parent interface. This avoids the overhead of queueing a packet to an IFQ only to immediately dequeue it again. Modified: stable/8/sys/net/if_vlan.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/net/if_vlan.c ============================================================================== --- stable/8/sys/net/if_vlan.c Thu Jan 5 19:50:12 2012 (r229633) +++ stable/8/sys/net/if_vlan.c Thu Jan 5 19:50:47 2012 (r229634) @@ -34,9 +34,8 @@ * we need to pretend to be enough of an Ethernet implementation * to make arp work. The way we do this is by telling everyone * that we are an Ethernet, and then catch the packets that - * ether_output() left on our output queue when it calls - * if_start(), rewrite them for use by the real outgoing interface, - * and ask it to send them. + * ether_output() sends to us via if_transmit(), rewrite them for + * use by the real outgoing interface, and ask it to send them. */ #include @@ -179,14 +178,15 @@ static __inline struct ifvlan * vlan_get #endif static void trunk_destroy(struct ifvlantrunk *trunk); -static void vlan_start(struct ifnet *ifp); static void vlan_init(void *foo); static void vlan_input(struct ifnet *ifp, struct mbuf *m); static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); +static void vlan_qflush(struct ifnet *ifp); static int vlan_setflag(struct ifnet *ifp, int flag, int status, int (*func)(struct ifnet *, int)); static int vlan_setflags(struct ifnet *ifp, int status); static int vlan_setmulti(struct ifnet *ifp); +static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); static void vlan_unconfig(struct ifnet *ifp); static void vlan_unconfig_locked(struct ifnet *ifp); static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); @@ -807,9 +807,9 @@ vlan_clone_create(struct if_clone *ifc, /* NB: mtu is not set here */ ifp->if_init = vlan_init; - ifp->if_start = vlan_start; + ifp->if_transmit = vlan_transmit; + ifp->if_qflush = vlan_qflush; ifp->if_ioctl = vlan_ioctl; - ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = VLAN_IFFLAGS; ether_ifattach(ifp, eaddr); /* Now undo some of the damage... */ @@ -865,99 +865,95 @@ vlan_init(void *foo __unused) } /* - * The if_start method for vlan(4) interface. It doesn't - * raises the IFF_DRV_OACTIVE flag, since it is called - * only from IFQ_HANDOFF() macro in ether_output_frame(). - * If the interface queue is full, and vlan_start() is - * not called, the queue would never get emptied and - * interface would stall forever. + * The if_transmit method for vlan(4) interface. */ -static void -vlan_start(struct ifnet *ifp) +static int +vlan_transmit(struct ifnet *ifp, struct mbuf *m) { struct ifvlan *ifv; struct ifnet *p; - struct mbuf *m; int error; ifv = ifp->if_softc; p = PARENT(ifv); - for (;;) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - BPF_MTAP(ifp, m); + BPF_MTAP(ifp, m); - /* - * Do not run parent's if_start() if the parent is not up, - * or parent's driver will cause a system crash. - */ - if (!UP_AND_RUNNING(p)) { - m_freem(m); - ifp->if_collisions++; - continue; - } + /* + * Do not run parent's if_transmit() if the parent is not up, + * or parent's driver will cause a system crash. + */ + if (!UP_AND_RUNNING(p)) { + m_freem(m); + ifp->if_collisions++; + return (0); + } - /* - * Pad the frame to the minimum size allowed if told to. - * This option is in accord with IEEE Std 802.1Q, 2003 Ed., - * paragraph C.4.4.3.b. It can help to work around buggy - * bridges that violate paragraph C.4.4.3.a from the same - * document, i.e., fail to pad short frames after untagging. - * E.g., a tagged frame 66 bytes long (incl. FCS) is OK, but - * untagging it will produce a 62-byte frame, which is a runt - * and requires padding. There are VLAN-enabled network - * devices that just discard such runts instead or mishandle - * them somehow. - */ - if (soft_pad) { - static char pad[8]; /* just zeros */ - int n; - - for (n = ETHERMIN + ETHER_HDR_LEN - m->m_pkthdr.len; - n > 0; n -= sizeof(pad)) - if (!m_append(m, min(n, sizeof(pad)), pad)) - break; - - if (n > 0) { - if_printf(ifp, "cannot pad short frame\n"); - ifp->if_oerrors++; - m_freem(m); - continue; - } - } + /* + * Pad the frame to the minimum size allowed if told to. + * This option is in accord with IEEE Std 802.1Q, 2003 Ed., + * paragraph C.4.4.3.b. It can help to work around buggy + * bridges that violate paragraph C.4.4.3.a from the same + * document, i.e., fail to pad short frames after untagging. + * E.g., a tagged frame 66 bytes long (incl. FCS) is OK, but + * untagging it will produce a 62-byte frame, which is a runt + * and requires padding. There are VLAN-enabled network + * devices that just discard such runts instead or mishandle + * them somehow. + */ + if (soft_pad) { + static char pad[8]; /* just zeros */ + int n; + + for (n = ETHERMIN + ETHER_HDR_LEN - m->m_pkthdr.len; + n > 0; n -= sizeof(pad)) + if (!m_append(m, min(n, sizeof(pad)), pad)) + break; - /* - * If underlying interface can do VLAN tag insertion itself, - * just pass the packet along. However, we need some way to - * tell the interface where the packet came from so that it - * knows how to find the VLAN tag to use, so we attach a - * packet tag that holds it. - */ - if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { - m->m_pkthdr.ether_vtag = ifv->ifv_tag; - m->m_flags |= M_VLANTAG; - } else { - m = ether_vlanencap(m, ifv->ifv_tag); - if (m == NULL) { - if_printf(ifp, - "unable to prepend VLAN header\n"); - ifp->if_oerrors++; - continue; - } + if (n > 0) { + if_printf(ifp, "cannot pad short frame\n"); + ifp->if_oerrors++; + m_freem(m); + return (0); } + } - /* - * Send it, precisely as ether_output() would have. - * We are already running at splimp. - */ - error = (p->if_transmit)(p, m); - if (!error) - ifp->if_opackets++; - else + /* + * If underlying interface can do VLAN tag insertion itself, + * just pass the packet along. However, we need some way to + * tell the interface where the packet came from so that it + * knows how to find the VLAN tag to use, so we attach a + * packet tag that holds it. + */ + if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { + m->m_pkthdr.ether_vtag = ifv->ifv_tag; + m->m_flags |= M_VLANTAG; + } else { + m = ether_vlanencap(m, ifv->ifv_tag); + if (m == NULL) { + if_printf(ifp, "unable to prepend VLAN header\n"); ifp->if_oerrors++; + return (0); + } } + + /* + * Send it, precisely as ether_output() would have. + */ + error = (p->if_transmit)(p, m); + if (!error) + ifp->if_opackets++; + else + ifp->if_oerrors++; + return (error); +} + +/* + * The ifp->if_qflush entry point for vlan(4) is a no-op. + */ +static void +vlan_qflush(struct ifnet *ifp __unused) +{ } static void From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 19:53:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6A021065672; Thu, 5 Jan 2012 19:53:17 +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 A528D8FC14; Thu, 5 Jan 2012 19:53:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05JrHh1052589; Thu, 5 Jan 2012 19:53:17 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JrHJE052587; Thu, 5 Jan 2012 19:53:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051953.q05JrHJE052587@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:53:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229636 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:53:17 -0000 Author: jhb Date: Thu Jan 5 19:53:17 2012 New Revision: 229636 URL: http://svn.freebsd.org/changeset/base/229636 Log: MFC 228593: Fire a kevent if necessary after seeking on a regular file. This fixes a case where a kevent would not fire on a regular file if an application read to EOF and then seeked backwards into the file. Modified: stable/8/sys/kern/vfs_syscalls.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/vfs_syscalls.c ============================================================================== --- stable/8/sys/kern/vfs_syscalls.c Thu Jan 5 19:53:01 2012 (r229635) +++ stable/8/sys/kern/vfs_syscalls.c Thu Jan 5 19:53:17 2012 (r229636) @@ -1971,6 +1971,7 @@ lseek(td, uap) if (error != 0) goto drop; fp->f_offset = offset; + VFS_KNOTE_UNLOCKED(vp, 0); *(off_t *)(td->td_retval) = fp->f_offset; drop: fdrop(fp, td); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 19:56:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 926E8106566C; Thu, 5 Jan 2012 19:56:54 +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 80F858FC1E; Thu, 5 Jan 2012 19:56:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05JusSH052797; Thu, 5 Jan 2012 19:56:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JusHp052795; Thu, 5 Jan 2012 19:56:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051956.q05JusHp052795@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229638 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 19:56:54 -0000 Author: jhb Date: Thu Jan 5 19:56:54 2012 New Revision: 229638 URL: http://svn.freebsd.org/changeset/base/229638 Log: MFC 228866: Fix a bug where TAILQ_FIRST(&V_ifnet) was accessed without holding the proper lock. Modified: stable/8/sys/netinet6/icmp6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/icmp6.c ============================================================================== --- stable/8/sys/netinet6/icmp6.c Thu Jan 5 19:56:30 2012 (r229637) +++ stable/8/sys/netinet6/icmp6.c Thu Jan 5 19:56:54 2012 (r229638) @@ -1768,7 +1768,7 @@ static int ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, struct ifnet *ifp0, int resid) { - struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); + struct ifnet *ifp; struct in6_ifaddr *ifa6; struct ifaddr *ifa; struct ifnet *ifp_dep = NULL; @@ -1781,6 +1781,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n return (0); /* needless to copy */ IFNET_RLOCK_NOSLEEP(); + ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); again: for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 20:31:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96D7510656DA; Thu, 5 Jan 2012 20:31:58 +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 846138FC1C; Thu, 5 Jan 2012 20:31:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05KVwlS054218; Thu, 5 Jan 2012 20:31:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KVwZ7054215; Thu, 5 Jan 2012 20:31:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052031.q05KVwZ7054215@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229642 - stable/8/sys/dev/vr X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 20:31:58 -0000 Author: yongari Date: Thu Jan 5 20:31:58 2012 New Revision: 229642 URL: http://svn.freebsd.org/changeset/base/229642 Log: MFC r228086: Announce flow control capability to PHY drivers and enable flow control for all vr(4) controllers that support it. It's known that old vr(4) controllers(Rhine II) does not support TX pause but Rhine III supports both TX and RX pause. Make TX pause really work on Rhine III by letting controller know available RX buffers. While here, adjust XON/XOFF parameters to get better performance with flow control. Modified: stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/vr/if_vrreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Thu Jan 5 20:30:16 2012 (r229641) +++ stable/8/sys/dev/vr/if_vr.c Thu Jan 5 20:31:58 2012 (r229642) @@ -309,7 +309,7 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { @@ -346,7 +346,6 @@ vr_miibus_statchg(device_t dev) CSR_WRITE_1(sc, VR_CR1, cr1); } fc = 0; -#ifdef notyet /* Configure flow-control. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { fc = CSR_READ_1(sc, VR_FLOWCR1); @@ -355,8 +354,10 @@ vr_miibus_statchg(device_t dev) IFM_ETH_RXPAUSE) != 0) fc |= VR_FLOWCR1_RXPAUSE; if ((IFM_OPTIONS(mii->mii_media_active) & - IFM_ETH_TXPAUSE) != 0) + IFM_ETH_TXPAUSE) != 0) { fc |= VR_FLOWCR1_TXPAUSE; + sc->vr_flags |= VR_F_TXPAUSE; + } CSR_WRITE_1(sc, VR_FLOWCR1, fc); } else if (sc->vr_revid >= REV_ID_VT6102_A) { /* No Tx puase capability available for Rhine II. */ @@ -367,7 +368,6 @@ vr_miibus_statchg(device_t dev) fc |= VR_MISCCR0_RXPAUSE; CSR_WRITE_1(sc, VR_MISC_CR0, fc); } -#endif vr_rx_start(sc); vr_tx_start(sc); } else { @@ -770,7 +770,8 @@ vr_attach(device_t dev) else phy = CSR_READ_1(sc, VR_PHYADDR) & VR_PHYADDR_MASK; error = mii_attach(dev, &sc->vr_miibus, ifp, vr_ifmedia_upd, - vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, + sc->vr_revid >= REV_ID_VT6102_A ? MIIF_DOPAUSE : 0); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1400,6 +1401,17 @@ vr_rxeof(struct vr_softc *sc) } if (prog > 0) { + /* + * Let controller know how many number of RX buffers + * are posted but avoid expensive register access if + * TX pause capability was not negotiated with link + * partner. + */ + if ((sc->vr_flags & VR_F_TXPAUSE) != 0) { + if (prog >= VR_RX_RING_CNT) + prog = VR_RX_RING_CNT - 1; + CSR_WRITE_1(sc, VR_FLOWCR0, prog); + } sc->vr_cdata.vr_rx_cons = cons; bus_dmamap_sync(sc->vr_cdata.vr_rx_ring_tag, sc->vr_cdata.vr_rx_ring_map, @@ -2075,14 +2087,32 @@ vr_init_locked(struct vr_softc *sc) /* Set flow-control parameters for Rhine III. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { - /* Rx buffer count available for incoming packet. */ - CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT); /* - * Tx pause low threshold : 16 free receive buffers - * Tx pause XON high threshold : 48 free receive buffers + * Configure Rx buffer count available for incoming + * packet. + * Even though data sheet says almost nothing about + * this register, this register should be updated + * whenever driver adds new RX buffers to controller. + * Otherwise, XON frame is not sent to link partner + * even if controller has enough RX buffers and you + * would be isolated from network. + * The controller is not smart enough to know number + * of available RX buffers so driver have to let + * controller know how many RX buffers are posted. + * In other words, this register works like a residue + * counter for RX buffers and should be initialized + * to the number of total RX buffers - 1 before + * enabling RX MAC. Note, this register is 8bits so + * it effectively limits the maximum number of RX + * buffer to be configured by controller is 255. + */ + CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT - 1); + /* + * Tx pause low threshold : 8 free receive buffers + * Tx pause XON high threshold : 24 free receive buffers */ CSR_WRITE_1(sc, VR_FLOWCR1, - VR_FLOWCR1_TXLO16 | VR_FLOWCR1_TXHI48 | VR_FLOWCR1_XONXOFF); + VR_FLOWCR1_TXLO8 | VR_FLOWCR1_TXHI24 | VR_FLOWCR1_XONXOFF); /* Set Tx pause timer. */ CSR_WRITE_2(sc, VR_PAUSETIMER, 0xffff); } @@ -2110,7 +2140,7 @@ vr_init_locked(struct vr_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); mii_mediachg(mii); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -2132,6 +2162,7 @@ vr_ifmedia_upd(struct ifnet *ifp) mii = device_get_softc(sc->vr_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) mii_phy_reset(miisc); + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); error = mii_mediachg(mii); VR_UNLOCK(sc); Modified: stable/8/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 20:30:16 2012 (r229641) +++ stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 20:31:58 2012 (r229642) @@ -722,6 +722,7 @@ struct vr_softc { uint8_t vr_revid; /* Rhine chip revision */ int vr_flags; /* See VR_F_* below */ #define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_TXPAUSE 0x0010 #define VR_F_SUSPENDED 0x2000 #define VR_F_DETACHED 0x4000 #define VR_F_LINK 0x8000 From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 20:37:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F83E106566B; Thu, 5 Jan 2012 20:37:29 +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 0D6C28FC08; Thu, 5 Jan 2012 20:37:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05KbSKx054539; Thu, 5 Jan 2012 20:37:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KbSDU054537; Thu, 5 Jan 2012 20:37:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052037.q05KbSDU054537@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229645 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 20:37:29 -0000 Author: yongari Date: Thu Jan 5 20:37:28 2012 New Revision: 229645 URL: http://svn.freebsd.org/changeset/base/229645 Log: MFC r228205: Add more controllers that support jumbo frame. Modified: stable/8/share/man/man4/bge.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/bge.4 ============================================================================== --- stable/8/share/man/man4/bge.4 Thu Jan 5 20:37:13 2012 (r229644) +++ stable/8/share/man/man4/bge.4 Thu Jan 5 20:37:28 2012 (r229645) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd December 2, 2011 .Dt BGE 4 .Os .Sh NAME @@ -82,9 +82,9 @@ copper gigabit transceivers, which support autonegotiation of 10, 100 and 1000Mbps modes in full or half duplex. .Pp -The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704 and BCM5717 also support -jumbo frames, which can be configured -via the interface MTU setting. +The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704, BCM5714, BCM5717, BCM5719, +BCM5720, BCM5780 and BCM57765 also support jumbo frames, which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit jumbo frames. From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 20:41:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A300106566C; Thu, 5 Jan 2012 20:41:41 +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 0EE9D8FC0C; Thu, 5 Jan 2012 20:41:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05KfeeS054775; Thu, 5 Jan 2012 20:41:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KfeaL054771; Thu, 5 Jan 2012 20:41:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201052041.q05KfeaL054771@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 20:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229647 - in stable/8/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 20:41:41 -0000 Author: jhb Date: Thu Jan 5 20:41:40 2012 New Revision: 229647 URL: http://svn.freebsd.org/changeset/base/229647 Log: MFC 224169 (gibbs): cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c: o Add zpool_pool_state_to_name() API to libzfs which converts a pool_state_t into a user consumable string. o While here, correct constness of make zpool_state_to_name() and zpool_label_disk(). Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 20:37:42 2012 (r229646) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 20:41:40 2012 (r229647) @@ -1185,7 +1185,7 @@ print_status_config(zpool_handle_t *zhp, char *vname; uint64_t notpresent; spare_cbdata_t cb; - char *state; + const char *state; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 20:37:42 2012 (r229646) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 20:41:40 2012 (r229647) @@ -202,7 +202,8 @@ extern zpool_handle_t *zpool_open_canfai extern void zpool_close(zpool_handle_t *); extern const char *zpool_get_name(zpool_handle_t *); extern int zpool_get_state(zpool_handle_t *); -extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +extern const char *zpool_pool_state_to_name(pool_state_t); extern void zpool_free_handles(libzfs_handle_t *); /* @@ -252,7 +253,7 @@ extern nvlist_t *zpool_find_vdev(zpool_h boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); /* * Functions to manage pool properties Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 20:37:42 2012 (r229646) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 20:41:40 2012 (r229647) @@ -176,7 +176,7 @@ zpool_get_prop_int(zpool_handle_t *zhp, /* * Map VDEV STATE to printed strings. */ -char * +const char * zpool_state_to_name(vdev_state_t state, vdev_aux_t aux) { switch (state) { @@ -204,6 +204,34 @@ zpool_state_to_name(vdev_state_t state, } /* + * Map POOL STATE to printed strings. + */ +const char * +zpool_pool_state_to_name(pool_state_t state) +{ + switch (state) { + case POOL_STATE_ACTIVE: + return (gettext("ACTIVE")); + case POOL_STATE_EXPORTED: + return (gettext("EXPORTED")); + case POOL_STATE_DESTROYED: + return (gettext("DESTROYED")); + case POOL_STATE_SPARE: + return (gettext("SPARE")); + case POOL_STATE_L2CACHE: + return (gettext("L2CACHE")); + case POOL_STATE_UNINITIALIZED: + return (gettext("UNINITIALIZED")); + case POOL_STATE_UNAVAIL: + return (gettext("UNAVAIL")); + case POOL_STATE_POTENTIALLY_ACTIVE: + return (gettext("POTENTIALLY_ACTIVE")); + } + + return (gettext("UNKNOWN")); +} + +/* * Get a zpool property value for 'prop' and return the value in * a pre-allocated buffer. */ @@ -3648,7 +3676,7 @@ find_start_block(nvlist_t *config) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) { #ifdef sun char path[MAXPATHLEN]; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 21:17:06 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C47D3106567A; Thu, 5 Jan 2012 21:17: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 B218A8FC17; Thu, 5 Jan 2012 21:17:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05LH6Bk055929; Thu, 5 Jan 2012 21:17:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LH6jX055927; Thu, 5 Jan 2012 21:17:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052117.q05LH6jX055927@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 21:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229649 - stable/8/sys/dev/ed X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 21:17:06 -0000 Author: yongari Date: Thu Jan 5 21:17:06 2012 New Revision: 229649 URL: http://svn.freebsd.org/changeset/base/229649 Log: MFC r228286: Fix off by one error in mbuf access. Previously it caused panic. While I'm here use NULL to compare mbuf pointer and add additional check for zero length mbuf before accessing the mbuf. PR: kern/162932 Modified: stable/8/sys/dev/ed/if_ed.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ed/if_ed.c ============================================================================== --- stable/8/sys/dev/ed/if_ed.c Thu Jan 5 20:49:48 2012 (r229648) +++ stable/8/sys/dev/ed/if_ed.c Thu Jan 5 21:17:06 2012 (r229649) @@ -1695,12 +1695,19 @@ ed_shmem_write_mbufs(struct ed_softc *sc break; } } - for (len = 0; m != 0; m = m->m_next) { - if (sc->isa16bit) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), (m->m_len + 1)/ 2); - else + for (len = 0; m != NULL; m = m->m_next) { + if (m->m_len == 0) + continue; + if (sc->isa16bit) { + if (m->m_len > 1) + bus_space_write_region_2(sc->mem_bst, + sc->mem_bsh, dst, + mtod(m, uint16_t *), m->m_len / 2); + if ((m->m_len & 1) != 0) + bus_space_write_1(sc->mem_bst, sc->mem_bsh, + dst + m->m_len - 1, + *(mtod(m, uint8_t *) + m->m_len - 1)); + } else bus_space_write_region_1(sc->mem_bst, sc->mem_bsh, dst, mtod(m, uint8_t *), m->m_len); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 22:14:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4408A1065672; Thu, 5 Jan 2012 22:14:50 +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 320BD8FC1A; Thu, 5 Jan 2012 22:14:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05MEoYo058609; Thu, 5 Jan 2012 22:14:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MEohw058607; Thu, 5 Jan 2012 22:14:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201052214.q05MEohw058607@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 22:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229662 - stable/8/sys/dev/mfi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 22:14:50 -0000 Author: jhb Date: Thu Jan 5 22:14:49 2012 New Revision: 229662 URL: http://svn.freebsd.org/changeset/base/229662 Log: MFC 227577: The sys/sysctl.h header is needed when MFI_DEBUG is defined. Modified: stable/8/sys/dev/mfi/mfi_debug.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mfi/mfi_debug.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_debug.c Thu Jan 5 22:14:18 2012 (r229661) +++ stable/8/sys/dev/mfi/mfi_debug.c Thu Jan 5 22:14:49 2012 (r229662) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 22:28:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51EC41065673; Thu, 5 Jan 2012 22:28:41 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D30F8FC0A; Thu, 5 Jan 2012 22:28:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05MSfuJ059133; Thu, 5 Jan 2012 22:28:41 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MSfBa059126; Thu, 5 Jan 2012 22:28:41 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201052228.q05MSfBa059126@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 22:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229664 - in stable/8/cddl/contrib/opensolaris: cmd/zdb cmd/zpool cmd/ztest head lib/libzfs/common lib/libzpool/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 22:28:41 -0000 Author: mm Date: Thu Jan 5 22:28:40 2012 New Revision: 229664 URL: http://svn.freebsd.org/changeset/base/229664 Log: MFC ZFS userland to reduce diff with stable/9: r224170, r224526, r226583, r226613, r226615, r226616 MFC r224170 (gibbs): Correct reporting of missing leaf vdevs so that the GUID required to perform pool actions is always displayed. cddl/contrib/opensolaris/cmd/zpool/zpool_main.c: The "zpool status" command reports the "last seen at" device node path when the vdev name is being reported by GUID. Augment this code to assume a GUID is reported when a device goes missing after initial boot in addition to the previous behavior of doing this for devices that aren't seen at boot. cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c: In zpool_vdev_name(), report recently missing devices by GUID. There is no guarantee they will return at their previous location. MFC r224526 (mm, userland part only): Fix serious bug in ZIL that can lead to pool corruption in the case of a held dataset during remount. Detailed description is available at: https://www.illumos.org/issues/883 illumos-gate revision: 13380:161b964a0e10 MFC r226583 (pjd): Make all the lines align properly. MFC r226613 (pjd) [1]: libzpool task_alloc: pass only valid flags to kmem_alloc tqflags may contain other flags besided those that are suitable for kmem_alloc == umem_alloc MFC r226615 (pjd) [1]: thr_create: new_thread_ID may be NULL MFC r226616 (pjd) [1]: zdb: access dp_free_bpobj only if pool version is >= SPA_VERSION_DEADLISTS Submitted by: avg [1] Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/head/thread.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jan 5 22:28:40 2012 (r229664) @@ -2190,8 +2190,10 @@ dump_block_stats(spa_t *spa) */ (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, count_block_cb, &zcb, NULL); - (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, - count_block_cb, &zcb, NULL); + if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { + (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, + count_block_cb, &zcb, NULL); + } if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 22:28:40 2012 (r229664) @@ -1217,10 +1217,11 @@ print_status_config(zpool_handle_t *zhp, } if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, - ¬present) == 0) { + ¬present) == 0 || + vs->vs_state <= VDEV_STATE_CANT_OPEN) { char *path; - verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); - (void) printf(" was %s", path); + if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) + (void) printf(" was %s", path); } else if (vs->vs_aux != 0) { (void) printf(" "); @@ -3466,7 +3467,7 @@ print_scan_status(pool_scan_stat_t *ps) double fraction_done; char processed_buf[7], examined_buf[7], total_buf[7], rate_buf[7]; - (void) printf(gettext(" scan: ")); + (void) printf(gettext(" scan: ")); /* If there's never been a scan, there's not much to say. */ if (ps == NULL || ps->pss_func == POOL_SCAN_NONE || @@ -3546,7 +3547,7 @@ print_scan_status(pool_scan_stat_t *ps) /* * do not print estimated time if hours_left is more than 30 days */ - (void) printf(gettext(" %s scanned out of %s at %s/s"), + (void) printf(gettext(" %s scanned out of %s at %s/s"), examined_buf, total_buf, rate_buf); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), @@ -3557,10 +3558,10 @@ print_scan_status(pool_scan_stat_t *ps) } if (ps->pss_func == POOL_SCAN_RESILVER) { - (void) printf(gettext(" %s resilvered, %.2f%% done\n"), + (void) printf(gettext(" %s resilvered, %.2f%% done\n"), processed_buf, 100 * fraction_done); } else if (ps->pss_func == POOL_SCAN_SCRUB) { - (void) printf(gettext(" %s repaired, %.2f%% done\n"), + (void) printf(gettext(" %s repaired, %.2f%% done\n"), processed_buf, 100 * fraction_done); } } Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 5 22:28:40 2012 (r229664) @@ -206,6 +206,7 @@ typedef struct ztest_od { */ typedef struct ztest_ds { objset_t *zd_os; + rwlock_t zd_zilog_lock; zilog_t *zd_zilog; uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ @@ -239,6 +240,7 @@ ztest_func_t ztest_dmu_commit_callbacks; ztest_func_t ztest_zap; ztest_func_t ztest_zap_parallel; ztest_func_t ztest_zil_commit; +ztest_func_t ztest_zil_remount; ztest_func_t ztest_dmu_read_write_zcopy; ztest_func_t ztest_dmu_objset_create_destroy; ztest_func_t ztest_dmu_prealloc; @@ -275,6 +277,7 @@ ztest_info_t ztest_info[] = { { ztest_zap_parallel, 100, &zopt_always }, { ztest_split_pool, 1, &zopt_always }, { ztest_zil_commit, 1, &zopt_incessant }, + { ztest_zil_remount, 1, &zopt_sometimes }, { ztest_dmu_read_write_zcopy, 1, &zopt_often }, { ztest_dmu_objset_create_destroy, 1, &zopt_often }, { ztest_dsl_prop_get_set, 1, &zopt_often }, @@ -990,6 +993,7 @@ ztest_zd_init(ztest_ds_t *zd, objset_t * zd->zd_seq = 0; dmu_objset_name(os, zd->zd_name); + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) @@ -1969,6 +1973,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object if (ztest_random(2) == 0) io_type = ZTEST_IO_WRITE_TAG; + (void) rw_rdlock(&zd->zd_zilog_lock); + switch (io_type) { case ZTEST_IO_WRITE_TAG: @@ -2004,6 +2010,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object break; } + (void) rw_unlock(&zd->zd_zilog_lock); + umem_free(data, blocksize); } @@ -2058,6 +2066,8 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ { zilog_t *zilog = zd->zd_zilog; + (void) rw_rdlock(&zd->zd_zilog_lock); + zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); /* @@ -2069,6 +2079,31 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); zd->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); + + (void) rw_unlock(&zd->zd_zilog_lock); +} + +/* + * This function is designed to simulate the operations that occur during a + * mount/unmount operation. We hold the dataset across these operations in an + * attempt to expose any implicit assumptions about ZIL management. + */ +/* ARGSUSED */ +void +ztest_zil_remount(ztest_ds_t *zd, uint64_t id) +{ + objset_t *os = zd->zd_os; + + (void) rw_wrlock(&zd->zd_zilog_lock); + + /* zfsvfs_teardown() */ + zil_close(zd->zd_zilog); + + /* zfsvfs_setup() */ + VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); + zil_replay(os, zd, ztest_replay_vector); + + (void) rw_unlock(&zd->zd_zilog_lock); } /* Modified: stable/8/cddl/contrib/opensolaris/head/thread.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/head/thread.h Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/head/thread.h Thu Jan 5 22:28:40 2012 (r229664) @@ -76,6 +76,7 @@ static __inline int thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*), void *arg, long flags, thread_t *new_thread_ID) { + pthread_t dummy; int ret; assert(stack_base == NULL); @@ -85,9 +86,12 @@ thr_create(void *stack_base, size_t stac pthread_attr_t attr; pthread_attr_init(&attr); - if(flags & THR_DETACHED) + if (flags & THR_DETACHED) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (new_thread_ID == NULL) + new_thread_ID = &dummy; + /* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */ ret = pthread_create(new_thread_ID, &attr, start_func, arg); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 22:28:40 2012 (r229664) @@ -3153,15 +3153,25 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp char buf[64]; vdev_stat_t *vs; uint_t vsc; + int have_stats; + int have_path; - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, - &value) == 0) { + have_stats = nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, + (uint64_t **)&vs, &vsc) == 0; + have_path = nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0; + + /* + * If the device is not currently present, assume it will not + * come back at the same device path. Display the device by GUID. + */ + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, &value) == 0 || + have_path && have_stats && vs->vs_state <= VDEV_STATE_CANT_OPEN) { verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &value) == 0); (void) snprintf(buf, sizeof (buf), "%llu", (u_longlong_t)value); path = buf; - } else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) { + } else if (have_path) { /* * If the device is dead (faulted, offline, etc) then don't @@ -3169,8 +3179,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp * open a misbehaving device, which can have undesirable * effects. */ - if ((nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, - (uint64_t **)&vs, &vsc) != 0 || + if ((have_stats == 0 || vs->vs_state >= VDEV_STATE_DEGRADED) && zhp != NULL && nvlist_lookup_string(nv, ZPOOL_CONFIG_DEVID, &devid) == 0) { Modified: stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Thu Jan 5 22:28:40 2012 (r229664) @@ -87,7 +87,7 @@ again: if ((t = tq->tq_freelist) != NULL } mutex_exit(&tq->tq_lock); - t = kmem_alloc(sizeof (task_t), tqflags); + t = kmem_alloc(sizeof (task_t), tqflags & KM_SLEEP); mutex_enter(&tq->tq_lock); if (t != NULL) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 5 22:31:25 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFD9A10656B0; Thu, 5 Jan 2012 22:31:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD4308FC1C; Thu, 5 Jan 2012 22:31:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q05MVPxh059310; Thu, 5 Jan 2012 22:31:25 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MVP9J059308; Thu, 5 Jan 2012 22:31:25 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201052231.q05MVP9J059308@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 22:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229666 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2012 22:31:25 -0000 Author: mm Date: Thu Jan 5 22:31:25 2012 New Revision: 229666 URL: http://svn.freebsd.org/changeset/base/229666 Log: MFC r226617 (pjd): zfs vdev_file_io_start: validate vdev before using vdev_tsd vdev_tsd can be NULL for certain vdev states. At least in userland testing with ztest. Submitted by: avg Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Jan 5 22:29:11 2012 (r229665) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Jan 5 22:31:25 2012 (r229666) @@ -153,17 +153,19 @@ static int vdev_file_io_start(zio_t *zio) { vdev_t *vd = zio->io_vd; - vdev_file_t *vf = vd->vdev_tsd; - vnode_t *vp = vf->vf_vnode; + vdev_file_t *vf; + vnode_t *vp; ssize_t resid; - if (zio->io_type == ZIO_TYPE_IOCTL) { - /* XXPOLICY */ - if (!vdev_readable(vd)) { - zio->io_error = ENXIO; - return (ZIO_PIPELINE_CONTINUE); - } + if (!vdev_readable(vd)) { + zio->io_error = ENXIO; + return (ZIO_PIPELINE_CONTINUE); + } + + vf = vd->vdev_tsd; + vp = vf->vf_vnode; + if (zio->io_type == ZIO_TYPE_IOCTL) { switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: zio->io_error = VOP_FSYNC(vp, FSYNC | FDSYNC, From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 01:20:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 957EC106566B; Fri, 6 Jan 2012 01:20:48 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79CFA8FC14; Fri, 6 Jan 2012 01:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q061Kmgt065239; Fri, 6 Jan 2012 01:20:48 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q061KmHr065236; Fri, 6 Jan 2012 01:20:48 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201060120.q061KmHr065236@svn.freebsd.org> From: Rick Macklem Date: Fri, 6 Jan 2012 01:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229676 - in stable/8/sys/fs: nfs nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 01:20:48 -0000 Author: rmacklem Date: Fri Jan 6 01:20:48 2012 New Revision: 229676 URL: http://svn.freebsd.org/changeset/base/229676 Log: MFC: r227760 Add two arguments to the nfsrpc_rellockown() function in the NFSv4 client. This does not change the client's behaviour, but prepares the code so that nfsrpc_rellockown() can be called elsewhere in a future commit. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Fri Jan 6 00:56:31 2012 (r229675) +++ stable/8/sys/fs/nfs/nfs_var.h Fri Jan 6 01:20:48 2012 (r229676) @@ -418,8 +418,8 @@ int nfsrpc_pathconf(vnode_t, struct nfsv struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *); int nfsrpc_renew(struct nfsclclient *, struct ucred *, NFSPROC_T *); -int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, - struct ucred *, NFSPROC_T *); +int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, uint8_t *, + int, struct ucred *, NFSPROC_T *); int nfsrpc_getdirpath(struct nfsmount *, u_char *, struct ucred *, NFSPROC_T *); int nfsrpc_delegreturn(struct nfscldeleg *, struct ucred *, Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Fri Jan 6 00:56:31 2012 (r229675) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Fri Jan 6 01:20:48 2012 (r229676) @@ -649,7 +649,8 @@ nfsrpc_doclose(struct nfsmount *nmp, str * puts on the wire has the file handle for this file appended * to it, so it can be done now. */ - (void)nfsrpc_rellockown(nmp, lp, tcred, p); + (void)nfsrpc_rellockown(nmp, lp, lp->nfsl_open->nfso_fh, + lp->nfsl_open->nfso_fhlen, tcred, p); } /* @@ -4027,7 +4028,7 @@ nfsrpc_renew(struct nfsclclient *clp, st */ APPLESTATIC int nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllockowner *lp, - struct ucred *cred, NFSPROC_T *p) + uint8_t *fh, int fhlen, struct ucred *cred, NFSPROC_T *p) { struct nfsrv_descript nfsd, *nd = &nfsd; u_int32_t *tl; @@ -4039,10 +4040,8 @@ nfsrpc_rellockown(struct nfsmount *nmp, *tl++ = nmp->nm_clp->nfsc_clientid.lval[0]; *tl = nmp->nm_clp->nfsc_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); - NFSBCOPY(lp->nfsl_open->nfso_fh, &own[NFSV4CL_LOCKNAMELEN], - lp->nfsl_open->nfso_fhlen); - (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + - lp->nfsl_open->nfso_fhlen); + NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); + (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 02:23:34 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BBCB106566C; Fri, 6 Jan 2012 02:23:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3B018FC1B; Fri, 6 Jan 2012 02:23:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q062NXaB067282; Fri, 6 Jan 2012 02:23:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q062NXsd067279; Fri, 6 Jan 2012 02:23:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201060223.q062NXsd067279@svn.freebsd.org> From: Rick Macklem Date: Fri, 6 Jan 2012 02:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229679 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 02:23:34 -0000 Author: rmacklem Date: Fri Jan 6 02:23:33 2012 New Revision: 229679 URL: http://svn.freebsd.org/changeset/base/229679 Log: MFC: r227796 Clean up some cruft in the NFSv4 client left over from the OpenBSD port, so that it is more readable. No logic change is made by this commit. Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Fri Jan 6 01:57:41 2012 (r229678) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Fri Jan 6 02:23:33 2012 (r229679) @@ -1681,7 +1681,6 @@ nfscl_cleanup_common(struct nfsclclient } } -#if defined(APPLEKEXT) || defined(__FreeBSD__) /* * Find open/lock owners for processes that have exited. */ @@ -1699,7 +1698,6 @@ nfscl_cleanupkext(struct nfsclclient *cl NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } -#endif /* APPLEKEXT || __FreeBSD__ */ static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ /* @@ -2341,6 +2339,8 @@ nfscl_renewthread(struct nfsclclient *cl u_int32_t clidrev; int error, cbpathdown, islept, igotlock, ret, clearok; uint32_t recover_done_time = 0; + struct timespec mytime; + static time_t prevsec = 0; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2528,22 +2528,15 @@ tryagain: FREE((caddr_t)dp, M_NFSCLDELEG); } -#if defined(APPLEKEXT) || defined(__FreeBSD__) /* * Call nfscl_cleanupkext() once per second to check for * open/lock owners where the process has exited. */ - { - struct timespec mytime; - static time_t prevsec = 0; - - NFSGETNANOTIME(&mytime); - if (prevsec != mytime.tv_sec) { - prevsec = mytime.tv_sec; - nfscl_cleanupkext(clp); - } + NFSGETNANOTIME(&mytime); + if (prevsec != mytime.tv_sec) { + prevsec = mytime.tv_sec; + nfscl_cleanupkext(clp); } -#endif /* APPLEKEXT || __FreeBSD__ */ NFSLOCKCLSTATE(); if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 02:27:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC416106564A; Fri, 6 Jan 2012 02:27:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0E228FC0C; Fri, 6 Jan 2012 02:27:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q062RhHu067547; Fri, 6 Jan 2012 02:27:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q062RhDi067544; Fri, 6 Jan 2012 02:27:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201060227.q062RhDi067544@svn.freebsd.org> From: Eitan Adler Date: Fri, 6 Jan 2012 02:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229681 - stable/8/sbin/md5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 02:27:43 -0000 Author: eadler (ports committer) Date: Fri Jan 6 02:27:43 2012 New Revision: 229681 URL: http://svn.freebsd.org/changeset/base/229681 Log: MFC r227488: - add "check" option to MD5 and friends to compare files against known hash. Approved by: cperciva Modified: stable/8/sbin/md5/md5.1 stable/8/sbin/md5/md5.c Directory Properties: stable/8/sbin/md5/ (props changed) Modified: stable/8/sbin/md5/md5.1 ============================================================================== --- stable/8/sbin/md5/md5.1 Fri Jan 6 02:24:29 2012 (r229680) +++ stable/8/sbin/md5/md5.1 Fri Jan 6 02:27:43 2012 (r229681) @@ -8,18 +8,22 @@ .Sh SYNOPSIS .Nm md5 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha1 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha256 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm rmd160 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Sh DESCRIPTION @@ -73,6 +77,9 @@ precede any files named on the command l The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl c Ar string +Compare files to this md5 string. (Note that this option is not yet useful +if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . @@ -101,7 +108,8 @@ The and .Nm rmd160 utilities exit 0 on success, -and 1 if at least one of the input files could not be read. +1 if at least one of the input files could not be read, +and 2 if at least one file does not have the same hash as the -c option. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , Modified: stable/8/sbin/md5/md5.c ============================================================================== --- stable/8/sbin/md5/md5.c Fri Jan 6 02:24:29 2012 (r229680) +++ stable/8/sbin/md5/md5.c Fri Jan 6 02:27:43 2012 (r229681) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); int qflag; int rflag; int sflag; +unsigned char* checkAgainst; +int checksFailed; typedef void (DIGEST_Init)(void *); typedef void (DIGEST_Update)(void *, const unsigned char *, size_t); @@ -138,8 +140,13 @@ main(int argc, char *argv[]) digest = 0; failed = 0; - while ((ch = getopt(argc, argv, "pqrs:tx")) != -1) + checkAgainst = NULL; + checksFailed = 0; + while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) switch (ch) { + case 'c': + checkAgainst = optarg; + break; case 'p': MDFilter(&Algorithm[digest], 1); break; @@ -173,12 +180,19 @@ main(int argc, char *argv[]) failed++; } else { if (qflag) - printf("%s\n", p); + printf("%s", p); else if (rflag) - printf("%s %s\n", p, *argv); + printf("%s %s", p, *argv); else - printf("%s (%s) = %s\n", + printf("%s (%s) = %s", Algorithm[digest].name, *argv, p); + if (checkAgainst && strcmp(checkAgainst,p)) + { + checksFailed++; + if (!qflag) + printf(" [ Failed ]"); + } + printf("\n"); } } while (*++argv); } else if (!sflag && (optind == 1 || qflag || rflag)) @@ -186,6 +200,8 @@ main(int argc, char *argv[]) if (failed != 0) return (1); + if (checksFailed != 0) + return (2); return (0); } @@ -198,12 +214,20 @@ MDString(Algorithm_t *alg, const char *s size_t len = strlen(string); char buf[HEX_DIGEST_LENGTH]; + alg->Data(string,len,buf); if (qflag) - printf("%s\n", alg->Data(string, len, buf)); + printf("%s", buf); else if (rflag) - printf("%s \"%s\"\n", alg->Data(string, len, buf), string); + printf("%s \"%s\"", buf, string); else - printf("%s (\"%s\") = %s\n", alg->name, string, alg->Data(string, len, buf)); + printf("%s (\"%s\") = %s", alg->name, string, buf); + if (checkAgainst && strcmp(buf,checkAgainst)) + { + checksFailed++; + if (!qflag) + printf(" [ failed ]"); + } + printf("\n"); } /* * Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks. From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 11:06:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F10101065670; Fri, 6 Jan 2012 11:06:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB8128FC1D; Fri, 6 Jan 2012 11:06:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06B6mH3086903; Fri, 6 Jan 2012 11:06:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06B6mD0086901; Fri, 6 Jan 2012 11:06:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201061106.q06B6mD0086901@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 6 Jan 2012 11:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229696 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 11:06:49 -0000 Author: kib Date: Fri Jan 6 11:06:48 2012 New Revision: 229696 URL: http://svn.freebsd.org/changeset/base/229696 Log: MFC r228838: Optimize the common case of msyncing the whole file mapping with MS_SYNC flag. Modified: stable/8/sys/vm/vm_object.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Fri Jan 6 11:06:15 2012 (r229695) +++ stable/8/sys/vm/vm_object.c Fri Jan 6 11:06:48 2012 (r229696) @@ -942,7 +942,7 @@ vm_object_sync(vm_object_t object, vm_oo vm_object_t backing_object; struct vnode *vp; struct mount *mp; - int flags; + int flags, fsync_after; if (object == NULL) return; @@ -975,14 +975,29 @@ vm_object_sync(vm_object_t object, vm_oo (void) vn_start_write(vp, &mp, V_WAIT); vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - flags = (syncio || invalidate) ? OBJPC_SYNC : 0; - flags |= invalidate ? OBJPC_INVAL : 0; + if (syncio && !invalidate && offset == 0 && + OFF_TO_IDX(size) == object->size) { + /* + * If syncing the whole mapping of the file, + * it is faster to schedule all the writes in + * async mode, also allowing the clustering, + * and then wait for i/o to complete. + */ + flags = 0; + fsync_after = TRUE; + } else { + flags = (syncio || invalidate) ? OBJPC_SYNC : 0; + flags |= invalidate ? (OBJPC_SYNC | OBJPC_INVAL) : 0; + fsync_after = FALSE; + } VM_OBJECT_LOCK(object); vm_object_page_clean(object, OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); VM_OBJECT_UNLOCK(object); + if (fsync_after) + (void) VOP_FSYNC(vp, MNT_WAIT, curthread); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); vn_finished_write(mp); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 16:46:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AD27106564A; Fri, 6 Jan 2012 16:46:53 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04CDD8FC13; Fri, 6 Jan 2012 16:46:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06GkqVf098056; Fri, 6 Jan 2012 16:46:52 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Gkqnb098054; Fri, 6 Jan 2012 16:46:52 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201061646.q06Gkqnb098054@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 6 Jan 2012 16:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229706 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 16:46:53 -0000 Author: trociny Date: Fri Jan 6 16:46:52 2012 New Revision: 229706 URL: http://svn.freebsd.org/changeset/base/229706 Log: MFC r227954: Add const qualifier to rlimit_ident. Modified: stable/8/sys/sys/resource.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/sys/resource.h ============================================================================== --- stable/8/sys/sys/resource.h Fri Jan 6 16:45:44 2012 (r229705) +++ stable/8/sys/sys/resource.h Fri Jan 6 16:46:52 2012 (r229706) @@ -108,7 +108,7 @@ struct rusage { */ #ifdef _RLIMIT_IDENT -static char *rlimit_ident[RLIM_NLIMITS] = { +static const char *rlimit_ident[RLIM_NLIMITS] = { "cpu", "fsize", "data", From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 16:57:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DBDB106567F; Fri, 6 Jan 2012 16:57:30 +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 ECDB98FC1E; Fri, 6 Jan 2012 16:57:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06GvTnc098556; Fri, 6 Jan 2012 16:57:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06GvTmW098554; Fri, 6 Jan 2012 16:57:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061657.q06GvTmW098554@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 16:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229709 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 16:57:30 -0000 Author: jhb Date: Fri Jan 6 16:57:29 2012 New Revision: 229709 URL: http://svn.freebsd.org/changeset/base/229709 Log: MFC 228967: Update if_obytes and if_omcast after successful transmit. While I'm here update if_oerrors if parent interface of vlan is not up and running. Previously it updated collision counter and it was confusing to interprete it. Modified: stable/8/sys/net/if_vlan.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/net/if_vlan.c ============================================================================== --- stable/8/sys/net/if_vlan.c Fri Jan 6 16:56:09 2012 (r229708) +++ stable/8/sys/net/if_vlan.c Fri Jan 6 16:57:29 2012 (r229709) @@ -872,10 +872,12 @@ vlan_transmit(struct ifnet *ifp, struct { struct ifvlan *ifv; struct ifnet *p; - int error; + int error, len, mcast; ifv = ifp->if_softc; p = PARENT(ifv); + len = m->m_pkthdr.len; + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; BPF_MTAP(ifp, m); @@ -885,7 +887,7 @@ vlan_transmit(struct ifnet *ifp, struct */ if (!UP_AND_RUNNING(p)) { m_freem(m); - ifp->if_collisions++; + ifp->if_oerrors++; return (0); } @@ -941,9 +943,11 @@ vlan_transmit(struct ifnet *ifp, struct * Send it, precisely as ether_output() would have. */ error = (p->if_transmit)(p, m); - if (!error) + if (!error) { ifp->if_opackets++; - else + ifp->if_omcasts += mcast; + ifp->if_obytes += len; + } else ifp->if_oerrors++; return (error); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 18:16:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 920051065794; Fri, 6 Jan 2012 18:16:58 +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 714AF8FC14; Fri, 6 Jan 2012 18:16:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06IGws7001365; Fri, 6 Jan 2012 18:16:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06IGwai001362; Fri, 6 Jan 2012 18:16:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061816.q06IGwai001362@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 18:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229712 - stable/8/sys/dev/et X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 18:16:58 -0000 Author: yongari Date: Fri Jan 6 18:16:57 2012 New Revision: 229712 URL: http://svn.freebsd.org/changeset/base/229712 Log: MFC r228291-228293,228297-228298: r228291: Remove NetBSD license. r199548 removed all bit macros that were derived from NetBSD. r228292: Implement suspend/resume methods. Driver has no issue with suspend/resume. r228293: Fix alt(4) support. Also add check for number of available TX descriptors before trying to send frames. If we're not able to send a frame, make sure to prepend it to if_snd queue such that alt(4) should work. While I'm here prefer ETHER_BPF_MTAP to BPF_MTAP. ETHER_BPF_MTAP should be used for controllers that support VLAN hardware tag insertion. The controller supports VLAN tag insertion but lacks VLAN tag stripping in RX path though. r228297: et(4) supports VLAN oversized frame so correctly set header length. While I'm here remove initializing if_mtu, it is set by ether_ifattach(9). Also move callout_init_mtx(9) to the right below driver lock initialization. r228298: Make et_probe() return BUS_PROBE_DEFAULT such that allow other driver that has high precedence for the controller override et(4). Add missing callout_drain(9) in device detach and rework detach routine. While I'm here use rman_get_rid(9) instead of using cached resource id because bus methods are free to change the id. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 18:15:27 2012 (r229711) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 18:16:57 2012 (r229712) @@ -88,6 +88,8 @@ static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); static int et_shutdown(device_t); +static int et_suspend(device_t); +static int et_resume(device_t); static int et_miibus_readreg(device_t, int, int); static int et_miibus_writereg(device_t, int, int, int); @@ -170,6 +172,8 @@ static device_method_t et_methods[] = { DEVMETHOD(device_attach, et_attach), DEVMETHOD(device_detach, et_detach), DEVMETHOD(device_shutdown, et_shutdown), + DEVMETHOD(device_suspend, et_suspend), + DEVMETHOD(device_resume, et_resume), DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_driver_added, bus_generic_driver_added), @@ -226,7 +230,7 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return (0); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -244,6 +248,7 @@ et_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -335,10 +340,10 @@ et_attach(device_t dev) ifp->if_init = et_init; ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; - ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; - IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); + ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC - 1); IFQ_SET_READY(&ifp->if_snd); et_chip_attach(sc); @@ -351,7 +356,9 @@ et_attach(device_t dev) } ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, et_intr, sc, &sc->sc_irq_handle); @@ -375,31 +382,27 @@ et_detach(device_t dev) struct et_softc *sc = device_get_softc(dev); if (device_is_attached(dev)) { - struct ifnet *ifp = sc->ifp; - + ether_ifdetach(sc->ifp); ET_LOCK(sc); et_stop(sc); - bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); ET_UNLOCK(sc); - - ether_ifdetach(ifp); + callout_drain(&sc->sc_tick); } if (sc->sc_miibus != NULL) device_delete_child(dev, sc->sc_miibus); bus_generic_detach(dev); - if (sc->sc_irq_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - } + if (sc->sc_irq_handle != NULL) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); if ((sc->sc_flags & ET_FLAG_MSI) != 0) pci_release_msi(dev); - - if (sc->sc_mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); - } + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); if (sc->ifp != NULL) if_free(sc->ifp); @@ -1257,12 +1260,13 @@ et_ioctl(struct ifnet *ifp, u_long cmd, static void et_start_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + struct mbuf *m_head = NULL; struct et_txbuf_data *tbd; - int trans; + int enq; + sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - tbd = &sc->sc_tx_data; if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) return; @@ -1270,30 +1274,32 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - trans = 0; - for (;;) { - struct mbuf *m; - - if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { + tbd = &sc->sc_tx_data; + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) break; - if (et_encap(sc, &m)) { - ifp->if_oerrors++; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (et_encap(sc, &m_head)) { + if (m_head == NULL) { + ifp->if_oerrors++; + break; + } + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (tbd->tbd_used > 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - trans = 1; - - BPF_MTAP(ifp, m); + enq++; + ETHER_BPF_MTAP(ifp, m_head); } - if (trans) + if (enq > 0) sc->watchdog_timer = 5; } @@ -2455,3 +2461,29 @@ et_setup_rxdesc(struct et_rxbuf_data *rb bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); } + +static int +et_suspend(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + et_stop(sc); + ET_UNLOCK(sc); + return (0); +} + +static int +et_resume(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_flags & IFF_UP) != 0) + et_init_locked(sc); + ET_UNLOCK(sc); + return (0); +} Modified: stable/8/sys/dev/et/if_etreg.h ============================================================================== --- stable/8/sys/dev/et/if_etreg.h Fri Jan 6 18:15:27 2012 (r229711) +++ stable/8/sys/dev/et/if_etreg.h Fri Jan 6 18:16:57 2012 (r229712) @@ -34,41 +34,6 @@ * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ -/*- - * Portions of this code is derived from NetBSD which is covered by - * the following license: - * - * Copyright (c) 2004, 2005 David Young. All rights reserved. - * - * Programmed for NetBSD by David Young. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Young ``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 David - * Young 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. - * - * $DragonFly: src/sys/sys/bitops.h,v 1.1 2007/10/14 04:15:17 sephe Exp $ - */ #ifndef _IF_ETREG_H #define _IF_ETREG_H From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 19:11:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7405106564A; Fri, 6 Jan 2012 19:11:20 +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 9EC4C8FC16; Fri, 6 Jan 2012 19:11:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06JBKHl003342; Fri, 6 Jan 2012 19:11:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JBKWb003339; Fri, 6 Jan 2012 19:11:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061911.q06JBKWb003339@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229718 - stable/8/sys/dev/et X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 19:11:20 -0000 Author: yongari Date: Fri Jan 6 19:11:20 2012 New Revision: 229718 URL: http://svn.freebsd.org/changeset/base/229718 Log: MFC r228325: Overhaul bus_dma(9) usage in et(4) and clean up TX/RX path. This change should make et(4) work on any architectures. o Remove m_getl inline function and replace it with stanard mbuf interfaces. Previous code tried to minimize code duplication but this came from incorrect use of common DMA tag. Driver may be still use a common RX allocation handler with additional structure changes but I don't see much point to do that it would make it hard to understand the code. o Remove DragonflyBSD specific constant EVL_ENCAPLEN, use ETHER_VLAN_ENCAP_LEN instead. o Add bunch of new RX status definition. It seems controller supports RX checksum offloading but I was not able to make the feature work yet. Currently driver checks whether recevied frame is good one or not. o Avoid a typedef ending in '_t' as style(9) says. o Controller has no restriction on DMA address space, so there is no reason to limit the DMA address to 32bit. Descriptor rings, status blocks and TX/RX buffers now use full 64bit DMA addressing. o Allocate DMA memory shared between host and controller as coherent. o Create 3 separate DMA tags to be used as TX, mini RX ring and stanard RX ring. Previously it created a single DMA tag and it was used to all three rings. o et(4) does not support jumbo frame at this moment and I still don't quite understand how jumbo frame works on this controller so use two RX rings to handle small sized frame and normal sized frame respectively. The mini RX ring will be used to receive frames that are less than or equal to 127 bytes. The second RX ring is used to receive frames that are not handled by the first RX ring. If jumbo frame support is implemented, driver may have to choose better RX scheme by letting the second RX ring handle jumbo frames. This scheme will mimic Broadcom's efficient jumbo frame handling feature. However RAM buffer size(16KB) of the controller is too small to hold 2 jumbo frames, if 9KB jumbo frame is used, I'm not sure how good performance would it have. o In et_rxeof(), make sure to check whether controller received good frame or not. Passing corrupted frame to upper layer is bad idea. o If driver receives a bad frame or driver fails to allocate RX buffer due to resource shortage condition, reuse previously loaded DMA map for RX buffer instead of unloading/loading RX buffer again. o et_init_tx_ring() never fails so change return type to void. o In watchdog handler, show TX DMA write back status of errored frame which could be used as a clue to debug watchdog timeout. o Add missing bus_dmamap_sync() in various places such that et(4) should work with bounce buffers(e.g. PAE). o TX side bus_dmamap_load_mbuf_sg(9) support. o RX side bus_dmamap_load_mbuf_sg(9) support. o Controller has no DMA alignment limit in RX buffer so use m_adj(9) in RX buffer allocation to make IP header align on 2 bytes boundary. Otherwise it would trigger unaligned access error in upper layer on strict alignment architectures. One of down side of controller is it provides limited set of RX buffer length like most Intel controllers. This is not problem at this moment because driver does not support jumbo frame yet but it may require alignment fixup code to support jumbo frame on strict alignment architectures. o In et_txeof(), don't zero TX descriptors for transmitted frames. TX descriptors don't need write access after transmission. Driver sets IFF_DRV_OACTIVE when the number of available TX descriptors are less than or equal to ET_NSEG_SPARE. Make sure to clear IFF_DRV_OACTIVE only when the number of available TX descriptor is greater than ET_NSEG_SPARE. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 19:09:47 2012 (r229717) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 19:11:20 2012 (r229718) @@ -100,7 +100,7 @@ static void et_init(void *); static int et_ioctl(struct ifnet *, u_long, caddr_t); static void et_start_locked(struct ifnet *); static void et_start(struct ifnet *); -static void et_watchdog(struct et_softc *); +static int et_watchdog(struct et_softc *); static int et_ifmedia_upd_locked(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -115,24 +115,22 @@ static void et_disable_intrs(struct et_s static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); -static int et_dma_alloc(device_t); -static void et_dma_free(device_t); -static int et_dma_mem_create(device_t, bus_size_t, bus_dma_tag_t *, - void **, bus_addr_t *, bus_dmamap_t *); -static void et_dma_mem_destroy(bus_dma_tag_t, void *, bus_dmamap_t); -static int et_dma_mbuf_create(device_t); -static void et_dma_mbuf_destroy(device_t, int, const int[]); -static void et_dma_ring_addr(void *, bus_dma_segment_t *, int, int); -static void et_dma_buf_addr(void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int et_init_tx_ring(struct et_softc *); +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static void et_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int et_dma_ring_alloc(struct et_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, + const char *); +static void et_dma_ring_free(struct et_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); +static void et_init_tx_ring(struct et_softc *); static int et_init_rx_ring(struct et_softc *); static void et_free_tx_ring(struct et_softc *); static void et_free_rx_ring(struct et_softc *); static int et_encap(struct et_softc *, struct mbuf **); -static int et_newbuf(struct et_rxbuf_data *, int, int, int); -static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int); +static void et_rxbuf_discard(struct et_rxbuf_data *, int); static void et_stop(struct et_softc *); static int et_chip_init(struct et_softc *); @@ -153,7 +151,6 @@ static void et_get_eaddr(device_t, uint8 static void et_setmulti(struct et_softc *); static void et_tick(void *); static void et_setmedia(struct et_softc *); -static void et_setup_rxdesc(struct et_rxbuf_data *, int, bus_addr_t); static const struct et_dev { uint16_t vid; @@ -206,18 +203,6 @@ TUNABLE_INT("hw.et.rx_intr_npkts", &et_r TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); -struct et_bsize { - int bufsize; - et_newbuf_t newbuf; -}; - -static const struct et_bsize et_bufsize_std[ET_RX_NRING] = { - { .bufsize = ET_RXDMA_CTRL_RING0_128, - .newbuf = et_newbuf_hdr }, - { .bufsize = ET_RXDMA_CTRL_RING1_2048, - .newbuf = et_newbuf_cluster }, -}; - static int et_probe(device_t dev) { @@ -330,7 +315,7 @@ et_attach(device_t dev) et_disable_intrs(sc); - error = et_dma_alloc(dev); + error = et_dma_alloc(sc); if (error) goto fail; @@ -407,7 +392,7 @@ et_detach(device_t dev) if (sc->ifp != NULL) if_free(sc->ifp); - et_dma_free(dev); + et_dma_free(sc); mtx_destroy(&sc->sc_mtx); @@ -703,235 +688,250 @@ et_enable_intrs(struct et_softc *sc, uin CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } +struct et_dmamap_arg { + bus_addr_t et_busaddr; +}; + +static void +et_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct et_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->et_busaddr = segs->ds_addr; +} + static int -et_dma_alloc(device_t dev) +et_dma_ring_alloc(struct et_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, error; + struct et_dmamap_arg ctx; + int error; - /* - * Create top level DMA tag - */ - error = bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, - NULL, NULL, - MAXBSIZE, - BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, &sc->sc_dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); + error = bus_dma_tag_create(sc->sc_dtag, alignment, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, maxsize, 0, NULL, NULL, + tag); + if (error != 0) { + device_printf(sc->dev, "could not create %s dma tag\n", msg); return (error); } - - /* - * Create TX ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_TX_RING_SIZE, &tx_ring->tr_dtag, - (void **)&tx_ring->tr_desc, - &tx_ring->tr_paddr, &tx_ring->tr_dmap); - if (error) { - device_printf(dev, "can't create TX ring DMA stuffs\n"); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate DMA'able memory for %s\n", msg); return (error); } - - /* - * Create TX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(uint32_t), &txsd->txsd_dtag, - (void **)&txsd->txsd_status, - &txsd->txsd_paddr, &txsd->txsd_dmap); - if (error) { - device_printf(dev, "can't create TX status DMA stuffs\n"); + /* Load the address of the ring. */ + ctx.et_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, et_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->dev, + "could not load DMA'able memory for %s\n", msg); return (error); } + *paddr = ctx.et_busaddr; + return (0); +} - /* - * Create DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - static const uint32_t rx_ring_posreg[ET_RX_NRING] = - { ET_RX_RING0_POS, ET_RX_RING1_POS }; - - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; +static void +et_dma_ring_free(struct et_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ - error = et_dma_mem_create(dev, ET_RX_RING_SIZE, - &rx_ring->rr_dtag, - (void **)&rx_ring->rr_desc, - &rx_ring->rr_paddr, - &rx_ring->rr_dmap); - if (error) { - device_printf(dev, "can't create DMA stuffs for " - "the %d RX ring\n", i); - return (error); - } - rx_ring->rr_posreg = rx_ring_posreg[i]; + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; } - - /* - * Create RX stat ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_RXSTAT_RING_SIZE, - &rxst_ring->rsr_dtag, - (void **)&rxst_ring->rsr_stat, - &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); - if (error) { - device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return (error); + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; } +} - /* - * Create RX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(struct et_rxstatus), - &rxsd->rxsd_dtag, - (void **)&rxsd->rxsd_status, - &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); - if (error) { - device_printf(dev, "can't create RX status DMA stuffs\n"); +static int +et_dma_alloc(struct et_softc *sc) +{ + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + int i, error; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_dtag); + if (error != 0) { + device_printf(sc->dev, "could not allocate parent dma tag\n"); return (error); } - /* - * Create mbuf DMA stuffs - */ - error = et_dma_mbuf_create(dev); + /* TX ring. */ + tx_ring = &sc->sc_tx_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_TX_RING_SIZE, + &tx_ring->tr_dtag, (uint8_t **)&tx_ring->tr_desc, &tx_ring->tr_dmap, + &tx_ring->tr_paddr, "TX ring"); if (error) return (error); - return (0); -} + /* TX status block. */ + txsd = &sc->sc_tx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, sizeof(uint32_t), + &txsd->txsd_dtag, (uint8_t **)&txsd->txsd_status, &txsd->txsd_dmap, + &txsd->txsd_paddr, "TX status block"); + if (error) + return (error); -static void -et_dma_free(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, rx_done[ET_RX_NRING]; + /* RX ring 0, used as to recive small sized frames. */ + rx_ring = &sc->sc_rx_ring[0]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 0"); + rx_ring->rr_posreg = ET_RX_RING0_POS; + if (error) + return (error); - /* - * Destroy TX ring DMA stuffs - */ - et_dma_mem_destroy(tx_ring->tr_dtag, tx_ring->tr_desc, - tx_ring->tr_dmap); + /* RX ring 1, used as to store normal sized frames. */ + rx_ring = &sc->sc_rx_ring[1]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 1"); + rx_ring->rr_posreg = ET_RX_RING1_POS; + if (error) + return (error); - /* - * Destroy TX status DMA stuffs - */ - et_dma_mem_destroy(txsd->txsd_dtag, txsd->txsd_status, - txsd->txsd_dmap); + /* RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RXSTAT_RING_SIZE, + &rxst_ring->rsr_dtag, (uint8_t **)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap, &rxst_ring->rsr_paddr, "RX stat ring"); + if (error) + return (error); - /* - * Destroy DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; + /* RX status block. */ + rxsd = &sc->sc_rx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, + sizeof(struct et_rxstatus), &rxsd->rxsd_dtag, + (uint8_t **)&rxsd->rxsd_status, &rxsd->rxsd_dmap, + &rxsd->rxsd_paddr, "RX status block"); + if (error) + return (error); - et_dma_mem_destroy(rx_ring->rr_dtag, rx_ring->rr_desc, - rx_ring->rr_dmap); + /* Create parent DMA tag for mbufs. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_mbuf_dtag); + if (error != 0) { + device_printf(sc->dev, + "could not allocate parent dma tag for mbuf\n"); + return (error); } - /* - * Destroy RX stat ring DMA stuffs - */ - et_dma_mem_destroy(rxst_ring->rsr_dtag, rxst_ring->rsr_stat, - rxst_ring->rsr_dmap); - - /* - * Destroy RX status DMA stuffs - */ - et_dma_mem_destroy(rxsd->rxsd_dtag, rxsd->rxsd_status, - rxsd->rxsd_dmap); - - /* - * Destroy mbuf DMA stuffs - */ - for (i = 0; i < ET_RX_NRING; ++i) - rx_done[i] = ET_RX_NDESC; - et_dma_mbuf_destroy(dev, ET_TX_NDESC, rx_done); - - /* - * Destroy top level DMA tag - */ - if (sc->sc_dtag != NULL) - bus_dma_tag_destroy(sc->sc_dtag); -} - -static int -et_dma_mbuf_create(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; - int i, error, rx_done[ET_RX_NRING]; + /* Create DMA tag for mini RX mbufs to use RX ring 0. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->sc_rx_mini_tag); + if (error) { + device_printf(sc->dev, "could not create mini RX dma tag\n"); + return (error); + } - /* - * Create mbuf DMA tag - */ - error = bus_dma_tag_create(sc->sc_dtag, 1, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - ET_JUMBO_FRAMELEN, ET_NSEG_MAX, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); + /* Create DMA tag for standard RX mbufs to use RX ring 1. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sc_rx_tag); if (error) { - device_printf(dev, "can't create mbuf DMA tag\n"); + device_printf(sc->dev, "could not create RX dma tag\n"); return (error); } - /* - * Create spare DMA map for RX mbufs - */ - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, &sc->sc_mbuf_tmp_dmap); + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * ET_NSEG_MAX, ET_NSEG_MAX, MCLBYTES, 0, NULL, NULL, + &sc->sc_tx_tag); if (error) { - device_printf(dev, "can't create spare mbuf DMA map\n"); - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; + device_printf(sc->dev, "could not create TX dma tag\n"); return (error); } - /* - * Create DMA maps for RX mbufs - */ - bzero(rx_done, sizeof(rx_done)); - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; + /* Initialize RX ring 0. */ + rbd = &sc->sc_rx_data[0]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING0_128; + rbd->rbd_newbuf = et_newbuf_hdr; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[0]; + /* Create DMA maps for mini RX buffers, ring 0. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); + } + } - for (j = 0; j < ET_RX_NDESC; ++j) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &rbd->rbd_buf[j].rb_dmap); - if (error) { - device_printf(dev, "can't create %d RX mbuf " - "for %d RX ring\n", j, i); - rx_done[i] = j; - et_dma_mbuf_destroy(dev, 0, rx_done); - return (error); - } + /* Create a spare DMA map for mini RX buffers, ring 0. */ + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &sc->sc_rx_mini_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for mini RX mbuf\n"); + return (error); + } + + /* Initialize RX ring 1. */ + rbd = &sc->sc_rx_data[1]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING1_2048; + rbd->rbd_newbuf = et_newbuf_cluster; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[1]; + /* Create DMA maps for standard RX buffers, ring 1. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); } - rx_done[i] = ET_RX_NDESC; + } - rbd->rbd_softc = sc; - rbd->rbd_ring = &sc->sc_rx_ring[i]; + /* Create a spare DMA map for standard RX buffers, ring 1. */ + error = bus_dmamap_create(sc->sc_rx_tag, 0, &sc->sc_rx_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for RX mbuf\n"); + return (error); } - /* - * Create DMA maps for TX mbufs - */ - for (i = 0; i < ET_TX_NDESC; ++i) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &tbd->tbd_buf[i].tb_dmap); + /* Create DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_tx_tag, 0, + &tbd->tbd_buf[i].tb_dmap); if (error) { - device_printf(dev, "can't create %d TX mbuf " - "DMA map\n", i); - et_dma_mbuf_destroy(dev, i, rx_done); + device_printf(sc->dev, + "could not create DMA map for TX mbufs\n"); return (error); } } @@ -940,106 +940,97 @@ et_dma_mbuf_create(device_t dev) } static void -et_dma_mbuf_destroy(device_t dev, int tx_done, const int rx_done[]) +et_dma_free(struct et_softc *sc) { - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_txstatus_data *txsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; int i; - if (sc->sc_mbuf_dtag == NULL) - return; - - /* - * Destroy DMA maps for RX mbufs - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; - - for (j = 0; j < rx_done[i]; ++j) { - struct et_rxbuf *rb = &rbd->rbd_buf[j]; - - KASSERT(rb->rb_mbuf == NULL, - ("RX mbuf in %d RX ring is not freed yet\n", i)); - bus_dmamap_destroy(sc->sc_mbuf_dtag, rb->rb_dmap); + /* Destroy DMA maps for mini RX buffers, ring 0. */ + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; } } - - /* - * Destroy DMA maps for TX mbufs - */ - for (i = 0; i < tx_done; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - - KASSERT(tb->tb_mbuf == NULL, ("TX mbuf is not freed yet\n")); - bus_dmamap_destroy(sc->sc_mbuf_dtag, tb->tb_dmap); + if (sc->sc_rx_mini_sparemap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, sc->sc_rx_mini_sparemap); + sc->sc_rx_mini_sparemap = NULL; } - - /* - * Destroy spare mbuf DMA map - */ - bus_dmamap_destroy(sc->sc_mbuf_dtag, sc->sc_mbuf_tmp_dmap); - - /* - * Destroy mbuf DMA tag - */ - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; -} - -static int -et_dma_mem_create(device_t dev, bus_size_t size, bus_dma_tag_t *dtag, - void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap) -{ - struct et_softc *sc = device_get_softc(dev); - int error; - - error = bus_dma_tag_create(sc->sc_dtag, ET_ALIGN, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - size, 1, BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); - return (error); + if (sc->sc_rx_mini_tag) { + bus_dma_tag_destroy(sc->sc_rx_mini_tag); + sc->sc_rx_mini_tag = NULL; } - error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, - dmap); - if (error) { - device_printf(dev, "can't allocate DMA mem\n"); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + /* Destroy DMA maps for standard RX buffers, ring 1. */ + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; + } } - - error = bus_dmamap_load(*dtag, *dmap, *addr, size, - et_dma_ring_addr, paddr, BUS_DMA_WAITOK); - if (error) { - device_printf(dev, "can't load DMA mem\n"); - bus_dmamem_free(*dtag, *addr, *dmap); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + if (sc->sc_rx_sparemap) { + bus_dmamap_destroy(sc->sc_rx_tag, sc->sc_rx_sparemap); + sc->sc_rx_sparemap = NULL; + } + if (sc->sc_rx_tag) { + bus_dma_tag_destroy(sc->sc_rx_tag); + sc->sc_rx_tag = NULL; } - return (0); -} -static void -et_dma_mem_destroy(bus_dma_tag_t dtag, void *addr, bus_dmamap_t dmap) -{ - if (dtag != NULL) { - bus_dmamap_unload(dtag, dmap); - bus_dmamem_free(dtag, addr, dmap); - bus_dma_tag_destroy(dtag); + /* Destroy DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + if (tbd->tbd_buf[i].tb_dmap) { + bus_dmamap_destroy(sc->sc_tx_tag, + tbd->tbd_buf[i].tb_dmap); + tbd->tbd_buf[i].tb_dmap = NULL; + } + } + if (sc->sc_tx_tag) { + bus_dma_tag_destroy(sc->sc_tx_tag); + sc->sc_tx_tag = NULL; } -} -static void -et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - KASSERT(nseg == 1, ("too many segments\n")); - *((bus_addr_t *)arg) = seg->ds_addr; + /* Destroy mini RX ring, ring 0. */ + rx_ring = &sc->sc_rx_ring[0]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy standard RX ring, ring 1. */ + rx_ring = &sc->sc_rx_ring[1]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy RX status block. */ + rxsd = &sc->sc_rx_status; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy TX ring. */ + tx_ring = &sc->sc_tx_ring; + et_dma_ring_free(sc, &tx_ring->tr_dtag, (void *)&tx_ring->tr_desc, + &tx_ring->tr_dmap); + /* Destroy TX status block. */ + txsd = &sc->sc_tx_status; + et_dma_ring_free(sc, &txsd->txsd_dtag, (void *)&txsd->txsd_status, + &txsd->txsd_dmap); + + /* Destroy the parent tag. */ + if (sc->sc_dtag) { + bus_dma_tag_destroy(sc->sc_dtag); + sc->sc_dtag = NULL; + } } static void @@ -1117,30 +1108,21 @@ back: static void et_init_locked(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const struct et_bsize *arr; - int error, i; + struct ifnet *ifp; + int error; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; et_stop(sc); - arr = et_bufsize_std; - for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; - } - - error = et_init_tx_ring(sc); - if (error) - goto back; - + et_init_tx_ring(sc); error = et_init_rx_ring(sc); if (error) - goto back; + return; error = et_chip_init(sc); if (error) @@ -1313,20 +1295,26 @@ et_start(struct ifnet *ifp) ET_UNLOCK(sc); } -static void +static int et_watchdog(struct et_softc *sc) { + uint32_t status; + ET_LOCK_ASSERT(sc); if (sc->watchdog_timer == 0 || --sc->watchdog_timer) - return; + return (0); - if_printf(sc->ifp, "watchdog timed out\n"); + bus_dmamap_sync(sc->sc_tx_status.txsd_dtag, sc->sc_tx_status.txsd_dmap, + BUS_DMASYNC_POSTREAD); + status = le32toh(*(sc->sc_tx_status.txsd_status)); + if_printf(sc->ifp, "watchdog timed out (0x%08x) -- resetting\n", + status); sc->ifp->if_oerrors++; sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); - et_start_locked(sc->ifp); + return (EJUSTRETURN); } static int @@ -1354,49 +1342,59 @@ et_stop_txdma(struct et_softc *sc) static void et_free_tx_ring(struct et_softc *sc) { - struct et_txbuf_data *tbd = &sc->sc_tx_data; - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txbuf *tb; int i; + tbd = &sc->sc_tx_data; + tx_ring = &sc->sc_tx_ring; for (i = 0; i < ET_TX_NDESC; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - + tb = &tbd->tbd_buf[i]; if (tb->tb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_tx_tag, tb->tb_dmap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_mbuf_dtag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; } } - - bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); } static void et_free_rx_ring(struct et_softc *sc) { - int n; - - for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[n]; - int i; - - for (i = 0; i < ET_RX_NDESC; ++i) { - struct et_rxbuf *rb = &rbd->rbd_buf[i]; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxbuf *rb; + int i; - if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, - rb->rb_dmap); - m_freem(rb->rb_mbuf); - rb->rb_mbuf = NULL; - } + /* Ring 0 */ + rx_ring = &sc->sc_rx_ring[0]; + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_mini_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_mini_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; } + } - bzero(rx_ring->rr_desc, ET_RX_RING_SIZE); - bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, - BUS_DMASYNC_PREWRITE); + /* Ring 1 */ + rx_ring = &sc->sc_rx_ring[1]; + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; + } } } @@ -1523,40 +1521,41 @@ et_chip_init(struct et_softc *sc) return (0); } -static int +static void et_init_tx_ring(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + tx_ring = &sc->sc_tx_ring; bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); + tbd = &sc->sc_tx_data; tbd->tbd_start_index = 0; tbd->tbd_start_wrap = 0; tbd->tbd_used = 0; + txsd = &sc->sc_tx_status; bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, - BUS_DMASYNC_PREWRITE); - return (0); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int et_init_rx_ring(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - int n; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxbuf_data *rbd; + int i, error, n; for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - int i, error; - + rbd = &sc->sc_rx_data[n]; for (i = 0; i < ET_RX_NDESC; ++i) { - error = rbd->rbd_newbuf(rbd, i, 1); + error = rbd->rbd_newbuf(rbd, i); if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); @@ -1565,37 +1564,19 @@ et_init_rx_ring(struct et_softc *sc) } } + rxsd = &sc->sc_rx_status; bzero(rxsd->rxsd_status, sizeof(struct et_rxstatus)); bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + rxst_ring = &sc->sc_rxstat_ring; bzero(rxst_ring->rsr_stat, ET_RXSTAT_RING_SIZE); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } -static void -et_dma_buf_addr(void *xctx, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsz __unused, int error) -{ - struct et_dmamap_ctx *ctx = xctx; - int i; - - if (error) - return; - - if (nsegs > ctx->nsegs) { - ctx->nsegs = 0; - return; - } - - ctx->nsegs = nsegs; - for (i = 0; i < nsegs; ++i) - ctx->segs[i] = segs[i]; -} - static int et_init_rxdma(struct et_softc *sc) { @@ -1933,13 +1914,20 @@ et_enable_txrx(struct et_softc *sc, int static void et_rxeof(struct et_softc *sc) { - struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring, rxst_info2; - int rxst_wrap, rxst_index; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat *st; + struct ifnet *ifp; + struct mbuf *m; + uint32_t rxstat_pos, rxring_pos; + uint32_t rxst_info1, rxst_info2, rxs_stat_ring; + int buflen, buf_idx, npost[2], ring_idx; + int rxst_index, rxst_wrap; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; rxsd = &sc->sc_rx_status; rxst_ring = &sc->sc_rxstat_ring; @@ -1948,26 +1936,24 @@ et_rxeof(struct et_softc *sc) return; bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 19:26:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 831E21065672; Fri, 6 Jan 2012 19:26:31 +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 6B10B8FC08; Fri, 6 Jan 2012 19:26:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06JQVKQ004070; Fri, 6 Jan 2012 19:26:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JQVsU004066; Fri, 6 Jan 2012 19:26:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061926.q06JQVsU004066@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:26:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229721 - stable/8/sys/dev/et X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 19:26:31 -0000 Author: yongari Date: Fri Jan 6 19:26:31 2012 New Revision: 229721 URL: http://svn.freebsd.org/changeset/base/229721 Log: MFC r228326-228327,228331-228332: r228326: Controller does not require TX start command for every frame. So send a single TX command after setting up all TX frames. This removes unnecessary register accesses and bus_dmamap_sync(9) calls. et(4) uses TX interrupt moderation so it's possible to have TX buffers that were already transmitted but waiting for TX completion interrupt. If the number of available TX descriptor is less then 1/3 of total TX descriptor, try reclaiming first to get enough free TX descriptors before setting up TX descriptors. After r228325, et_txeof() no longer tries to send frames after reclaiming TX buffers. That change was made to give more chance to transmit frames in main interrupt handler since we can still send frames in interrupt handler with RX interrupt. So right before exiting interrupt hander, after enabling interrupt, try to send more frames. This gives slightly better performance numbers. While I'm here reduce number of spare TX descriptors from 8 to 4. Controller does not require reserved TX descriptors, it was just to reduce TX overhead. After r228325, driver has much lower TX overhead so it does not make sense to reserve 8 TX descriptors. r228327: Remove et_enable_intrs(), et_disable_intrs() functions and manipulation of interrupt register access is done through CSR_WRITE_4 macro. Also add disabling interrupt into et_reset() because we want interrupt disabled state after controller reset. While I'm here slightly change interrupt handler to be more readable one. r228331: Rework link state tracking and TX/RX MAC configuration. o Do not report link status if driver is not running. o TX/RX MAC configuration should be done with resolved speed, duplex and flow control after establishing a link so it can't be done in driver initialization routine. Move the configuration to miibus_statchg callback which will be called whenever any link state change is detected. At this moment, flow-control is not enabled yet mainly because I was not able to set correct flow control parameters to generate TX pause frames. o Now TX/RX MAC is enabled only when a valid link is detected. Rearragnge hardware initialization routine a bit to leave enabling MAC to miibus_statchg callback. In order to that, TX/RX DMA engine is enabled in et_init_locked(). o Introduce ET_FLAG_LINK flag to track current link state. o Introduce ET_FLAG_FASTETHER flag to mark whether controller is fast ethernet. This flag is checked in miibus_statchg callback to know whether PHY established a valid link. o In et_stop(), TX/RX MAC is explicitly disabled instead of relying on et_reset(). And move et_reset() from et_stop() to controller initialization. Controler reset is not required here and it would also clear critial registers(i.e station address, RX filter configuration, WOL etc) that are required to make WOL work. o Switching to current media is done in et_init_locked() after setting IFF_DRV_RUNNING flag. This should ensure reliable auto-negotiation/manual link establishment. o In et_start_locked(), check whether driver got a valid link before trying to send frames. o Remove checking a link in et_tick() as this is done by miibus_statchg callback. r228332: Implement hardware MAC statistics counter. Counters could be queried with dev.et.%d.stats sysctl node where %d is an instance of device. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etreg.h stable/8/sys/dev/et/if_etvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 19:24:33 2012 (r229720) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 19:26:31 2012 (r229721) @@ -110,8 +110,6 @@ static int et_sysctl_rx_intr_npkts(SYSCT static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS); static void et_intr(void *); -static void et_enable_intrs(struct et_softc *, uint32_t); -static void et_disable_intrs(struct et_softc *); static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); @@ -144,13 +142,12 @@ static int et_start_rxdma(struct et_soft static int et_start_txdma(struct et_softc *); static int et_stop_rxdma(struct et_softc *); static int et_stop_txdma(struct et_softc *); -static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); -static void et_setmedia(struct et_softc *); +static void et_stats_update(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -302,6 +299,9 @@ et_attach(device_t dev) goto fail; } + if (pci_get_device(dev) == PCI_PRODUCT_LUCENT_ET1310_FAST) + sc->sc_flags |= ET_FLAG_FASTETHER; + error = et_bus_config(sc); if (error) goto fail; @@ -313,8 +313,6 @@ et_attach(device_t dev) et_reset(sc); - et_disable_intrs(sc); - error = et_dma_alloc(sc); if (error) goto fail; @@ -495,7 +493,89 @@ et_miibus_writereg(device_t dev, int phy static void et_miibus_statchg(device_t dev) { - et_setmedia(device_get_softc(dev)); + struct et_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t cfg1, cfg2, ctrl; + int i; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->sc_miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sc_flags &= ~ET_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->sc_flags |= ET_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + sc->sc_flags |= ET_FLAG_LINK; + break; + } + } + + /* XXX Stop TX/RX MAC? */ + if ((sc->sc_flags & ET_FLAG_LINK) == 0) + return; + + /* Program MACs with resolved speed/duplex/flow-control. */ + ctrl = CSR_READ_4(sc, ET_MAC_CTRL); + ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + cfg1 &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | + ET_MAC_CFG1_LOOPBACK); + cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); + cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | + ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); + cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + cfg2 |= ET_MAC_CFG2_MODE_GMII; + else { + cfg2 |= ET_MAC_CFG2_MODE_MII; + ctrl |= ET_MAC_CTRL_MODE_MII; + } + + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { + cfg2 |= ET_MAC_CFG2_FDX; +#ifdef notyet + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) + cfg1 |= ET_MAC_CFG1_TXFLOW; + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) + cfg1 |= ET_MAC_CFG1_RXFLOW; +#endif + } else + ctrl |= ET_MAC_CTRL_GHDX; + + CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); + CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + cfg1 |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; + CSR_WRITE_4(sc, ET_MAC_CFG1, cfg1); + +#define NRETRY 50 + + for (i = 0; i < NRETRY; ++i) { + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + if ((cfg1 & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == + (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) + break; + DELAY(100); + } + if (i == NRETRY) + if_printf(ifp, "can't enable RX/TX\n"); + sc->sc_flags |= ET_FLAG_TXRX_ENABLED; + +#undef NRETRY } static int @@ -526,10 +606,17 @@ et_ifmedia_upd(struct ifnet *ifp) static void et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; + sc = ifp->if_softc; ET_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ET_UNLOCK(sc); + return; + } + + mii = device_get_softc(sc->sc_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -544,17 +631,20 @@ et_stop(struct et_softc *sc) ET_LOCK_ASSERT(sc); callout_stop(&sc->sc_tick); + /* Disable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); + + CSR_WRITE_4(sc, ET_MAC_CFG1, CSR_READ_4(sc, ET_MAC_CFG1) & ~( + ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN)); + DELAY(100); et_stop_rxdma(sc); et_stop_txdma(sc); - - et_disable_intrs(sc); + et_stats_update(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); - et_reset(sc); - sc->sc_tx = 0; sc->sc_tx_intr = 0; sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; @@ -674,20 +764,10 @@ et_reset(struct et_softc *sc) ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC); CSR_WRITE_4(sc, ET_MAC_CFG1, 0); -} - -static void -et_disable_intrs(struct et_softc *sc) -{ + /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -static void -et_enable_intrs(struct et_softc *sc, uint32_t intrs) -{ - CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); -} - struct et_dmamap_arg { bus_addr_t et_busaddr; }; @@ -1087,12 +1167,12 @@ et_intr(void *xsc) return; } - et_disable_intrs(sc); + /* Disable further interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); intrs = CSR_READ_4(sc, ET_INTR_STATUS); - intrs &= ET_INTRS; - if (intrs == 0) /* Not interested */ - goto back; + if ((intrs & ET_INTRS) == 0) + goto done; if (intrs & ET_INTR_RXEOF) et_rxeof(sc); @@ -1100,8 +1180,12 @@ et_intr(void *xsc) et_txeof(sc); if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -back: - et_enable_intrs(sc, ET_INTRS); +done: + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + et_start_locked(ifp); + } ET_UNLOCK(sc); } @@ -1118,6 +1202,7 @@ et_init_locked(struct et_softc *sc) return; et_stop(sc); + et_reset(sc); et_init_tx_ring(sc); error = et_init_rx_ring(sc); @@ -1126,21 +1211,33 @@ et_init_locked(struct et_softc *sc) error = et_chip_init(sc); if (error) - goto back; + goto fail; - error = et_enable_txrx(sc, 1); + /* + * Start TX/RX DMA engine + */ + error = et_start_rxdma(sc); if (error) - goto back; + return; - et_enable_intrs(sc, ET_INTRS); + error = et_start_txdma(sc); + if (error) + return; - callout_reset(&sc->sc_tick, hz, et_tick, sc); + /* Enable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -back: + + sc->sc_flags &= ~ET_FLAG_LINK; + et_ifmedia_upd_locked(ifp); + + callout_reset(&sc->sc_tick, hz, et_tick, sc); + +fail: if (error) et_stop(sc); } @@ -1244,19 +1341,32 @@ et_start_locked(struct ifnet *ifp) { struct et_softc *sc; struct mbuf *m_head = NULL; + struct et_txdesc_ring *tx_ring; struct et_txbuf_data *tbd; + uint32_t tx_ready_pos; int enq; sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) - return; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || + (sc->sc_flags & (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) != + (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) return; + /* + * Driver does not request TX completion interrupt for every + * queued frames to prevent generating excessive interrupts. + * This means driver may wait for TX completion interrupt even + * though some frames were sucessfully transmitted. Reclaiming + * transmitted frames will ensure driver see all available + * descriptors. + */ tbd = &sc->sc_tx_data; + if (tbd->tbd_used > (ET_TX_NDESC * 2) / 3) + et_txeof(sc); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1281,8 +1391,17 @@ et_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (enq > 0) + if (enq > 0) { + tx_ring = &sc->sc_tx_ring; + bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, + BUS_DMASYNC_PREWRITE); + tx_ready_pos = tx_ring->tr_ready_index & + ET_TX_READY_POS_INDEX_MASK; + if (tx_ring->tr_ready_wrap) + tx_ready_pos |= ET_TX_READY_POS_WRAP; + CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); sc->watchdog_timer = 5; + } } static void @@ -1861,56 +1980,6 @@ et_start_txdma(struct et_softc *sc) return (0); } -static int -et_enable_txrx(struct et_softc *sc, int media_upd) -{ - struct ifnet *ifp = sc->ifp; - uint32_t val; - int i, error; - - val = CSR_READ_4(sc, ET_MAC_CFG1); - val |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; - val &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | - ET_MAC_CFG1_LOOPBACK); - CSR_WRITE_4(sc, ET_MAC_CFG1, val); - - if (media_upd) - et_ifmedia_upd_locked(ifp); - else - et_setmedia(sc); - -#define NRETRY 50 - - for (i = 0; i < NRETRY; ++i) { - val = CSR_READ_4(sc, ET_MAC_CFG1); - if ((val & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == - (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) - break; - - DELAY(100); - } - if (i == NRETRY) { - if_printf(ifp, "can't enable RX/TX\n"); - return (0); - } - sc->sc_flags |= ET_FLAG_TXRX_ENABLED; - -#undef NRETRY - - /* - * Start TX/RX DMA engine - */ - error = et_start_rxdma(sc); - if (error) - return (error); - - error = et_start_txdma(sc); - if (error) - return (error); - - return (0); -} - static void et_rxeof(struct et_softc *sc) { @@ -1986,7 +2055,6 @@ et_rxeof(struct et_softc *sc) m = rbd->rbd_buf[buf_idx].rb_mbuf; if ((rxst_info1 & ET_RXST_INFO1_OK) == 0){ /* Discard errored frame. */ - ifp->if_ierrors++; rbd->rbd_discard(rbd, buf_idx); } else if (rbd->rbd_newbuf(rbd, buf_idx) != 0) { /* No available mbufs, discard it. */ @@ -2000,7 +2068,6 @@ et_rxeof(struct et_softc *sc) } else { m->m_pkthdr.len = m->m_len = buflen; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); ET_LOCK(sc); @@ -2040,7 +2107,7 @@ et_encap(struct et_softc *sc, struct mbu struct mbuf *m; bus_dma_segment_t segs[ET_NSEG_MAX]; bus_dmamap_t map; - uint32_t csum_flags, last_td_ctrl2, tx_ready_pos; + uint32_t csum_flags, last_td_ctrl2; int error, i, idx, first_idx, last_idx, nsegs; tx_ring = &sc->sc_tx_ring; @@ -2125,12 +2192,6 @@ et_encap(struct et_softc *sc, struct mbu tbd->tbd_used += nsegs; MPASS(tbd->tbd_used <= ET_TX_NDESC); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); - tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; - if (tx_ring->tr_ready_wrap) - tx_ready_pos |= ET_TX_READY_POS_WRAP; - CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); return (0); } @@ -2172,7 +2233,6 @@ et_txeof(struct et_softc *sc) bus_dmamap_unload(sc->sc_tx_tag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; - ifp->if_opackets++; } if (++tbd->tbd_start_index == ET_TX_NDESC) { @@ -2189,6 +2249,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE < ET_TX_NDESC) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } + static void et_tick(void *xsc) { @@ -2201,13 +2262,7 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0 && - (mii->mii_media_status & IFM_ACTIVE) && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - if_printf(ifp, "Link up, enable TX/RX\n"); - if (et_enable_txrx(sc, 0) == 0) - et_start_locked(ifp); - } + et_stats_update(sc); if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2320,6 +2375,11 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, return (0); } +#define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) +#define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + /* * Create sysctl tree */ @@ -2327,7 +2387,9 @@ static void et_add_sysctls(struct et_softc * sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *parent; + struct sysctl_oid *tree; + struct et_hw_stats *stats; ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2343,8 +2405,116 @@ et_add_sysctls(struct et_softc * sc) "TX IM, # segments per TX interrupt"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "timer", CTLFLAG_RW, &sc->sc_timer, 0, "TX timer"); + + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "ET statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* TX/RX statistics. */ + stats = &sc->sc_stats; + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_64", &stats->pkts_64, + "0 to 64 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_65_127", &stats->pkts_65, + "65 to 127 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_128_255", &stats->pkts_128, + "128 to 255 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_256_511", &stats->pkts_256, + "256 to 511 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_512_1023", &stats->pkts_512, + "512 to 1023 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1024_1518", &stats->pkts_1024, + "1024 to 1518 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1519_1522", &stats->pkts_1519, + "1519 to 1522 bytes frames"); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->rx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->rx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->rx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->rx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->rx_control, "Control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->rx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "unknown_control", + &stats->rx_unknown_control, "Unknown control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + ET_SYSCTL_STAT_ADD32(ctx, children, "code_errs", + &stats->rx_codeerrs, "Frames with code error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "cs_errs", + &stats->rx_cserrs, "Frames with carrier sense error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "runts", + &stats->rx_runts, "Too short frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->rx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->rx_fragments, "Fragmented frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->rx_jabbers, "Frames with jabber error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->rx_drop, "Dropped frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->tx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->tx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->tx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->tx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->tx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "deferred", + &stats->tx_deferred, "Deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_deferred", + &stats->tx_excess_deferred, "Excessively deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "single_colls", + &stats->tx_single_colls, "Single collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "multi_colls", + &stats->tx_multi_colls, "Multiple collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "late_colls", + &stats->tx_late_colls, "Late collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_colls", + &stats->tx_excess_colls, "Excess collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "total_colls", + &stats->tx_total_colls, "Total collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause_honored", + &stats->tx_pause_honored, "Honored pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->tx_drop, "Dropped frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->tx_jabbers, "Frames with jabber errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->tx_crcerrs, "Frames with CRC errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->tx_control, "Control frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->tx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "undersize", + &stats->tx_undersize, "Undersized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->tx_fragments, "Fragmented frames"); } +#undef ET_SYSCTL_STAT_ADD32 +#undef ET_SYSCTL_STAT_ADD64 + static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { @@ -2396,35 +2566,70 @@ back: } static void -et_setmedia(struct et_softc *sc) +et_stats_update(struct et_softc *sc) { - struct mii_data *mii = device_get_softc(sc->sc_miibus); - uint32_t cfg2, ctrl; - - cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); - cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | - ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); - cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & - ET_MAC_CFG2_PREAMBLE_LEN_MASK); - - ctrl = CSR_READ_4(sc, ET_MAC_CTRL); - ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); - - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { - cfg2 |= ET_MAC_CFG2_MODE_GMII; - } else { - cfg2 |= ET_MAC_CFG2_MODE_MII; - ctrl |= ET_MAC_CTRL_MODE_MII; - } + struct ifnet *ifp; + struct et_hw_stats *stats; - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - cfg2 |= ET_MAC_CFG2_FDX; - else - ctrl |= ET_MAC_CTRL_GHDX; + stats = &sc->sc_stats; + stats->pkts_64 += CSR_READ_4(sc, ET_STAT_PKTS_64); + stats->pkts_65 += CSR_READ_4(sc, ET_STAT_PKTS_65_127); + stats->pkts_128 += CSR_READ_4(sc, ET_STAT_PKTS_128_255); + stats->pkts_256 += CSR_READ_4(sc, ET_STAT_PKTS_256_511); + stats->pkts_512 += CSR_READ_4(sc, ET_STAT_PKTS_512_1023); + stats->pkts_1024 += CSR_READ_4(sc, ET_STAT_PKTS_1024_1518); + stats->pkts_1519 += CSR_READ_4(sc, ET_STAT_PKTS_1519_1522); + + stats->rx_bytes += CSR_READ_4(sc, ET_STAT_RX_BYTES); + stats->rx_frames += CSR_READ_4(sc, ET_STAT_RX_FRAMES); + stats->rx_crcerrs += CSR_READ_4(sc, ET_STAT_RX_CRC_ERR); + stats->rx_mcast += CSR_READ_4(sc, ET_STAT_RX_MCAST); + stats->rx_bcast += CSR_READ_4(sc, ET_STAT_RX_BCAST); + stats->rx_control += CSR_READ_4(sc, ET_STAT_RX_CTL); + stats->rx_pause += CSR_READ_4(sc, ET_STAT_RX_PAUSE); + stats->rx_unknown_control += CSR_READ_4(sc, ET_STAT_RX_UNKNOWN_CTL); + stats->rx_alignerrs += CSR_READ_4(sc, ET_STAT_RX_ALIGN_ERR); + stats->rx_lenerrs += CSR_READ_4(sc, ET_STAT_RX_LEN_ERR); + stats->rx_codeerrs += CSR_READ_4(sc, ET_STAT_RX_CODE_ERR); + stats->rx_cserrs += CSR_READ_4(sc, ET_STAT_RX_CS_ERR); + stats->rx_runts += CSR_READ_4(sc, ET_STAT_RX_RUNT); + stats->rx_oversize += CSR_READ_4(sc, ET_STAT_RX_OVERSIZE); + stats->rx_fragments += CSR_READ_4(sc, ET_STAT_RX_FRAG); + stats->rx_jabbers += CSR_READ_4(sc, ET_STAT_RX_JABBER); + stats->rx_drop += CSR_READ_4(sc, ET_STAT_RX_DROP); + + stats->tx_bytes += CSR_READ_4(sc, ET_STAT_TX_BYTES); + stats->tx_frames += CSR_READ_4(sc, ET_STAT_TX_FRAMES); + stats->tx_mcast += CSR_READ_4(sc, ET_STAT_TX_MCAST); + stats->tx_bcast += CSR_READ_4(sc, ET_STAT_TX_BCAST); + stats->tx_pause += CSR_READ_4(sc, ET_STAT_TX_PAUSE); + stats->tx_deferred += CSR_READ_4(sc, ET_STAT_TX_DEFER); + stats->tx_excess_deferred += CSR_READ_4(sc, ET_STAT_TX_EXCESS_DEFER); + stats->tx_single_colls += CSR_READ_4(sc, ET_STAT_TX_SINGLE_COL); + stats->tx_multi_colls += CSR_READ_4(sc, ET_STAT_TX_MULTI_COL); + stats->tx_late_colls += CSR_READ_4(sc, ET_STAT_TX_LATE_COL); + stats->tx_excess_colls += CSR_READ_4(sc, ET_STAT_TX_EXCESS_COL); + stats->tx_total_colls += CSR_READ_4(sc, ET_STAT_TX_TOTAL_COL); + stats->tx_pause_honored += CSR_READ_4(sc, ET_STAT_TX_PAUSE_HONOR); + stats->tx_drop += CSR_READ_4(sc, ET_STAT_TX_DROP); + stats->tx_jabbers += CSR_READ_4(sc, ET_STAT_TX_JABBER); + stats->tx_crcerrs += CSR_READ_4(sc, ET_STAT_TX_CRC_ERR); + stats->tx_control += CSR_READ_4(sc, ET_STAT_TX_CTL); + stats->tx_oversize += CSR_READ_4(sc, ET_STAT_TX_OVERSIZE); + stats->tx_undersize += CSR_READ_4(sc, ET_STAT_TX_UNDERSIZE); + stats->tx_fragments += CSR_READ_4(sc, ET_STAT_TX_FRAG); - CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); - CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + /* Update ifnet counters. */ + ifp = sc->ifp; + ifp->if_opackets = (u_long)stats->tx_frames; + ifp->if_collisions = stats->tx_total_colls; + ifp->if_oerrors = stats->tx_drop + stats->tx_jabbers + + stats->tx_crcerrs + stats->tx_excess_deferred + + stats->tx_late_colls; + ifp->if_ipackets = (u_long)stats->rx_frames; + ifp->if_ierrors = stats->rx_crcerrs + stats->rx_alignerrs + + stats->rx_lenerrs + stats->rx_codeerrs + stats->rx_cserrs + + stats->rx_runts + stats->rx_jabbers + stats->rx_drop; } static int Modified: stable/8/sys/dev/et/if_etreg.h ============================================================================== --- stable/8/sys/dev/et/if_etreg.h Fri Jan 6 19:24:33 2012 (r229720) +++ stable/8/sys/dev/et/if_etreg.h Fri Jan 6 19:26:31 2012 (r229721) @@ -318,6 +318,52 @@ #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 +/* MAC statistics counters. */ +#define ET_STAT_PKTS_64 0x6080 +#define ET_STAT_PKTS_65_127 0x6084 +#define ET_STAT_PKTS_128_255 0x6088 +#define ET_STAT_PKTS_256_511 0x608C +#define ET_STAT_PKTS_512_1023 0x6090 +#define ET_STAT_PKTS_1024_1518 0x6094 +#define ET_STAT_PKTS_1519_1522 0x6098 +#define ET_STAT_RX_BYTES 0x609C +#define ET_STAT_RX_FRAMES 0x60A0 +#define ET_STAT_RX_CRC_ERR 0x60A4 +#define ET_STAT_RX_MCAST 0x60A8 +#define ET_STAT_RX_BCAST 0x60AC +#define ET_STAT_RX_CTL 0x60B0 +#define ET_STAT_RX_PAUSE 0x60B4 +#define ET_STAT_RX_UNKNOWN_CTL 0x60B8 +#define ET_STAT_RX_ALIGN_ERR 0x60BC +#define ET_STAT_RX_LEN_ERR 0x60C0 +#define ET_STAT_RX_CODE_ERR 0x60C4 +#define ET_STAT_RX_CS_ERR 0x60C8 +#define ET_STAT_RX_RUNT 0x60CC +#define ET_STAT_RX_OVERSIZE 0x60D0 +#define ET_STAT_RX_FRAG 0x60D4 +#define ET_STAT_RX_JABBER 0x60D8 +#define ET_STAT_RX_DROP 0x60DC +#define ET_STAT_TX_BYTES 0x60E0 +#define ET_STAT_TX_FRAMES 0x60E4 +#define ET_STAT_TX_MCAST 0x60E8 +#define ET_STAT_TX_BCAST 0x60EC +#define ET_STAT_TX_PAUSE 0x60F0 +#define ET_STAT_TX_DEFER 0x60F4 +#define ET_STAT_TX_EXCESS_DEFER 0x60F8 +#define ET_STAT_TX_SINGLE_COL 0x60FC +#define ET_STAT_TX_MULTI_COL 0x6100 +#define ET_STAT_TX_LATE_COL 0x6104 +#define ET_STAT_TX_EXCESS_COL 0x6108 +#define ET_STAT_TX_TOTAL_COL 0x610C +#define ET_STAT_TX_PAUSE_HONOR 0x6110 +#define ET_STAT_TX_DROP 0x6114 +#define ET_STAT_TX_JABBER 0x6118 +#define ET_STAT_TX_CRC_ERR 0x611C +#define ET_STAT_TX_CTL 0x6120 +#define ET_STAT_TX_OVERSIZE 0x6124 +#define ET_STAT_TX_UNDERSIZE 0x6128 +#define ET_STAT_TX_FRAG 0x612C + #define ET_MMC_CTRL 0x7000 #define ET_MMC_CTRL_ENABLE 0x00000001 #define ET_MMC_CTRL_ARB_DISABLE 0x00000002 Modified: stable/8/sys/dev/et/if_etvar.h ============================================================================== --- stable/8/sys/dev/et/if_etvar.h Fri Jan 6 19:24:33 2012 (r229720) +++ stable/8/sys/dev/et/if_etvar.h Fri Jan 6 19:26:31 2012 (r229721) @@ -41,7 +41,7 @@ #define ET_RING_ALIGN 4096 #define ET_STATUS_ALIGN 8 #define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 8 +#define ET_NSEG_SPARE 4 #define ET_TX_NDESC 512 #define ET_RX_NDESC 512 @@ -231,6 +231,56 @@ struct et_rxbuf_data { void (*rbd_discard)(struct et_rxbuf_data *, int); }; +struct et_hw_stats { + /* RX/TX stats. */ + uint64_t pkts_64; + uint64_t pkts_65; + uint64_t pkts_128; + uint64_t pkts_256; + uint64_t pkts_512; + uint64_t pkts_1024; + uint64_t pkts_1519; + /* RX stats. */ + uint64_t rx_bytes; + uint64_t rx_frames; + uint32_t rx_crcerrs; + uint64_t rx_mcast; + uint64_t rx_bcast; + uint32_t rx_control; + uint32_t rx_pause; + uint32_t rx_unknown_control; + uint32_t rx_alignerrs; + uint32_t rx_lenerrs; + uint32_t rx_codeerrs; + uint32_t rx_cserrs; + uint32_t rx_runts; + uint64_t rx_oversize; + uint32_t rx_fragments; + uint32_t rx_jabbers; + uint32_t rx_drop; + /* TX stats. */ + uint64_t tx_bytes; + uint64_t tx_frames; + uint64_t tx_mcast; + uint64_t tx_bcast; + uint32_t tx_pause; + uint32_t tx_deferred; + uint32_t tx_excess_deferred; + uint32_t tx_single_colls; + uint32_t tx_multi_colls; + uint32_t tx_late_colls; + uint32_t tx_excess_colls; + uint32_t tx_total_colls; + uint32_t tx_pause_honored; + uint32_t tx_drop; + uint32_t tx_jabbers; + uint32_t tx_crcerrs; + uint32_t tx_control; + uint64_t tx_oversize; + uint32_t tx_undersize; + uint32_t tx_fragments; +}; + struct et_softc { struct ifnet *ifp; device_t dev; @@ -271,6 +321,7 @@ struct et_softc { struct et_rxbuf_data sc_rx_data[ET_RX_NRING]; struct et_txbuf_data sc_tx_data; + struct et_hw_stats sc_stats; uint32_t sc_tx; uint32_t sc_tx_intr; @@ -289,7 +340,9 @@ struct et_softc { #define ET_FLAG_PCIE 0x0001 #define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 #define ET_FLAG_TXRX_ENABLED 0x0100 #define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 19:32:40 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04BFB106585B; Fri, 6 Jan 2012 19:32:40 +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 DF2718FC0A; Fri, 6 Jan 2012 19:32:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06JWd0u004574; Fri, 6 Jan 2012 19:32:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JWdeQ004552; Fri, 6 Jan 2012 19:32:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061932.q06JWdeQ004552@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 19:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229725 - in stable/8: . lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 19:32:40 -0000 Author: jhb Date: Fri Jan 6 19:32:39 2012 New Revision: 229725 URL: http://svn.freebsd.org/changeset/base/229725 Log: MFC 226217,227070,227341,227502: Add the posix_fadvise(2) system call. It is somewhat similar to madvise(2) except that it operates on a file descriptor instead of a memory region. It is currently only supported on regular files. Note that this adds a new VOP, so all filesystem modules must be recompiled. Approved by: re (kib) Added: stable/8/lib/libc/sys/posix_fadvise.2 - copied unchanged from r227070, head/lib/libc/sys/posix_fadvise.2 Modified: stable/8/UPDATING stable/8/lib/libc/sys/Makefile.inc stable/8/lib/libc/sys/Symbol.map stable/8/lib/libc/sys/madvise.2 stable/8/sys/compat/freebsd32/freebsd32_misc.c stable/8/sys/compat/freebsd32/syscalls.master stable/8/sys/kern/syscalls.master stable/8/sys/kern/vfs_default.c stable/8/sys/kern/vfs_subr.c stable/8/sys/kern/vfs_syscalls.c stable/8/sys/kern/vfs_vnops.c stable/8/sys/kern/vnode_if.src stable/8/sys/sys/fcntl.h stable/8/sys/sys/file.h stable/8/sys/sys/param.h stable/8/sys/sys/syscallsubr.h stable/8/sys/sys/unistd.h stable/8/sys/sys/vnode.h stable/8/sys/vm/vm_object.c stable/8/sys/vm/vm_object.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/UPDATING Fri Jan 6 19:32:39 2012 (r229725) @@ -15,6 +15,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120106: + A new VOP_ADVISE() was added to support posix_fadvise(2). All + filesystem modules must be recompiled. + +20111116: + A new VOP_ALLOCATE() was added to support posix_fallocate(2). All + filesystem modules must be recompiled. + 20111101: The broken amd(4) driver has been replaced with esp(4) in the amd64, i386 and pc98 GENERIC kernel configuration files. Modified: stable/8/lib/libc/sys/Makefile.inc ============================================================================== --- stable/8/lib/libc/sys/Makefile.inc Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/lib/libc/sys/Makefile.inc Fri Jan 6 19:32:39 2012 (r229725) @@ -86,7 +86,8 @@ MAN+= abort2.2 accept.2 access.2 acct.2 mq_setattr.2 \ msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \ msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \ - pathconf.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \ + pathconf.2 pipe.2 poll.2 posix_fadvise.2 posix_fallocate.2 \ + posix_openpt.2 profil.2 \ pselect.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ rtprio.2 Modified: stable/8/lib/libc/sys/Symbol.map ============================================================================== --- stable/8/lib/libc/sys/Symbol.map Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/lib/libc/sys/Symbol.map Fri Jan 6 19:32:39 2012 (r229725) @@ -364,6 +364,10 @@ FBSD_1.2 { posix_fallocate; }; +FBSD_1.3 { + posix_fadvise; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; Modified: stable/8/lib/libc/sys/madvise.2 ============================================================================== --- stable/8/lib/libc/sys/madvise.2 Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/lib/libc/sys/madvise.2 Fri Jan 6 19:32:39 2012 (r229725) @@ -169,7 +169,8 @@ was specified and the process does not h .Xr mincore 2 , .Xr mprotect 2 , .Xr msync 2 , -.Xr munmap 2 +.Xr munmap 2 , +.Xr posix_fadvise 2 .Sh STANDARDS The .Fn posix_madvise Copied: stable/8/lib/libc/sys/posix_fadvise.2 (from r227070, head/lib/libc/sys/posix_fadvise.2) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libc/sys/posix_fadvise.2 Fri Jan 6 19:32:39 2012 (r229725, copy of r227070, head/lib/libc/sys/posix_fadvise.2) @@ -0,0 +1,139 @@ +.\" Copyright (c) 1991, 1993 +.\" The Regents of the University of California. 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. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. +.\" +.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 +.\" $FreeBSD$ +.\" +.Dd October 26, 2011 +.Dt POSIX_FADVISE 2 +.Os +.Sh NAME +.Nm posix_fadvise +.Nd give advice about use of file data +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In fcntl.h +.Ft int +.Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice" +.Sh DESCRIPTION +The +.Fn posix_fadvise +system call +allows a process to describe to the system its data access behavior for an +open file descriptor +.Fa fd . +The advice covers the data starting at offset +.Fa offset +and continuing for +.Fa len +bytes. +If +.Fa len +is zero, +all data from +.Fa offset +to the end of the file is covered. +.Pp +The behavior is specified by the +.Fa advice +parameter and may be one of: +.Bl -tag -width POSIX_FADV_SEQUENTIAL +.It Dv POSIX_FADV_NORMAL +Tells the system to revert to the default data access behavior. +.It Dv POSIX_FADV_RANDOM +Is a hint that file data will be accessed randomly, +and prefetching is likely not advantageous. +.It Dv POSIX_FADV_SEQUENTIAL +Tells the system that file data will be accessed sequentially. +This currently does nothing as the default behavior uses heuristics to +detect sequential behavior. +.It Dv POSIX_FADV_WILLNEED +Tells the system that the specified data will be accessed in the near future. +The system may initiate an asychronous read of the data if it is not already +present in memory. +.It Dv POSIX_FADV_DONTNEED +Tells the system that the specified data will not be accessed in the near +future. +The system may decrease the in-memory priority of clean data within the +specified range and future access to this data may require a read operation. +.It Dv POSIX_FADV_NOREUSE +Tells the system that the specified data will only be accessed once and +then not reused. +Accesses to data within the specified range are treated as if the file +descriptor has the +.Dv O_DIRECT +flag enabled. +.El +.Pp +.Sh RETURN VALUES +.Rv -std posix_fadvise +.Sh ERRORS +The +.Fn posix_fadvise +system call will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fd +argument is not a valid file descriptor. +.It Bq Er EINVAL +The +.Fa advice +argument is not valid. +.It Bq Er EINVAL +The +.Fa offset +or +.Fa len +arguments are negative, +or +.Fa offset ++ +.Fa len +is greater than the maximum file size. +.It Bq Er ENODEV +The +.Fa fd +argument does not refer to a regular file. +.It Bq Er ESPIPE +The +.Fa fd +argument is associated with a pipe or FIFO. +.El +.Sh SEE ALSO +.Xr madvise 2 +.Sh STANDARDS +The +.Fn posix_fadvise +interface conforms to +.St -p1003.1-2001 . +.Sh HISTORY +The +.Fn posix_fadvise +system call first appeared in +.Fx 10.0 . Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 6 19:32:39 2012 (r229725) @@ -2677,10 +2677,16 @@ int freebsd32_posix_fallocate(struct thread *td, struct freebsd32_posix_fallocate_args *uap) { - struct posix_fallocate_args ap; - ap.fd = uap->fd; - ap.offset = PAIR32TO64(off_t, uap->offset); - ap.len = PAIR32TO64(off_t, uap->len); - return (posix_fallocate(td, &ap)); + return (kern_posix_fallocate(td, uap->fd, + PAIR32TO64(off_t, uap->offset), PAIR32TO64(off_t, uap->len))); +} + +int +freebsd32_posix_fadvise(struct thread *td, + struct freebsd32_posix_fadvise_args *uap) +{ + + return (kern_posix_fadvise(td, uap->fd, PAIR32TO64(off_t, uap->offset), + PAIR32TO64(off_t, uap->len), uap->advice)); } Modified: stable/8/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/8/sys/compat/freebsd32/syscalls.master Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/compat/freebsd32/syscalls.master Fri Jan 6 19:32:39 2012 (r229725) @@ -973,4 +973,7 @@ 530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\ uint32_t offset1, uint32_t offset2,\ uint32_t len1, uint32_t len2); } -531 AUE_NULL UNIMPL posix_fadvise +531 AUE_NULL STD { int freebsd32_posix_fadvise(int fd, \ + uint32_t offset1, uint32_t offset2,\ + uint32_t len1, uint32_t len2, \ + int advice); } Modified: stable/8/sys/kern/syscalls.master ============================================================================== --- stable/8/sys/kern/syscalls.master Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/syscalls.master Fri Jan 6 19:32:39 2012 (r229725) @@ -936,6 +936,7 @@ 529 AUE_NULL UNIMPL rctl_remove_rule 530 AUE_NULL STD { int posix_fallocate(int fd, \ off_t offset, off_t len); } -531 AUE_NULL UNIMPL posix_fadvise +531 AUE_NULL STD { int posix_fadvise(int fd, off_t offset, \ + off_t len, int advice); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: stable/8/sys/kern/vfs_default.c ============================================================================== --- stable/8/sys/kern/vfs_default.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_default.c Fri Jan 6 19:32:39 2012 (r229725) @@ -96,6 +96,7 @@ struct vop_vector default_vnodeops = { .vop_access = vop_stdaccess, .vop_accessx = vop_stdaccessx, + .vop_advise = vop_stdadvise, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, .vop_allocate = vop_stdallocate, @@ -973,6 +974,58 @@ vop_stdallocate(struct vop_allocate_args return (error); } +int +vop_stdadvise(struct vop_advise_args *ap) +{ + struct vnode *vp; + off_t start, end; + int error, vfslocked; + + vp = ap->a_vp; + switch (ap->a_advice) { + case POSIX_FADV_WILLNEED: + /* + * Do nothing for now. Filesystems should provide a + * custom method which starts an asynchronous read of + * the requested region. + */ + error = 0; + break; + case POSIX_FADV_DONTNEED: + /* + * Flush any open FS buffers and then remove pages + * from the backing VM object. Using vinvalbuf() here + * is a bit heavy-handed as it flushes all buffers for + * the given vnode, not just the buffers covering the + * requested range. + */ + error = 0; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if (vp->v_iflag & VI_DOOMED) { + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + break; + } + vinvalbuf(vp, V_CLEANONLY, 0, 0); + if (vp->v_object != NULL) { + start = trunc_page(ap->a_start); + end = round_page(ap->a_end); + VM_OBJECT_LOCK(vp->v_object); + vm_object_page_cache(vp->v_object, OFF_TO_IDX(start), + OFF_TO_IDX(end)); + VM_OBJECT_UNLOCK(vp->v_object); + } + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + break; + default: + error = EINVAL; + break; + } + return (error); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. Modified: stable/8/sys/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_subr.c Fri Jan 6 19:32:39 2012 (r229725) @@ -1194,7 +1194,7 @@ bufobj_invalbuf(struct bufobj *bo, int f do { error = flushbuflist(&bo->bo_clean, flags, bo, slpflag, slptimeo); - if (error == 0) + if (error == 0 && !(flags & V_CLEANONLY)) error = flushbuflist(&bo->bo_dirty, flags, bo, slpflag, slptimeo); if (error != 0 && error != EAGAIN) { @@ -1223,7 +1223,8 @@ bufobj_invalbuf(struct bufobj *bo, int f /* * Destroy the copy in the VM cache, too. */ - if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) { + if (bo->bo_object != NULL && + (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) { VM_OBJECT_LOCK(bo->bo_object); vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ? TRUE : FALSE); @@ -1232,7 +1233,7 @@ bufobj_invalbuf(struct bufobj *bo, int f #ifdef INVARIANTS BO_LOCK(bo); - if ((flags & (V_ALT | V_NORMAL)) == 0 && + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 && (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) panic("vinvalbuf: flush failed"); BO_UNLOCK(bo); Modified: stable/8/sys/kern/vfs_syscalls.c ============================================================================== --- stable/8/sys/kern/vfs_syscalls.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_syscalls.c Fri Jan 6 19:32:39 2012 (r229725) @@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$"); #include #include +static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); + SDT_PROVIDER_DEFINE(vfs); SDT_PROBE_DEFINE(vfs, , stat, mode, mode); SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *"); @@ -4656,7 +4658,7 @@ out: return (error); } -static int +int kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) { struct file *fp; @@ -4750,3 +4752,139 @@ posix_fallocate(struct thread *td, struc return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len)); } + +/* + * Unlike madvise(2), we do not make a best effort to remember every + * possible caching hint. Instead, we remember the last setting with + * the exception that we will allow POSIX_FADV_NORMAL to adjust the + * region of any current setting. + */ +int +kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, + int advice) +{ + struct fadvise_info *fa, *new; + struct file *fp; + struct vnode *vp; + off_t end; + int error; + + if (offset < 0 || len < 0 || offset > OFF_MAX - len) + return (EINVAL); + switch (advice) { + case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_RANDOM: + case POSIX_FADV_NOREUSE: + new = malloc(sizeof(*fa), M_FADVISE, M_WAITOK); + break; + case POSIX_FADV_NORMAL: + case POSIX_FADV_WILLNEED: + case POSIX_FADV_DONTNEED: + new = NULL; + break; + default: + return (EINVAL); + } + error = fget(td, fd, &fp); + if (error != 0) + goto out; + + switch (fp->f_type) { + case DTYPE_VNODE: + break; + case DTYPE_PIPE: + case DTYPE_FIFO: + error = ESPIPE; + goto out; + default: + error = ENODEV; + goto out; + } + vp = fp->f_vnode; + if (vp->v_type != VREG) { + error = ENODEV; + goto out; + } + if (len == 0) + end = OFF_MAX; + else + end = offset + len - 1; + switch (advice) { + case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_RANDOM: + case POSIX_FADV_NOREUSE: + /* + * Try to merge any existing non-standard region with + * this new region if possible, otherwise create a new + * non-standard region for this request. + */ + mtx_pool_lock(mtxpool_sleep, fp); + fa = fp->f_advice; + if (fa != NULL && fa->fa_advice == advice && + ((fa->fa_start <= end && fa->fa_end >= offset) || + (end != OFF_MAX && fa->fa_start == end + 1) || + (fa->fa_end != OFF_MAX && fa->fa_end + 1 == offset))) { + if (offset < fa->fa_start) + fa->fa_start = offset; + if (end > fa->fa_end) + fa->fa_end = end; + } else { + new->fa_advice = advice; + new->fa_start = offset; + new->fa_end = end; + fp->f_advice = new; + new = fa; + } + mtx_pool_unlock(mtxpool_sleep, fp); + break; + case POSIX_FADV_NORMAL: + /* + * If a the "normal" region overlaps with an existing + * non-standard region, trim or remove the + * non-standard region. + */ + mtx_pool_lock(mtxpool_sleep, fp); + fa = fp->f_advice; + if (fa != NULL) { + if (offset <= fa->fa_start && end >= fa->fa_end) { + new = fa; + fp->f_advice = NULL; + } else if (offset <= fa->fa_start && + end >= fa->fa_start) + fa->fa_start = end + 1; + else if (offset <= fa->fa_end && end >= fa->fa_end) + fa->fa_end = offset - 1; + else if (offset >= fa->fa_start && end <= fa->fa_end) { + /* + * If the "normal" region is a middle + * portion of the existing + * non-standard region, just remove + * the whole thing rather than picking + * one side or the other to + * preserve. + */ + new = fa; + fp->f_advice = NULL; + } + } + mtx_pool_unlock(mtxpool_sleep, fp); + break; + case POSIX_FADV_WILLNEED: + case POSIX_FADV_DONTNEED: + error = VOP_ADVISE(vp, offset, end, advice); + break; + } +out: + if (fp != NULL) + fdrop(fp, td); + free(new, M_FADVISE); + return (error); +} + +int +posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) +{ + + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, + uap->advice)); +} Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_vnops.c Fri Jan 6 19:32:39 2012 (r229725) @@ -511,7 +511,7 @@ vn_read(fp, uio, active_cred, flags, td) struct vnode *vp; int error, ioflag; struct mtx *mtxp; - int vfslocked; + int advice, vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -522,27 +522,48 @@ vn_read(fp, uio, active_cred, flags, td) ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; + advice = POSIX_FADV_NORMAL; vfslocked = VFS_LOCK_GIANT(vp->v_mount); /* * According to McKusick the vn lock was protecting f_offset here. * It is now protected by the FOFFSET_LOCKED flag. */ - if ((flags & FOF_OFFSET) == 0) { + if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) { mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); - while(fp->f_vnread_flags & FOFFSET_LOCKED) { - fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, - "vnread offlock", 0); + if ((flags & FOF_OFFSET) == 0) { + while (fp->f_vnread_flags & FOFFSET_LOCKED) { + fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; + msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + "vnread offlock", 0); + } + fp->f_vnread_flags |= FOFFSET_LOCKED; + uio->uio_offset = fp->f_offset; } - fp->f_vnread_flags |= FOFFSET_LOCKED; + if (fp->f_advice != NULL && + uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + advice = fp->f_advice->fa_advice; mtx_unlock(mtxp); - vn_lock(vp, LK_SHARED | LK_RETRY); - uio->uio_offset = fp->f_offset; - } else - vn_lock(vp, LK_SHARED | LK_RETRY); + } + vn_lock(vp, LK_SHARED | LK_RETRY); - ioflag |= sequential_heuristic(uio, fp); + switch (advice) { + case POSIX_FADV_NORMAL: + case POSIX_FADV_SEQUENTIAL: + ioflag |= sequential_heuristic(uio, fp); + break; + case POSIX_FADV_RANDOM: + /* Disable read-ahead for random I/O. */ + break; + case POSIX_FADV_NOREUSE: + /* + * Request the underlying FS to discard the buffers + * and pages after the I/O is complete. + */ + ioflag |= IO_DIRECT; + break; + } #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); @@ -577,7 +598,8 @@ vn_write(fp, uio, active_cred, flags, td struct vnode *vp; struct mount *mp; int error, ioflag, lock_flags; - int vfslocked; + struct mtx *mtxp; + int advice, vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -611,7 +633,33 @@ vn_write(fp, uio, active_cred, flags, td vn_lock(vp, lock_flags | LK_RETRY); if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; - ioflag |= sequential_heuristic(uio, fp); + advice = POSIX_FADV_NORMAL; + if (fp->f_advice != NULL) { + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (fp->f_advice != NULL && + uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + advice = fp->f_advice->fa_advice; + mtx_unlock(mtxp); + } + switch (advice) { + case POSIX_FADV_NORMAL: + case POSIX_FADV_SEQUENTIAL: + ioflag |= sequential_heuristic(uio, fp); + break; + case POSIX_FADV_RANDOM: + /* XXX: Is this correct? */ + break; + case POSIX_FADV_NOREUSE: + /* + * Request the underlying FS to discard the buffers + * and pages after the I/O is complete. + */ + ioflag |= IO_DIRECT; + break; + } + #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); if (error == 0) Modified: stable/8/sys/kern/vnode_if.src ============================================================================== --- stable/8/sys/kern/vnode_if.src Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vnode_if.src Fri Jan 6 19:32:39 2012 (r229725) @@ -621,3 +621,12 @@ vop_allocate { INOUT off_t *offset; INOUT off_t *len; }; + +%% advise vp U U U + +vop_advise { + IN struct vnode *vp; + IN off_t start; + IN off_t end; + IN int advice; +}; Modified: stable/8/sys/sys/fcntl.h ============================================================================== --- stable/8/sys/sys/fcntl.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/fcntl.h Fri Jan 6 19:32:39 2012 (r229725) @@ -277,9 +277,17 @@ struct oflock { #define LOCK_UN 0x08 /* unlock file */ #endif +#if __POSIX_VISIBLE >= 200112 /* - * XXX missing posix_fadvise() and POSIX_FADV_* macros. + * Advice to posix_fadvise */ +#define POSIX_FADV_NORMAL 0 /* no special treatment */ +#define POSIX_FADV_RANDOM 1 /* expect random page references */ +#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */ +#define POSIX_FADV_WILLNEED 3 /* will need these pages */ +#define POSIX_FADV_DONTNEED 4 /* dont need these pages */ +#define POSIX_FADV_NOREUSE 5 /* access data only once */ +#endif #ifndef _KERNEL __BEGIN_DECLS @@ -290,6 +298,7 @@ int fcntl(int, int, ...); int openat(int, const char *, int, ...); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 +int posix_fadvise(int, off_t, off_t, int); int posix_fallocate(int, off_t, off_t); #endif #if __BSD_VISIBLE Modified: stable/8/sys/sys/file.h ============================================================================== --- stable/8/sys/sys/file.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/file.h Fri Jan 6 19:32:39 2012 (r229725) @@ -113,6 +113,12 @@ struct fileops { * none not locked */ +struct fadvise_info { + int fa_advice; /* (f) FADV_* type. */ + off_t fa_start; /* (f) Region start. */ + off_t fa_end; /* (f) Region end. */ +}; + struct file { void *f_data; /* file descriptor specific data */ struct fileops *f_ops; /* File operations */ @@ -127,7 +133,11 @@ struct file { */ int f_seqcount; /* Count of sequential accesses. */ off_t f_nextoff; /* next expected read/write offset. */ - struct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */ + union { + struct cdev_privdata *fvn_cdevpriv; + /* (d) Private data for the cdev. */ + struct fadvise_info *fvn_advice; + } f_vnun; /* * DFLAG_SEEKABLE specific fields */ @@ -138,6 +148,9 @@ struct file { void *f_label; /* Place-holder for MAC label. */ }; +#define f_cdevpriv f_vnun.fvn_cdevpriv +#define f_advice f_vnun.fvn_advice + #define FOFFSET_LOCKED 0x1 #define FOFFSET_LOCK_WAITING 0x2 Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/param.h Fri Jan 6 19:32:39 2012 (r229725) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802514 /* Master, propagated to newvers */ +#define __FreeBSD_version 802515 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 Modified: stable/8/sys/sys/syscallsubr.h ============================================================================== --- stable/8/sys/sys/syscallsubr.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/syscallsubr.h Fri Jan 6 19:32:39 2012 (r229725) @@ -149,6 +149,10 @@ int kern_openat(struct thread *td, int f int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, u_long flags); int kern_pipe(struct thread *td, int fildes[2]); +int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, + int advice); +int kern_posix_fallocate(struct thread *td, int fd, off_t offset, + off_t len); int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); int kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits); Modified: stable/8/sys/sys/unistd.h ============================================================================== --- stable/8/sys/sys/unistd.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/unistd.h Fri Jan 6 19:32:39 2012 (r229725) @@ -49,7 +49,7 @@ * the POSIX standard; however, if the relevant sysconf() function * returns -1, the functions may be stubbed out. */ -#define _POSIX_ADVISORY_INFO -1 +#define _POSIX_ADVISORY_INFO 200112L #define _POSIX_ASYNCHRONOUS_IO 0 #define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CLOCK_SELECTION -1 Modified: stable/8/sys/sys/vnode.h ============================================================================== --- stable/8/sys/sys/vnode.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/vnode.h Fri Jan 6 19:32:39 2012 (r229725) @@ -385,6 +385,7 @@ extern int vttoif_tab[]; #define V_SAVE 0x0001 /* vinvalbuf: sync file first */ #define V_ALT 0x0002 /* vinvalbuf: invalidate only alternate bufs */ #define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */ +#define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */ #define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */ #define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ @@ -686,6 +687,7 @@ int vop_stdunlock(struct vop_unlock_args int vop_nopoll(struct vop_poll_args *); int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); +int vop_stdadvise(struct vop_advise_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap); int vop_stdallocate(struct vop_allocate_args *ap); Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/vm/vm_object.c Fri Jan 6 19:32:39 2012 (r229725) @@ -1874,6 +1874,48 @@ skipmemq: } /* + * vm_object_page_cache: + * + * For the given object, attempt to move the specified clean + * pages to the cache queue. If a page is wired for any reason, + * then it will not be changed. Pages are specified by the given + * range ["start", "end"). As a special case, if "end" is zero, + * then the range extends from "start" to the end of the object. + * Any mappings to the specified pages are removed before the + * pages are moved to the cache queue. + * + * This operation should only be performed on objects that + * contain managed pages. + * + * The object must be locked. + */ +void +vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end) +{ + vm_page_t p, next; + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT((object->type != OBJT_DEVICE && object->type != OBJT_SG && + object->type != OBJT_PHYS), + ("vm_object_page_cache: illegal object %p", object)); + if (object->resident_page_count == 0) + return; + p = vm_page_find_least(object, start); + + /* + * Here, the variable "p" is either (1) the page with the least pindex + * greater than or equal to the parameter "start" or (2) NULL. + */ + vm_page_lock_queues(); + for (; p != NULL && (p->pindex < end || end == 0); p = next) { + next = TAILQ_NEXT(p, listq); + + vm_page_try_to_cache(p); + } + vm_page_unlock_queues(); +} + +/* * Populate the specified range of the object with valid pages. Returns * TRUE if the range is successfully populated and FALSE otherwise. * Modified: stable/8/sys/vm/vm_object.h ============================================================================== --- stable/8/sys/vm/vm_object.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/vm/vm_object.h Fri Jan 6 19:32:39 2012 (r229725) @@ -218,6 +218,8 @@ void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); +void vm_object_page_cache(vm_object_t object, vm_pindex_t start, + vm_pindex_t end); void vm_object_page_clean (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); void vm_object_page_remove (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); boolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 19:33:27 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 939E6106567D; Fri, 6 Jan 2012 19:33: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 732088FC14; Fri, 6 Jan 2012 19:33:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06JXROD004686; Fri, 6 Jan 2012 19:33:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JXRFL004674; Fri, 6 Jan 2012 19:33:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061933.q06JXRFL004674@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 19:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229726 - in stable/8/sys: compat/freebsd32 kern sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 19:33:27 -0000 Author: jhb Date: Fri Jan 6 19:33:27 2012 New Revision: 229726 URL: http://svn.freebsd.org/changeset/base/229726 Log: Regen. Modified: stable/8/sys/compat/freebsd32/freebsd32_proto.h stable/8/sys/compat/freebsd32/freebsd32_syscall.h stable/8/sys/compat/freebsd32/freebsd32_syscalls.c stable/8/sys/compat/freebsd32/freebsd32_sysent.c stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c stable/8/sys/kern/init_sysent.c stable/8/sys/kern/syscalls.c stable/8/sys/kern/systrace_args.c stable/8/sys/sys/syscall.h stable/8/sys/sys/syscall.mk stable/8/sys/sys/sysproto.h Modified: stable/8/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -575,6 +575,14 @@ struct freebsd32_posix_fallocate_args { char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; }; +struct freebsd32_posix_fadvise_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; + char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; + char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; + char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; + char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; +}; #if !defined(PAD64_REQUIRED) && defined(__powerpc__) #define PAD64_REQUIRED #endif @@ -684,6 +692,7 @@ int freebsd32_msgctl(struct thread *, st int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *); int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *); int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *); +int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); #ifdef COMPAT_43 @@ -1015,6 +1024,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL #define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #undef PAD_ #undef PADL_ Modified: stable/8/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #define FREEBSD32_SYS_syscall 0 @@ -411,4 +411,5 @@ #define FREEBSD32_SYS_lpathconf 513 #define FREEBSD32_SYS_freebsd32_pselect 522 #define FREEBSD32_SYS_freebsd32_posix_fallocate 530 +#define FREEBSD32_SYS_freebsd32_posix_fadvise 531 #define FREEBSD32_SYS_MAXSYSCALL 532 Modified: stable/8/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ const char *freebsd32_syscallnames[] = { @@ -554,5 +554,5 @@ const char *freebsd32_syscallnames[] = { "#528", /* 528 = rctl_add_rule */ "#529", /* 529 = rctl_remove_rule */ "freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */ - "#531", /* 531 = posix_fadvise */ + "freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */ }; Modified: stable/8/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #include "opt_compat.h" @@ -591,5 +591,5 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 528 = rctl_add_rule */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 529 = rctl_remove_rule */ { AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0 }, /* 530 = freebsd32_posix_fallocate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = posix_fadvise */ + { AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = freebsd32_posix_fadvise */ }; Modified: stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 6 19:33:27 2012 (r229726) @@ -2941,6 +2941,18 @@ systrace_args(int sysnum, void *params, *n_args = 5; break; } + /* freebsd32_posix_fadvise */ + case 531: { + struct freebsd32_posix_fadvise_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = p->offset1; /* uint32_t */ + uarg[2] = p->offset2; /* uint32_t */ + uarg[3] = p->len1; /* uint32_t */ + uarg[4] = p->len2; /* uint32_t */ + iarg[5] = p->advice; /* int */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -7843,6 +7855,31 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* freebsd32_posix_fadvise */ + case 531: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "uint32_t"; + break; + case 2: + p = "uint32_t"; + break; + case 3: + p = "uint32_t"; + break; + case 4: + p = "uint32_t"; + break; + case 5: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/8/sys/kern/init_sysent.c ============================================================================== --- stable/8/sys/kern/init_sysent.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/kern/init_sysent.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #include "opt_compat.h" @@ -565,5 +565,5 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 528 = rctl_add_rule */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 529 = rctl_remove_rule */ { AS(posix_fallocate_args), (sy_call_t *)posix_fallocate, AUE_NULL, NULL, 0, 0, 0 }, /* 530 = posix_fallocate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = posix_fadvise */ + { AS(posix_fadvise_args), (sy_call_t *)posix_fadvise, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = posix_fadvise */ }; Modified: stable/8/sys/kern/syscalls.c ============================================================================== --- stable/8/sys/kern/syscalls.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/kern/syscalls.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ const char *syscallnames[] = { @@ -538,5 +538,5 @@ const char *syscallnames[] = { "#528", /* 528 = rctl_add_rule */ "#529", /* 529 = rctl_remove_rule */ "posix_fallocate", /* 530 = posix_fallocate */ - "#531", /* 531 = posix_fadvise */ + "posix_fadvise", /* 531 = posix_fadvise */ }; Modified: stable/8/sys/kern/systrace_args.c ============================================================================== --- stable/8/sys/kern/systrace_args.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/kern/systrace_args.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3117,6 +3117,16 @@ systrace_args(int sysnum, void *params, *n_args = 3; break; } + /* posix_fadvise */ + case 531: { + struct posix_fadvise_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->offset; /* off_t */ + iarg[2] = p->len; /* off_t */ + iarg[3] = p->advice; /* int */ + *n_args = 4; + break; + } default: *n_args = 0; break; @@ -8290,6 +8300,25 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* posix_fadvise */ + case 531: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "off_t"; + break; + case 2: + p = "off_t"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/8/sys/sys/syscall.h ============================================================================== --- stable/8/sys/sys/syscall.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/sys/syscall.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #define SYS_syscall 0 @@ -432,4 +432,5 @@ #define SYS_lpathconf 513 #define SYS_pselect 522 #define SYS_posix_fallocate 530 +#define SYS_posix_fadvise 531 #define SYS_MAXSYSCALL 532 Modified: stable/8/sys/sys/syscall.mk ============================================================================== --- stable/8/sys/sys/syscall.mk Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/sys/syscall.mk Fri Jan 6 19:33:27 2012 (r229726) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb +# created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb MIASM = \ syscall.o \ exit.o \ @@ -380,4 +380,5 @@ MIASM = \ shmctl.o \ lpathconf.o \ pselect.o \ - posix_fallocate.o + posix_fallocate.o \ + posix_fadvise.o Modified: stable/8/sys/sys/sysproto.h ============================================================================== --- stable/8/sys/sys/sysproto.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/sys/sysproto.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1670,6 +1670,12 @@ struct posix_fallocate_args { char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)]; }; +struct posix_fadvise_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)]; + char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -2032,6 +2038,7 @@ int shmctl(struct thread *, struct shmct int lpathconf(struct thread *, struct lpathconf_args *); int pselect(struct thread *, struct pselect_args *); int posix_fallocate(struct thread *, struct posix_fallocate_args *); +int posix_fadvise(struct thread *, struct posix_fadvise_args *); #ifdef COMPAT_43 @@ -2708,6 +2715,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_lpathconf AUE_LPATHCONF #define SYS_AUE_pselect AUE_SELECT #define SYS_AUE_posix_fallocate AUE_NULL +#define SYS_AUE_posix_fadvise AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 21:45:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E0A81065673; Fri, 6 Jan 2012 21:45:08 +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 5AD688FC1A; Fri, 6 Jan 2012 21:45:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06Lj81p009647; Fri, 6 Jan 2012 21:45:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Lj8Xt009644; Fri, 6 Jan 2012 21:45:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062145.q06Lj8Xt009644@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 21:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229737 - stable/8/sys/dev/et X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 21:45:08 -0000 Author: yongari Date: Fri Jan 6 21:45:08 2012 New Revision: 229737 URL: http://svn.freebsd.org/changeset/base/229737 Log: MFC r228333,228335-228336,228362,228368-228369,228381: r228333: Protect SIOCSIFMTU ioctl handler with driver lock. Don't blindly re-initialize controller whenever MTU is changed. Now, reinitializing is done only when driver is running. While here, remove unnecessary assignment of error value since it was already initialized to 0. r228335: Consistently use a tab character instead of using either a space or tab after #define. While I'm here consistently use capital letters when it uses hexadecimal notation. No functional changes. r228336: Disable all clocks and put PHY into COMA before entering into suspend state. This will save more power. On resume, make sure to enable all clocks. While I'm here, if controller is not fast ethernet, enable gigabit PHY. r228362: Do not disable interrupt without knowing whether the raised interrupt is ours. Note, interrupts are automatically ACKed when the status register is read. Add RX/TX DMA error to interrupt handler and do full controller reset if driver happen to encounter these errors. There is no way to recover from these DMA errors without controller reset. Rename local variable name intrs with status to enhance readability. While I'm here, rename ET_INTR_TXEOF and ET_INTR_RXEOF to ET_INTR_TXDMA and ET_INTR_RXDMA respectively. These interrupts indicate that a frame is successfully DMAed to controller's internal FIFO and they have nothing to do with EOF(end of frame). Driver does not need to wait actual end of TX/RX of a frame(e.g. no need to wait the end signal of TX which is generated when a frame in TX FIFO is emptied by MAC). Previous names were somewhat confusing. r228368: Remove unnecessary definition of ET_PCIR_BAR. Controller support I/O memory only. While here, use pci_set_max_read_req(9) rather than directly manipulating PCIe device control register. r228369: Announce flow control ability to PHY driver and enable RX flow control. Controller does not automatically generate pause frames based on number of available RX buffers so it's very hard to know when driver should generate XON frame in time. The only mechanism driver can detect low number of RX buffer condition is ET_INTR_RXRING0_LOW or ET_INTR_RXRING1_LOW interrupt. This interrupt is generated whenever controller notices the number of available RX buffers are lower than pre-programmed value( ET_RX_RING0_MINCNT and ET_RX_RING1_MINCNT register). This scheme does not provide a way to detect when controller sees enough number of RX buffers again such that efficient generation of XON/XOFF frame is not easy. While here, add more flow control related register definition. r228381: FreeBSD driver does not require arpcom structure in softc. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etreg.h stable/8/sys/dev/et/if_etvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 21:43:26 2012 (r229736) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 21:45:08 2012 (r229737) @@ -224,6 +224,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t pmcfg; int cap, error, msic; sc = device_get_softc(dev); @@ -253,9 +254,9 @@ et_attach(device_t dev) /* * Allocate IO memory */ - sc->sc_mem_rid = ET_PCIR_BAR; + sc->sc_mem_rid = PCIR_BAR(0); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, RF_ACTIVE); + &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); @@ -308,8 +309,11 @@ et_attach(device_t dev) et_get_eaddr(dev, eaddr); - CSR_WRITE_4(sc, ET_PM, - ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); et_reset(sc); @@ -332,7 +336,8 @@ et_attach(device_t dev) et_chip_attach(sc); error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, - et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -548,12 +553,23 @@ et_miibus_statchg(device_t dev) if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { cfg2 |= ET_MAC_CFG2_FDX; + /* + * Controller lacks automatic TX pause frame + * generation so it should be handled by driver. + * Even though driver can send pause frame with + * arbitrary pause time, controller does not + * provide a way that tells how many free RX + * buffers are available in controller. This + * limitation makes it hard to generate XON frame + * in time on driver side so don't enable TX flow + * control. + */ #ifdef notyet if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) cfg1 |= ET_MAC_CFG1_TXFLOW; +#endif if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) cfg1 |= ET_MAC_CFG1_RXFLOW; -#endif } else ctrl |= ET_MAC_CTRL_GHDX; @@ -722,12 +738,7 @@ et_bus_config(struct et_softc *sc) /* * Set max read request size to 2048 bytes */ - val = pci_read_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); - val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; - val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); + pci_set_max_read_req(sc->dev, 2048); return (0); } @@ -1158,34 +1169,40 @@ et_intr(void *xsc) { struct et_softc *sc = xsc; struct ifnet *ifp; - uint32_t intrs; + uint32_t status; ET_LOCK(sc); ifp = sc->ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ET_UNLOCK(sc); - return; - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done; + + status = CSR_READ_4(sc, ET_INTR_STATUS); + if ((status & ET_INTRS) == 0) + goto done; /* Disable further interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); - intrs = CSR_READ_4(sc, ET_INTR_STATUS); - if ((intrs & ET_INTRS) == 0) - goto done; - - if (intrs & ET_INTR_RXEOF) + if (status & (ET_INTR_RXDMA_ERROR | ET_INTR_TXDMA_ERROR)) { + device_printf(sc->dev, "DMA error(0x%08x) -- resetting\n", + status); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + ET_UNLOCK(sc); + return; + } + if (status & ET_INTR_RXDMA) et_rxeof(sc); - if (intrs & (ET_INTR_TXEOF | ET_INTR_TIMER)) + if (status & (ET_INTR_TXDMA | ET_INTR_TIMER)) et_txeof(sc); - if (intrs & ET_INTR_TIMER) + if (status & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } +done: ET_UNLOCK(sc); } @@ -1291,11 +1308,11 @@ et_ioctl(struct ifnet *ifp, u_long cmd, ET_LOCK(sc); et_setmulti(sc); ET_UNLOCK(sc); - error = 0; } break; case SIOCSIFMTU: + ET_LOCK(sc); #if 0 if (sc->sc_flags & ET_FLAG_JUMBO) max_framelen = ET_JUMBO_FRAMELEN; @@ -1305,14 +1322,18 @@ et_ioctl(struct ifnet *ifp, u_long cmd, if (ET_FRAMELEN(ifr->ifr_mtu) > max_framelen) { error = EOPNOTSUPP; + ET_UNLOCK(sc); break; } if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - et_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + } } + ET_UNLOCK(sc); break; case SIOCSIFCAP: @@ -1944,8 +1965,12 @@ et_init_txmac(struct et_softc *sc) /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); - /* No flow control yet */ - CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0); + /* + * Initialize pause time. + * This register should be set before XON/XOFF frame is + * sent by driver. + */ + CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0 << ET_TXMAC_FLOWCTRL_CFPT_SHIFT); /* Enable TX MAC but leave FC(?) diabled */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, @@ -2378,7 +2403,7 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, #define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) #define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ - SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) /* * Create sysctl tree @@ -2636,11 +2661,18 @@ static int et_suspend(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) et_stop(sc); + /* Diable all clocks and put PHY into COMA. */ + pmcfg = CSR_READ_4(sc, ET_PM); + pmcfg &= ~(EM_PM_GIGEPHY_ENB | ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | + ET_PM_RXCLK_GATE); + pmcfg |= ET_PM_PHY_SW_COMA; + CSR_WRITE_4(sc, ET_PM, pmcfg); ET_UNLOCK(sc); return (0); } @@ -2649,9 +2681,15 @@ static int et_resume(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); if ((sc->ifp->if_flags & IFF_UP) != 0) et_init_locked(sc); ET_UNLOCK(sc); Modified: stable/8/sys/dev/et/if_etreg.h ============================================================================== --- stable/8/sys/dev/et/if_etreg.h Fri Jan 6 21:43:26 2012 (r229736) +++ stable/8/sys/dev/et/if_etreg.h Fri Jan 6 21:45:08 2012 (r229737) @@ -38,11 +38,11 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -#define ET_MEM_TXSIZE_EX 182 -#define ET_MEM_RXSIZE_MIN 608 -#define ET_MEM_RXSIZE_DEFAULT 11216 -#define ET_MEM_SIZE 16384 -#define ET_MEM_UNIT 16 +#define ET_MEM_TXSIZE_EX 182 +#define ET_MEM_RXSIZE_MIN 608 +#define ET_MEM_RXSIZE_DEFAULT 11216 +#define ET_MEM_SIZE 16384 +#define ET_MEM_UNIT 16 /* * PCI registers @@ -53,270 +53,277 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) +#define ET_PCIR_DEVICE_CAPS 0x4C +#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ +#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 +#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 + +#define ET_PCIR_DEVICE_CTRL 0x50 +#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ +#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 + +#define ET_PCIR_MAC_ADDR0 0xA4 +#define ET_PCIR_MAC_ADDR1 0xA8 + +#define ET_PCIR_EEPROM_STATUS 0xB2 /* XXX undocumented */ +#define ET_PCIM_EEPROM_STATUS_ERROR 0x4C + +#define ET_PCIR_ACK_LATENCY 0xC0 +#define ET_PCIV_ACK_LATENCY_128 237 +#define ET_PCIV_ACK_LATENCY_256 416 + +#define ET_PCIR_REPLAY_TIMER 0xC2 +#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ +#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIR_DEVICE_CAPS 0x4c -#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ -#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 -#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 - -#define ET_PCIR_DEVICE_CTRL 0x50 -#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ -#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 - -#define ET_PCIR_MAC_ADDR0 0xa4 -#define ET_PCIR_MAC_ADDR1 0xa8 - -#define ET_PCIR_EEPROM_STATUS 0xb2 /* XXX undocumented */ -#define ET_PCIM_EEPROM_STATUS_ERROR 0x4c - -#define ET_PCIR_ACK_LATENCY 0xc0 -#define ET_PCIV_ACK_LATENCY_128 237 -#define ET_PCIV_ACK_LATENCY_256 416 - -#define ET_PCIR_REPLAY_TIMER 0xc2 -#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ -#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) - -#define ET_PCIR_L0S_L1_LATENCY 0xcf +#define ET_PCIR_L0S_L1_LATENCY 0xCF /* * CSR */ -#define ET_TXQUEUE_START 0x0000 -#define ET_TXQUEUE_END 0x0004 -#define ET_RXQUEUE_START 0x0008 -#define ET_RXQUEUE_END 0x000c -#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) -#define ET_QUEUE_ADDR_START 0 -#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) - -#define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE 0x00000008 -#define ET_PM_TXCLK_GATE 0x00000010 -#define ET_PM_RXCLK_GATE 0x00000020 - -#define ET_INTR_STATUS 0x0018 -#define ET_INTR_MASK 0x001c - -#define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA 0x00000001 -#define ET_SWRST_RXDMA 0x00000002 -#define ET_SWRST_TXMAC 0x00000004 -#define ET_SWRST_RXMAC 0x00000008 -#define ET_SWRST_MAC 0x00000010 -#define ET_SWRST_MAC_STAT 0x00000020 -#define ET_SWRST_MMC 0x00000040 -#define ET_SWRST_SELFCLR_DISABLE 0x80000000 - -#define ET_MSI_CFG 0x0030 - -#define ET_LOOPBACK 0x0034 - -#define ET_TIMER 0x0038 - -#define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT 0x00000001 -#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 -#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ - -#define ET_TX_RING_HI 0x1004 -#define ET_TX_RING_LO 0x1008 -#define ET_TX_RING_CNT 0x100c - -#define ET_TX_STATUS_HI 0x101c -#define ET_TX_STATUS_LO 0x1020 - -#define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX_MASK 0x000003FF -#define ET_TX_READY_POS_WRAP 0x00000400 - -#define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF -#define ET_TX_DONE_POS_WRAP 0x000000400 - -#define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT 0x00000001 -#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 -#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 -#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 -#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 -#define ET_RXDMA_CTRL_HALTED 0x00020000 - -#define ET_RX_STATUS_LO 0x2004 -#define ET_RX_STATUS_HI 0x2008 - -#define ET_RX_INTR_NPKTS 0x200c -#define ET_RX_INTR_DELAY 0x2010 - -#define ET_RXSTAT_LO 0x2020 -#define ET_RXSTAT_HI 0x2024 -#define ET_RXSTAT_CNT 0x2028 - -#define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF -#define ET_RXSTAT_POS_WRAP 0x00001000 - -#define ET_RXSTAT_MINCNT 0x2038 - -#define ET_RX_RING0_LO 0x203c -#define ET_RX_RING0_HI 0x2040 -#define ET_RX_RING0_CNT 0x2044 - -#define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING0_POS_WRAP 0x00000400 - -#define ET_RX_RING0_MINCNT 0x2054 - -#define ET_RX_RING1_LO 0x2058 -#define ET_RX_RING1_HI 0x205c -#define ET_RX_RING1_CNT 0x2060 - -#define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX 0x000003FF -#define ET_RX_RING1_POS_WRAP 0x00000400 - -#define ET_RX_RING1_MINCNT 0x2070 - -#define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE 0x00000001 -#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 - -#define ET_TXMAC_FLOWCTRL 0x3010 - -#define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE 0x00000001 -#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 -#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 - -#define ET_WOL_CRC 0x4004 -#define ET_WOL_SA_LO 0x4010 -#define ET_WOL_SA_HI 0x4014 -#define ET_WOL_MASK 0x4018 - -#define ET_UCAST_FILTADDR1 0x4068 -#define ET_UCAST_FILTADDR2 0x406c -#define ET_UCAST_FILTADDR3 0x4070 - -#define ET_MULTI_HASH 0x4074 - -#define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST 0x00000001 -#define ET_PKTFILT_MCAST 0x00000002 -#define ET_PKTFILT_UCAST 0x00000004 -#define ET_PKTFILT_FRAG 0x00000008 -#define ET_PKTFILT_MINLEN_MASK 0x007F0000 -#define ET_PKTFILT_MINLEN_SHIFT 16 - -#define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 -#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 -#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC -#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) -#define ET_RXMAC_CUT_THRU_FRMLEN 8074 - -#define ET_RXMAC_MC_WATERMARK 0x408c -#define ET_RXMAC_SPACE_AVL 0x4094 - -#define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 -#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 -#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 -#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 - -#define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN 0x00000001 -#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 -#define ET_MAC_CFG1_RXEN 0x00000004 -#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 -#define ET_MAC_CFG1_TXFLOW 0x00000010 -#define ET_MAC_CFG1_RXFLOW 0x00000020 -#define ET_MAC_CFG1_LOOPBACK 0x00000100 -#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 -#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 -#define ET_MAC_CFG1_RST_TXMC 0x00040000 -#define ET_MAC_CFG1_RST_RXMC 0x00080000 -#define ET_MAC_CFG1_SIM_RST 0x40000000 -#define ET_MAC_CFG1_SOFT_RST 0x80000000 - -#define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX 0x00000001 -#define ET_MAC_CFG2_CRC 0x00000002 -#define ET_MAC_CFG2_PADCRC 0x00000004 -#define ET_MAC_CFG2_LENCHK 0x00000010 -#define ET_MAC_CFG2_BIGFRM 0x00000020 -#define ET_MAC_CFG2_MODE_MII 0x00000100 -#define ET_MAC_CFG2_MODE_GMII 0x00000200 -#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 -#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 - -#define ET_IPG 0x5008 -#define ET_IPG_B2B_MASK 0x0000007F -#define ET_IPG_MINIFG_MASK 0x0000FF00 -#define ET_IPG_NONB2B_2_MASK 0x007F0000 -#define ET_IPG_NONB2B_1_MASK 0x7F000000 -#define ET_IPG_B2B_SHIFT 0 -#define ET_IPG_MINIFG_SHIFT 8 -#define ET_IPG_NONB2B_2_SHIFT 16 -#define ET_IPG_NONB2B_1_SHIFT 24 - -#define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF -#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 -#define ET_MAC_HDX_EXC_DEFER 0x00010000 -#define ET_MAC_HDX_NOBACKOFF 0x00020000 -#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 -#define ET_MAC_HDX_ALT_BEB 0x00080000 -#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 -#define ET_MAC_HDX_COLLWIN_SHIFT 0 -#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 -#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 - -#define ET_MAX_FRMLEN 0x5010 - -#define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST 0x00000007 -#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 -#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 -#define ET_MII_CFG_RST 0x80000000 - -#define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ 0x00000001 - -#define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG_MASK 0x0000001F -#define ET_MII_ADDR_PHY_MASK 0x00001F00 -#define ET_MII_ADDR_REG_SHIFT 0 -#define ET_MII_ADDR_PHY_SHIFT 8 - -#define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF -#define ET_MII_CTRL_VALUE_SHIFT 0 - -#define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE_MASK 0x0000FFFF - -#define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY 0x00000001 -#define ET_MII_IND_INVALID 0x00000004 - -#define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII 0x01000000 -#define ET_MAC_CTRL_LHDX 0x02000000 -#define ET_MAC_CTRL_GHDX 0x04000000 +#define ET_TXQUEUE_START 0x0000 +#define ET_TXQUEUE_END 0x0004 +#define ET_RXQUEUE_START 0x0008 +#define ET_RXQUEUE_END 0x000C +#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) +#define ET_QUEUE_ADDR_START 0 +#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) + +#define ET_PM 0x0010 +#define EM_PM_GIGEPHY_ENB 0x00000001 +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 +#define ET_PM_PHY_SW_COMA 0x00000040 + +#define ET_INTR_STATUS 0x0018 +#define ET_INTR_MASK 0x001C + +#define ET_SWRST 0x0028 +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 + +#define ET_MSI_CFG 0x0030 + +#define ET_LOOPBACK 0x0034 + +#define ET_TIMER 0x0038 + +#define ET_TXDMA_CTRL 0x1000 +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ + +#define ET_TX_RING_HI 0x1004 +#define ET_TX_RING_LO 0x1008 +#define ET_TX_RING_CNT 0x100C + +#define ET_TX_STATUS_HI 0x101C +#define ET_TX_STATUS_LO 0x1020 + +#define ET_TX_READY_POS 0x1024 +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 + +#define ET_TX_DONE_POS 0x1060 +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 + +#define ET_RXDMA_CTRL 0x2000 +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 + +#define ET_RX_STATUS_LO 0x2004 +#define ET_RX_STATUS_HI 0x2008 + +#define ET_RX_INTR_NPKTS 0x200C +#define ET_RX_INTR_DELAY 0x2010 + +#define ET_RXSTAT_LO 0x2020 +#define ET_RXSTAT_HI 0x2024 +#define ET_RXSTAT_CNT 0x2028 + +#define ET_RXSTAT_POS 0x2030 +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 + +#define ET_RXSTAT_MINCNT 0x2038 + +#define ET_RX_RING0_LO 0x203C +#define ET_RX_RING0_HI 0x2040 +#define ET_RX_RING0_CNT 0x2044 + +#define ET_RX_RING0_POS 0x204C +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 + +#define ET_RX_RING0_MINCNT 0x2054 + +#define ET_RX_RING1_LO 0x2058 +#define ET_RX_RING1_HI 0x205C +#define ET_RX_RING1_CNT 0x2060 + +#define ET_RX_RING1_POS 0x2068 +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 + +#define ET_RX_RING1_MINCNT 0x2070 + +#define ET_TXMAC_CTRL 0x3000 +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 + +#define ET_TXMAC_FLOWCTRL 0x3010 +#define ET_TXMAC_FLOWCTRL_CFPT_MASK 0x0000FFFF +#define ET_TXMAC_FLOWCTRL_CFEP_MASK 0xFFFF0000 +#define ET_TXMAC_FLOWCTRL_CFPT_SHIFT 0 + +#define ET_TXMAC_BP_CTRL 0x3020 +#define ET_TXMAC_BP_CTRL_XONXOFF 0x00000001 +#define ET_TXMAC_BP_CTRL_REQ 0x00000002 + +#define ET_RXMAC_CTRL 0x4000 +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 + +#define ET_WOL_CRC 0x4004 +#define ET_WOL_SA_LO 0x4010 +#define ET_WOL_SA_HI 0x4014 +#define ET_WOL_MASK 0x4018 + +#define ET_UCAST_FILTADDR1 0x4068 +#define ET_UCAST_FILTADDR2 0x406C +#define ET_UCAST_FILTADDR3 0x4070 + +#define ET_MULTI_HASH 0x4074 + +#define ET_PKTFILT 0x4084 +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 + +#define ET_RXMAC_MC_SEGSZ 0x4088 +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC +#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) +#define ET_RXMAC_CUT_THRU_FRMLEN 8074 + +#define ET_RXMAC_MC_WATERMARK 0x408C +#define ET_RXMAC_SPACE_AVL 0x4094 + +#define ET_RXMAC_MGT 0x4098 +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 + +#define ET_MAC_CFG1 0x5000 +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 + +#define ET_MAC_CFG2 0x5004 +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 + +#define ET_IPG 0x5008 +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 + +#define ET_MAC_HDX 0x500C +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 + +#define ET_MAX_FRMLEN 0x5010 + +#define ET_MII_CFG 0x5020 +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 + +#define ET_MII_CMD 0x5024 +#define ET_MII_CMD_READ 0x00000001 + +#define ET_MII_ADDR 0x5028 +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 + +#define ET_MII_CTRL 0x502C +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 + +#define ET_MII_STAT 0x5030 +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF + +#define ET_MII_IND 0x5034 +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 + +#define ET_MAC_CTRL 0x5038 +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 -#define ET_MAC_ADDR1 0x5040 -#define ET_MAC_ADDR2 0x5044 +#define ET_MAC_ADDR1 0x5040 +#define ET_MAC_ADDR2 0x5044 /* MAC statistics counters. */ #define ET_STAT_PKTS_64 0x6080 @@ -364,48 +371,48 @@ #define ET_STAT_TX_UNDERSIZE 0x6128 #define ET_STAT_TX_FRAG 0x612C -#define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE 0x00000001 -#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 -#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 -#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 -#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 -#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 -#define ET_MMC_CTRL_FORCE_CE 0x00000040 +#define ET_MMC_CTRL 0x7000 +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 -#define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 -#define ET_INTR_RXRING0_LOW 0x00000040 -#define ET_INTR_RXRING1_LOW 0x00000080 -#define ET_INTR_RXSTAT_LOW 0x00000100 -#define ET_INTR_RXDMA_ERROR 0x00000200 -#define ET_INTR_TIMER 0x00004000 -#define ET_INTR_WOL 0x00008000 -#define ET_INTR_PHY 0x00010000 -#define ET_INTR_TXMAC 0x00020000 -#define ET_INTR_RXMAC 0x00040000 -#define ET_INTR_MAC_STATS 0x00080000 -#define ET_INTR_SLAVE_TO 0x00100000 - -#define ET_INTRS (ET_INTR_TXEOF | \ - ET_INTR_RXEOF | \ - ET_INTR_TIMER) +#define ET_INTR_TXDMA 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXDMA 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 + +#define ET_INTRS \ + (ET_INTR_TXDMA | ET_INTR_RXDMA | ET_INTR_TIMER | \ + ET_INTR_TXDMA_ERROR | ET_INTR_RXDMA_ERROR) /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING_POS_WRAP 0x00000400 +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs */ -#define PCI_VENDOR_LUCENT 0x11c1 -#define PCI_PRODUCT_LUCENT_ET1310 0xed00 /* ET1310 10/100/1000M Ethernet */ -#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xed01 /* ET1310 10/100M Ethernet */ +#define PCI_VENDOR_LUCENT 0x11C1 +#define PCI_PRODUCT_LUCENT_ET1310 0xED00 /* ET1310 10/100/1000M Ethernet */ +#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xED01 /* ET1310 10/100M Ethernet */ #endif /* !_IF_ETREG_H */ Modified: stable/8/sys/dev/et/if_etvar.h ============================================================================== --- stable/8/sys/dev/et/if_etvar.h Fri Jan 6 21:43:26 2012 (r229736) +++ stable/8/sys/dev/et/if_etvar.h Fri Jan 6 21:45:08 2012 (r229737) @@ -38,39 +38,39 @@ #ifndef _IF_ETVAR_H #define _IF_ETVAR_H -#define ET_RING_ALIGN 4096 -#define ET_STATUS_ALIGN 8 -#define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 4 - -#define ET_TX_NDESC 512 -#define ET_RX_NDESC 512 -#define ET_RX_NRING 2 -#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) - -#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) -#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) -#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) +#define ET_RING_ALIGN 4096 +#define ET_STATUS_ALIGN 8 +#define ET_NSEG_MAX 32 /* XXX no limit actually */ +#define ET_NSEG_SPARE 4 + +#define ET_TX_NDESC 512 +#define ET_RX_NDESC 512 +#define ET_RX_NRING 2 +#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) + +#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) +#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) +#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) -#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ +#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ ET_MEM_TXSIZE_EX) -#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ +#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ EVL_ENCAPLEN - ETHER_CRC_LEN) -#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ +#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ (mtu) + ETHER_CRC_LEN) -#define ET_JSLOTS (ET_RX_NDESC + 128) -#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) -#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) +#define ET_JSLOTS (ET_RX_NDESC + 128) +#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) +#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) -#define CSR_WRITE_4(sc, reg, val) \ +#define CSR_WRITE_4(sc, reg, val) \ bus_write_4((sc)->sc_mem_res, (reg), (val)) -#define CSR_READ_4(sc, reg) \ +#define CSR_READ_4(sc, reg) \ bus_read_4((sc)->sc_mem_res, (reg)) -#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) -#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) +#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) +#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) struct et_txdesc { uint32_t td_addr_hi; @@ -79,23 +79,23 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ }; -#define ET_TDCTRL1_LEN_MASK 0x0000FFFF +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG 0x00000001 -#define ET_TDCTRL2_FIRST_FRAG 0x00000002 -#define ET_TDCTRL2_INTR 0x00000004 -#define ET_TDCTRL2_CTRL_WORD 0x00000008 -#define ET_TDCTRL2_HDX_BACKP 0x00000010 -#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 -#define ET_TDCTRL2_FRAME_ERR 0x00000040 -#define ET_TDCTRL2_NO_CRC 0x00000080 -#define ET_TDCTRL2_MAC_OVRRD 0x00000100 -#define ET_TDCTRL2_PAD_PACKET 0x00000200 -#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 -#define ET_TDCTRL2_INS_VLAN 0x00000800 -#define ET_TDCTRL2_CSUM_IP 0x00001000 -#define ET_TDCTRL2_CSUM_TCP 0x00002000 -#define ET_TDCTRL2_CSUM_UDP 0x00004000 +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; @@ -103,56 +103,56 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ }; -#define ET_RDCTRL_BUFIDX_MASK 0x000003FF +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ }; -#define ET_RXST_INFO1_HASH_PASS 0x00000001 -#define ET_RXST_INFO1_IPCSUM 0x00000002 -#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 -#define ET_RXST_INFO1_TCPCSUM 0x00000008 -#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 -#define ET_RXST_INFO1_WOL 0x00000020 -#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 -#define ET_RXST_INFO1_DROP 0x00000080 -#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 -#define ET_RXST_INFO1_JUMBO 0x00000200 -#define ET_RXST_INFO1_VLAN 0x00000400 -#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 -#define ET_RXST_INFO1_SHORT 0x00020000 -#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 -#define ET_RXST_INFO1_CODE_ERR 0x00080000 -#define ET_RXST_INFO1_CRC_ERR 0x00100000 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 22:54:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EDC71065675; Fri, 6 Jan 2012 22:54:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D89B08FC15; Fri, 6 Jan 2012 22:54:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06Ms3w7012104; Fri, 6 Jan 2012 22:54:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Ms3jf012102; Fri, 6 Jan 2012 22:54:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201062254.q06Ms3jf012102@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 6 Jan 2012 22:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229741 - stable/8/sys/dev/usb/controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 22:54:04 -0000 Author: hselasky Date: Fri Jan 6 22:54:03 2012 New Revision: 229741 URL: http://svn.freebsd.org/changeset/base/229741 Log: Fix build of ehci_mbus.c by applying patches similar to ones in r228483. This file was missed by a recent MFC because the file is named differently in 10-current. Pointy hat: hselasky @ Reported by: jhb Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_mbus.c Fri Jan 6 22:18:13 2012 (r229740) +++ stable/8/sys/dev/usb/controller/ehci_mbus.c Fri Jan 6 22:54:03 2012 (r229741) @@ -78,9 +78,6 @@ __FBSDID("$FreeBSD$"); static device_attach_t ehci_mbus_attach; static device_detach_t ehci_mbus_detach; -static device_shutdown_t ehci_mbus_shutdown; -static device_suspend_t ehci_mbus_suspend; -static device_resume_t ehci_mbus_resume; static int err_intr(void *arg); @@ -99,45 +96,6 @@ static void *ih_err; #define MV_USB_DEVICE_UNDERFLOW (1 << 3) static int -ehci_mbus_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ehci_mbus_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ehci_mbus_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} - -static int ehci_mbus_probe(device_t self) { @@ -361,20 +319,17 @@ static device_method_t ehci_methods[] = DEVMETHOD(device_probe, ehci_mbus_probe), DEVMETHOD(device_attach, ehci_mbus_attach), DEVMETHOD(device_detach, ehci_mbus_detach), - DEVMETHOD(device_suspend, ehci_mbus_suspend), - DEVMETHOD(device_resume, ehci_mbus_resume), - DEVMETHOD(device_shutdown, ehci_mbus_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), - {0, 0} + DEVMETHOD_END }; static driver_t ehci_driver = { - "ehci", - ehci_methods, - sizeof(ehci_softc_t), + .name = "ehci", + .methods = ehci_methods, + .size = sizeof(ehci_softc_t), }; static devclass_t ehci_devclass; From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 6 23:59:25 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C97F81065670; Fri, 6 Jan 2012 23:59:25 +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 B79418FC13; Fri, 6 Jan 2012 23:59:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q06NxPrB014386; Fri, 6 Jan 2012 23:59:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06NxPFP014383; Fri, 6 Jan 2012 23:59:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062359.q06NxPFP014383@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 23:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229746 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2012 23:59:25 -0000 Author: yongari Date: Fri Jan 6 23:59:25 2012 New Revision: 229746 URL: http://svn.freebsd.org/changeset/base/229746 Log: MFC r215835,228370: r215835: Add a HARDWARE section. r228370: After r228293, et(4) supports altq(4). Modified: stable/8/share/man/man4/altq.4 stable/8/share/man/man4/et.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/altq.4 ============================================================================== --- stable/8/share/man/man4/altq.4 Fri Jan 6 23:57:21 2012 (r229745) +++ stable/8/share/man/man4/altq.4 Fri Jan 6 23:59:25 2012 (r229746) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2011 +.Dd December 9, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -134,6 +134,7 @@ They have been applied to the following .Xr em 4 , .Xr ep 4 , .Xr epair 4 , +.Xr et 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , Modified: stable/8/share/man/man4/et.4 ============================================================================== --- stable/8/share/man/man4/et.4 Fri Jan 6 23:57:21 2012 (r229745) +++ stable/8/share/man/man4/et.4 Fri Jan 6 23:59:25 2012 (r229746) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2008 +.Dd December 9, 2011 .Dt ET 4 .Os .Sh NAME @@ -122,6 +122,11 @@ Note that the 1000baseT media type is on if it is supported by the adapter. For more information on configuring this device, see .Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports Agere ET1310 10/100/Gigabit +Ethernet adapters. .Sh TUNABLES .Bl -tag -width ".Va hw.et.rx_intr_npkts" .It Va hw.et.rx_intr_npkts @@ -151,6 +156,7 @@ to achieve TX interrupt moderation. The default value is 1000000000 (nanoseconds). .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 01:08:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EABCD1065670; Sat, 7 Jan 2012 01:08:17 +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 D8A458FC1A; Sat, 7 Jan 2012 01:08:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0718H7K017105; Sat, 7 Jan 2012 01:08:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0718HV7017102; Sat, 7 Jan 2012 01:08:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201070108.q0718HV7017102@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 7 Jan 2012 01:08:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229754 - in stable/8/sys/dev: bce mxge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 01:08:18 -0000 Author: yongari Date: Sat Jan 7 01:08:17 2012 New Revision: 229754 URL: http://svn.freebsd.org/changeset/base/229754 Log: MFC r207761: Belatedly merge r207761. For unknown reason r207761 was not fully merged (r208073) to stable/8 but mergeinfo was recorded. Add a fastpath to allocate from packet zone when using m_getjcl. This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge. Modified: stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/mxge/if_mxge.c Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Sat Jan 7 00:47:27 2012 (r229753) +++ stable/8/sys/dev/bce/if_bce.c Sat Jan 7 01:08:17 2012 (r229754) @@ -5017,11 +5017,8 @@ bce_get_rx_buf(struct bce_softc *sc, str #ifdef BCE_JUMBO_HDRSPLIT MGETHDR(m_new, M_DONTWAIT, MT_DATA); #else - if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES) - m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, - sc->rx_bd_mbuf_alloc_size); + m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + sc->rx_bd_mbuf_alloc_size); #endif if (m_new == NULL) { Modified: stable/8/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Sat Jan 7 00:47:27 2012 (r229753) +++ stable/8/sys/dev/mxge/if_mxge.c Sat Jan 7 01:08:17 2012 (r229754) @@ -2411,10 +2411,7 @@ mxge_get_buf_big(struct mxge_slice_state mxge_rx_ring_t *rx = &ss->rx_big; int cnt, err, i; - if (rx->cl_size == MCLBYTES) - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); if (m == NULL) { rx->alloc_fail++; err = ENOBUFS; From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 02:03:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75644106567C; Sat, 7 Jan 2012 02:03:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 642948FC1D; Sat, 7 Jan 2012 02:03:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0723glM019375; Sat, 7 Jan 2012 02:03:42 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0723gUs019373; Sat, 7 Jan 2012 02:03:42 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201070203.q0723gUs019373@svn.freebsd.org> From: Glen Barber Date: Sat, 7 Jan 2012 02:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229758 - stable/8/share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 02:03:42 -0000 Author: gjb (doc committer) Date: Sat Jan 7 02:03:42 2012 New Revision: 229758 URL: http://svn.freebsd.org/changeset/base/229758 Log: MFC r228355: - As of r226865, daily_scrub_zfs_default_threshold is 35 days. PR: 162890 Modified: stable/8/share/man/man5/periodic.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/periodic.conf.5 ============================================================================== --- stable/8/share/man/man5/periodic.conf.5 Sat Jan 7 02:03:07 2012 (r229757) +++ stable/8/share/man/man5/periodic.conf.5 Sat Jan 7 02:03:42 2012 (r229758) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2010 +.Dd December 8, 2011 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -631,7 +631,7 @@ If the list is empty or not set, all zfs .It Va daily_scrub_zfs_default_threshold .Pq Vt int Number of days between a scrub if no pool-specific threshold is set. -The default value if no value is set is 30. +If not set, the default value is 35, corresponding to 5 weeks. .It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold .Pq Vt int The same as From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 02:09:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 153031065672; Sat, 7 Jan 2012 02:09:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 020A28FC1D; Sat, 7 Jan 2012 02:09:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0729ntJ019735; Sat, 7 Jan 2012 02:09:49 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0729nbM019732; Sat, 7 Jan 2012 02:09:49 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201070209.q0729nbM019732@svn.freebsd.org> From: Rick Macklem Date: Sat, 7 Jan 2012 02:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229759 - in stable/8/sys/fs: nfs nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 02:09:50 -0000 Author: rmacklem Date: Sat Jan 7 02:09:49 2012 New Revision: 229759 URL: http://svn.freebsd.org/changeset/base/229759 Log: MFC: r228217 Post r223774, the NFSv4 client no longer has multiple instances of the same lock_owner4 string. As such, the handling of cleanup of lock_owners could be simplified. This simplification permitted the client to do a ReleaseLockOwner operation when the process that the lock_owner4 string represents, has exited. This permits the server to release any storage related to the lock_owner4 string before the associated open is closed. Without this change, it is possible to exhaust a server's storage when a long running process opens a file and then many child processes do locking on the file, because the open doesn't get closed. A similar patch was applied to the Linux NFSv4 client recently so that it wouldn't exhaust a server's storage. Modified: stable/8/sys/fs/nfs/nfsclstate.h stable/8/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/8/sys/fs/nfs/nfsclstate.h Sat Jan 7 02:03:42 2012 (r229758) +++ stable/8/sys/fs/nfs/nfsclstate.h Sat Jan 7 02:09:49 2012 (r229759) @@ -34,6 +34,7 @@ */ LIST_HEAD(nfsclopenhead, nfsclopen); LIST_HEAD(nfscllockownerhead, nfscllockowner); +SLIST_HEAD(nfscllockownerfhhead, nfscllockownerfh); LIST_HEAD(nfscllockhead, nfscllock); LIST_HEAD(nfsclhead, nfsclclient); LIST_HEAD(nfsclownerhead, nfsclowner); @@ -149,8 +150,8 @@ struct nfscllockowner { struct nfsclopen *nfsl_open; NFSPROC_T *nfsl_inprog; nfsv4stateid_t nfsl_stateid; + int nfsl_lockflags; u_int32_t nfsl_seqid; - u_int32_t nfsl_defunct; struct nfsv4lock nfsl_rwlock; u_int8_t nfsl_owner[NFSV4CL_LOCKNAMELEN]; u_int8_t nfsl_openowner[NFSV4CL_LOCKNAMELEN]; @@ -166,6 +167,14 @@ struct nfscllock { short nfslo_type; }; +/* This structure is used to collect a list of lockowners to free up. */ +struct nfscllockownerfh { + SLIST_ENTRY(nfscllockownerfh) nfslfh_list; + struct nfscllockownerhead nfslfh_lock; + int nfslfh_len; + uint8_t nfslfh_fh[NFSX_V4FHMAX]; +}; + /* * Macro for incrementing the seqid#. */ Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Sat Jan 7 02:03:42 2012 (r229758) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Sat Jan 7 02:09:49 2012 (r229759) @@ -143,6 +143,8 @@ static void nfscl_freeopenowner(struct n static void nfscl_cleandeleg(struct nfscldeleg *); static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, struct nfsmount *, NFSPROC_T *); +static void nfscl_emptylockowner(struct nfscllockowner *, + struct nfscllockownerfhhead *); static short nfscberr_null[] = { 0, @@ -1030,7 +1032,7 @@ nfscl_getbytelock(vnode_t vp, u_int64_t NFSBCOPY(op->nfso_own->nfsow_owner, nlp->nfsl_openowner, NFSV4CL_LOCKNAMELEN); nlp->nfsl_seqid = 0; - nlp->nfsl_defunct = 0; + nlp->nfsl_lockflags = flags; nlp->nfsl_inprog = NULL; nfscl_lockinit(&nlp->nfsl_rwlock); LIST_INIT(&nlp->nfsl_lock); @@ -1638,7 +1640,6 @@ static void nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) { struct nfsclowner *owp, *nowp; - struct nfsclopen *op; struct nfscllockowner *lp, *nlp; struct nfscldeleg *dp; @@ -1667,15 +1668,6 @@ nfscl_cleanup_common(struct nfsclclient nfscl_freeopenowner(owp, 0); else owp->nfsow_defunct = 1; - } else { - /* look for lockowners on other opens */ - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, - NFSV4CL_LOCKNAMELEN)) - lp->nfsl_defunct = 1; - } - } } owp = nowp; } @@ -1685,13 +1677,21 @@ nfscl_cleanup_common(struct nfsclclient * Find open/lock owners for processes that have exited. */ static void -nfscl_cleanupkext(struct nfsclclient *clp) +nfscl_cleanupkext(struct nfsclclient *clp, struct nfscllockownerfhhead *lhp) { struct nfsclowner *owp, *nowp; + struct nfsclopen *op; + struct nfscllockowner *lp, *nlp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + LIST_FOREACH_SAFE(lp, &op->nfso_lock, nfsl_list, nlp) { + if (LIST_EMPTY(&lp->nfsl_lock)) + nfscl_emptylockowner(lp, lhp); + } + } if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } @@ -1699,6 +1699,58 @@ nfscl_cleanupkext(struct nfsclclient *cl NFSPROCLISTUNLOCK(); } +/* + * Take the empty lock owner and move it to the local lhp list if the + * associated process no longer exists. + */ +static void +nfscl_emptylockowner(struct nfscllockowner *lp, + struct nfscllockownerfhhead *lhp) +{ + struct nfscllockownerfh *lfhp, *mylfhp; + struct nfscllockowner *nlp; + int fnd_it; + + /* If not a Posix lock owner, just return. */ + if ((lp->nfsl_lockflags & F_POSIX) == 0) + return; + + fnd_it = 0; + mylfhp = NULL; + /* + * First, search to see if this lock owner is already in the list. + * If it is, then the associated process no longer exists. + */ + SLIST_FOREACH(lfhp, lhp, nfslfh_list) { + if (lfhp->nfslfh_len == lp->nfsl_open->nfso_fhlen && + !NFSBCMP(lfhp->nfslfh_fh, lp->nfsl_open->nfso_fh, + lfhp->nfslfh_len)) + mylfhp = lfhp; + LIST_FOREACH(nlp, &lfhp->nfslfh_lock, nfsl_list) + if (!NFSBCMP(nlp->nfsl_owner, lp->nfsl_owner, + NFSV4CL_LOCKNAMELEN)) + fnd_it = 1; + } + /* If not found, check if process still exists. */ + if (fnd_it == 0 && nfscl_procdoesntexist(lp->nfsl_owner) == 0) + return; + + /* Move the lock owner over to the local list. */ + if (mylfhp == NULL) { + mylfhp = malloc(sizeof(struct nfscllockownerfh), M_TEMP, + M_NOWAIT); + if (mylfhp == NULL) + return; + mylfhp->nfslfh_len = lp->nfsl_open->nfso_fhlen; + NFSBCOPY(lp->nfsl_open->nfso_fh, mylfhp->nfslfh_fh, + mylfhp->nfslfh_len); + LIST_INIT(&mylfhp->nfslfh_lock); + SLIST_INSERT_HEAD(lhp, mylfhp, nfslfh_list); + } + LIST_REMOVE(lp, nfsl_list); + LIST_INSERT_HEAD(&mylfhp->nfslfh_lock, lp, nfsl_list); +} + static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ /* * Called from nfs umount to free up the clientid. @@ -2331,9 +2383,8 @@ nfscl_renewthread(struct nfsclclient *cl { struct nfsclowner *owp, *nowp; struct nfsclopen *op; - struct nfscllockowner *lp, *nlp, *olp; + struct nfscllockowner *lp, *nlp; struct nfscldeleghead dh; - struct nfscllockownerhead lh; struct nfscldeleg *dp, *ndp; struct ucred *cred; u_int32_t clidrev; @@ -2341,6 +2392,8 @@ nfscl_renewthread(struct nfsclclient *cl uint32_t recover_done_time = 0; struct timespec mytime; static time_t prevsec = 0; + struct nfscllockownerfh *lfhp, *nlfhp; + struct nfscllockownerfhhead lfh; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2379,7 +2432,6 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - LIST_INIT(&lh); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); if (cbpathdown) @@ -2389,41 +2441,11 @@ nfscl_renewthread(struct nfsclclient *cl /* * Now, handle defunct owners. */ - owp = LIST_FIRST(&clp->nfsc_owner); - while (owp != NULL) { - nowp = LIST_NEXT(owp, nfsow_list); - if (LIST_EMPTY(&owp->nfsow_open)) { - if (owp->nfsow_defunct) - nfscl_freeopenowner(owp, 0); - } else { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - lp = LIST_FIRST(&op->nfso_lock); - while (lp != NULL) { - nlp = LIST_NEXT(lp, nfsl_list); - if (lp->nfsl_defunct && - LIST_EMPTY(&lp->nfsl_lock)) { - LIST_FOREACH(olp, &lh, nfsl_list) { - if (!NFSBCMP(olp->nfsl_owner, - lp->nfsl_owner,NFSV4CL_LOCKNAMELEN)) - break; - } - if (olp == NULL) { - LIST_REMOVE(lp, nfsl_list); - LIST_INSERT_HEAD(&lh, lp, nfsl_list); - } else { - nfscl_freelockowner(lp, 0); - } - } - lp = nlp; - } + LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { + if (LIST_EMPTY(&owp->nfsow_open)) { + if (owp->nfsow_defunct != 0) + nfscl_freeopenowner(owp, 0); } - } - owp = nowp; - } - - /* and release defunct lock owners */ - LIST_FOREACH_SAFE(lp, &lh, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); } /* @@ -2528,6 +2550,7 @@ tryagain: FREE((caddr_t)dp, M_NFSCLDELEG); } + SLIST_INIT(&lfh); /* * Call nfscl_cleanupkext() once per second to check for * open/lock owners where the process has exited. @@ -2535,8 +2558,26 @@ tryagain: NFSGETNANOTIME(&mytime); if (prevsec != mytime.tv_sec) { prevsec = mytime.tv_sec; - nfscl_cleanupkext(clp); + nfscl_cleanupkext(clp, &lfh); + } + + /* + * Do a ReleaseLockOwner for all lock owners where the + * associated process no longer exists, as found by + * nfscl_cleanupkext(). + */ + newnfs_setroot(cred); + SLIST_FOREACH_SAFE(lfhp, &lfh, nfslfh_list, nlfhp) { + LIST_FOREACH_SAFE(lp, &lfhp->nfslfh_lock, nfsl_list, + nlp) { + (void)nfsrpc_rellockown(clp->nfsc_nmp, lp, + lfhp->nfslfh_fh, lfhp->nfslfh_len, cred, + p); + nfscl_freelockowner(lp, 0); + } + free(lfhp, M_TEMP); } + SLIST_INIT(&lfh); NFSLOCKCLSTATE(); if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) @@ -3539,8 +3580,8 @@ nfscl_relock(vnode_t vp, struct nfsclcli off = lop->nfslo_first; len = lop->nfslo_end - lop->nfslo_first; error = nfscl_getbytelock(vp, off, len, lop->nfslo_type, cred, p, - clp, 1, NULL, 0, lp->nfsl_owner, lp->nfsl_openowner, &nlp, &newone, - &donelocally); + clp, 1, NULL, lp->nfsl_lockflags, lp->nfsl_owner, + lp->nfsl_openowner, &nlp, &newone, &donelocally); if (error || donelocally) return (error); if (nmp->nm_clp != NULL) From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 02:23:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1880106566B; Sat, 7 Jan 2012 02:23:58 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE9AE8FC18; Sat, 7 Jan 2012 02:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q072NwBx020228; Sat, 7 Jan 2012 02:23:58 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q072Nw0l020225; Sat, 7 Jan 2012 02:23:58 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201070223.q072Nw0l020225@svn.freebsd.org> From: Martin Matuska Date: Sat, 7 Jan 2012 02:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229760 - in stable/8/sys: boot/zfs cddl/boot/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 02:23:59 -0000 Author: mm Date: Sat Jan 7 02:23:58 2012 New Revision: 229760 URL: http://svn.freebsd.org/changeset/base/229760 Log: MFC r226549,r226550,r226551,r226552,r226553,r226568 MFC r226549 (pjd): Remove redundant size calculation. MFC r226550 (pjd): Initialize 'rc' properly before using it. This error could lead to infinite loop when data reconstruction was needed. MFC r226551 (pjd): Don't mark vdev as healthy too soon, so we won't try to use invalid vdevs. MFC r226552 (pjd): Never pass NULL block pointer when reading. This is neither expected nor handled by lower layers like vdev_raidz, which uses bp for checksum verification. This bug could lead to NULL pointer reference and resets during boot. MFC r226553 (pjd): Always pass data size for checksum verification function, as using physical block size declared in bp may not always be what we want. For example in case of gang block header physical block size declared in bp is much larger than SPA_GANGBLOCKSIZE (512 bytes) and checksum calculation failed. This bug could lead to accessing unallocated memory and resets/failures during boot. MFC r226568 (pjd) [1]: - Correctly read gang header from raidz. - Decompress assembled gang block data if compressed. - Verify checksum of a gang header. - Verify checksum of assembled gang block data. - Verify checksum of uber block. Submitted by: avg [1] Modified: stable/8/sys/boot/zfs/zfsimpl.c stable/8/sys/cddl/boot/zfs/zfssubr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/8/sys/boot/zfs/zfsimpl.c Sat Jan 7 02:09:49 2012 (r229759) +++ stable/8/sys/boot/zfs/zfsimpl.c Sat Jan 7 02:23:58 2012 (r229760) @@ -347,7 +347,7 @@ vdev_read_phys(vdev_t *vdev, const blkpt rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize); if (rc) return (rc); - if (bp && zio_checksum_error(bp, buf, offset)) + if (bp && zio_checksum_verify(bp, buf)) return (EIO); return (0); @@ -543,8 +543,6 @@ vdev_init_from_nvlist(const unsigned cha vdev->v_state = VDEV_STATE_DEGRADED; else if (isnt_present) vdev->v_state = VDEV_STATE_CANT_OPEN; - else - vdev->v_state = VDEV_STATE_HEALTHY; } rc = nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN, @@ -800,6 +798,7 @@ vdev_probe(vdev_phys_read_t *read, void BP_SET_PSIZE(&bp, sizeof(vdev_phys_t)); BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); + DVA_SET_OFFSET(BP_IDENTITY(&bp), off); ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); if (vdev_read_phys(&vtmp, &bp, vdev_label, off, 0)) return (EIO); @@ -912,6 +911,7 @@ vdev_probe(vdev_phys_read_t *read, void if (vdev) { vdev->v_phys_read = read; vdev->v_read_priv = read_priv; + vdev->v_state = VDEV_STATE_HEALTHY; } else { printf("ZFS: inconsistent nvlist contents\n"); return (EIO); @@ -941,7 +941,7 @@ vdev_probe(vdev_phys_read_t *read, void BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); - if (vdev_read_phys(vdev, NULL, upbuf, off, VDEV_UBERBLOCK_SIZE(vdev))) + if (vdev_read_phys(vdev, &bp, upbuf, off, 0)) continue; if (up->ub_magic != UBERBLOCK_MAGIC) @@ -974,34 +974,39 @@ ilog2(int n) } static int -zio_read_gang(spa_t *spa, const blkptr_t *bp, const dva_t *dva, void *buf) +zio_read_gang(spa_t *spa, const blkptr_t *bp, void *buf) { + blkptr_t gbh_bp; zio_gbh_phys_t zio_gb; - vdev_t *vdev; - int vdevid; - off_t offset; + char *pbuf; int i; - vdevid = DVA_GET_VDEV(dva); - offset = DVA_GET_OFFSET(dva); - STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) - if (vdev->v_id == vdevid) - break; - if (!vdev || !vdev->v_read) - return (EIO); - if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE)) + /* Artificial BP for gang block header. */ + gbh_bp = *bp; + BP_SET_PSIZE(&gbh_bp, SPA_GANGBLOCKSIZE); + BP_SET_LSIZE(&gbh_bp, SPA_GANGBLOCKSIZE); + BP_SET_CHECKSUM(&gbh_bp, ZIO_CHECKSUM_GANG_HEADER); + BP_SET_COMPRESS(&gbh_bp, ZIO_COMPRESS_OFF); + for (i = 0; i < SPA_DVAS_PER_BP; i++) + DVA_SET_GANG(&gbh_bp.blk_dva[i], 0); + + /* Read gang header block using the artificial BP. */ + if (zio_read(spa, &gbh_bp, &zio_gb)) return (EIO); + pbuf = buf; for (i = 0; i < SPA_GBH_NBLKPTRS; i++) { blkptr_t *gbp = &zio_gb.zg_blkptr[i]; if (BP_IS_HOLE(gbp)) continue; - if (zio_read(spa, gbp, buf)) + if (zio_read(spa, gbp, pbuf)) return (EIO); - buf = (char*)buf + BP_GET_PSIZE(gbp); + pbuf += BP_GET_PSIZE(gbp); } - + + if (zio_checksum_verify(bp, buf)) + return (EIO); return (0); } @@ -1024,46 +1029,41 @@ zio_read(spa_t *spa, const blkptr_t *bp, if (!dva->dva_word[0] && !dva->dva_word[1]) continue; - if (DVA_GET_GANG(dva)) { - error = zio_read_gang(spa, bp, dva, buf); - if (error != 0) - continue; - } else { - vdevid = DVA_GET_VDEV(dva); - offset = DVA_GET_OFFSET(dva); - STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) { - if (vdev->v_id == vdevid) - break; - } - if (!vdev || !vdev->v_read) - continue; + vdevid = DVA_GET_VDEV(dva); + offset = DVA_GET_OFFSET(dva); + STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) { + if (vdev->v_id == vdevid) + break; + } + if (!vdev || !vdev->v_read) + continue; - size = BP_GET_PSIZE(bp); + size = BP_GET_PSIZE(bp); + if (vdev->v_read == vdev_raidz_read) { align = 1ULL << vdev->v_top->v_ashift; if (P2PHASE(size, align) != 0) size = P2ROUNDUP(size, align); - if (size != BP_GET_PSIZE(bp) || cpfunc != ZIO_COMPRESS_OFF) - pbuf = zfs_alloc(size); - else - pbuf = buf; + } + if (size != BP_GET_PSIZE(bp) || cpfunc != ZIO_COMPRESS_OFF) + pbuf = zfs_alloc(size); + else + pbuf = buf; + if (DVA_GET_GANG(dva)) + error = zio_read_gang(spa, bp, pbuf); + else error = vdev->v_read(vdev, bp, pbuf, offset, size); - if (error == 0) { - if (cpfunc != ZIO_COMPRESS_OFF) { - error = zio_decompress_data(cpfunc, - pbuf, BP_GET_PSIZE(bp), buf, - BP_GET_LSIZE(bp)); - } else if (size != BP_GET_PSIZE(bp)) { - bcopy(pbuf, buf, BP_GET_PSIZE(bp)); - } - } - if (buf != pbuf) - zfs_free(pbuf, size); - if (error != 0) - continue; + if (error == 0) { + if (cpfunc != ZIO_COMPRESS_OFF) + error = zio_decompress_data(cpfunc, pbuf, + BP_GET_PSIZE(bp), buf, BP_GET_LSIZE(bp)); + else if (size != BP_GET_PSIZE(bp)) + bcopy(pbuf, buf, BP_GET_PSIZE(bp)); } - error = 0; - break; + if (buf != pbuf) + zfs_free(pbuf, size); + if (error == 0) + break; } if (error != 0) printf("ZFS: i/o error - all block copies unavailable\n"); Modified: stable/8/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/8/sys/cddl/boot/zfs/zfssubr.c Sat Jan 7 02:09:49 2012 (r229759) +++ stable/8/sys/cddl/boot/zfs/zfssubr.c Sat Jan 7 02:23:58 2012 (r229760) @@ -181,14 +181,17 @@ zio_checksum_label_verifier(zio_cksum_t } static int -zio_checksum_error(const blkptr_t *bp, void *data, uint64_t offset) +zio_checksum_verify(const blkptr_t *bp, void *data) { - unsigned int checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : BP_GET_CHECKSUM(bp); - uint64_t size = BP_GET_PSIZE(bp); + uint64_t size; + unsigned int checksum; zio_checksum_info_t *ci; zio_cksum_t actual_cksum, expected_cksum, verifier; int byteswap; + checksum = BP_GET_CHECKSUM(bp); + size = BP_GET_PSIZE(bp); + if (checksum >= ZIO_CHECKSUM_FUNCTIONS) return (EINVAL); ci = &zio_checksum_table[checksum]; @@ -206,7 +209,8 @@ zio_checksum_error(const blkptr_t *bp, v if (checksum == ZIO_CHECKSUM_GANG_HEADER) zio_checksum_gang_verifier(&verifier, bp); else if (checksum == ZIO_CHECKSUM_LABEL) - zio_checksum_label_verifier(&verifier, offset); + zio_checksum_label_verifier(&verifier, + DVA_GET_OFFSET(BP_IDENTITY(bp))); else verifier = bp->blk_cksum; @@ -224,7 +228,6 @@ zio_checksum_error(const blkptr_t *bp, v byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t)); } else { - ASSERT(!BP_IS_GANG(bp)); expected_cksum = bp->blk_cksum; ci->ci_func[0](data, size, &actual_cksum); } @@ -1215,15 +1218,10 @@ static void vdev_raidz_map_free(raidz_map_t *rm) { int c; - size_t size; for (c = rm->rm_firstdatacol - 1; c >= 0; c--) zfs_free(rm->rm_col[c].rc_data, rm->rm_col[c].rc_size); - size = 0; - for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) - size += rm->rm_col[c].rc_size; - zfs_free(rm, offsetof(raidz_map_t, rm_col[rm->rm_scols])); } @@ -1245,10 +1243,10 @@ vdev_child(vdev_t *pvd, uint64_t devidx) * any ereports we generate can note it. */ static int -raidz_checksum_verify(const blkptr_t *bp, void *data) +raidz_checksum_verify(const blkptr_t *bp, void *data, uint64_t size) { - return (zio_checksum_error(bp, data, 0)); + return (zio_checksum_verify(bp, data)); } /* @@ -1298,7 +1296,7 @@ raidz_parity_verify(raidz_map_t *rm) */ static int vdev_raidz_combrec(raidz_map_t *rm, const blkptr_t *bp, void *data, - off_t offset, int total_errors, int data_errors) + off_t offset, uint64_t bytes, int total_errors, int data_errors) { raidz_col_t *rc; void *orig[VDEV_RAIDZ_MAXPARITY]; @@ -1377,7 +1375,7 @@ vdev_raidz_combrec(raidz_map_t *rm, cons * success. */ code = vdev_raidz_reconstruct(rm, tgts, n); - if (raidz_checksum_verify(bp, data) == 0) { + if (raidz_checksum_verify(bp, data, bytes) == 0) { for (i = 0; i < n; i++) { c = tgts[i]; rc = &rm->rm_col[c]; @@ -1548,7 +1546,7 @@ reconstruct: */ if (total_errors <= rm->rm_firstdatacol - parity_untried) { if (data_errors == 0) { - if (raidz_checksum_verify(bp, data) == 0) { + if (raidz_checksum_verify(bp, data, bytes) == 0) { /* * If we read parity information (unnecessarily * as it happens since no reconstruction was @@ -1593,7 +1591,7 @@ reconstruct: code = vdev_raidz_reconstruct(rm, tgts, n); - if (raidz_checksum_verify(bp, data) == 0) { + if (raidz_checksum_verify(bp, data, bytes) == 0) { /* * If we read more parity disks than were used * for reconstruction, confirm that the other @@ -1633,7 +1631,9 @@ reconstruct: n = 0; for (c = 0; c < rm->rm_cols; c++) { - if (rm->rm_col[c].rc_tried) + rc = &rm->rm_col[c]; + + if (rc->rc_tried) continue; cvd = vdev_child(vd, rc->rc_devidx); @@ -1665,8 +1665,8 @@ reconstruct: if (total_errors > rm->rm_firstdatacol) { error = EIO; } else if (total_errors < rm->rm_firstdatacol && - (code = vdev_raidz_combrec(rm, bp, data, offset, total_errors, - data_errors)) != 0) { + (code = vdev_raidz_combrec(rm, bp, data, offset, bytes, + total_errors, data_errors)) != 0) { /* * If we didn't use all the available parity for the * combinatorial reconstruction, verify that the remaining From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 02:35:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45C56106566B; Sat, 7 Jan 2012 02:35:01 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32DB58FC08; Sat, 7 Jan 2012 02:35:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q072Z1LD020615; Sat, 7 Jan 2012 02:35:01 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q072Z1Sf020612; Sat, 7 Jan 2012 02:35:01 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201070235.q072Z1Sf020612@svn.freebsd.org> From: Martin Matuska Date: Sat, 7 Jan 2012 02:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229761 - stable/8/tools/tools/zfsboottest X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 02:35:01 -0000 Author: mm Date: Sat Jan 7 02:35:00 2012 New Revision: 229761 URL: http://svn.freebsd.org/changeset/base/229761 Log: MFC zfsboottest: r225608 (partial), r225609, r226611, r226612 MFC r225608 (avg, tools/ part): zfstest: rename to zfsboottest and move to tools MFC r225609 (avg): zfsboottest: some additional enhancements - redirect diagnostics printfs in the boot code to stderr - do not read trailing garbage from a trailing block of a file Also add my copyright to the file after making so many changes. MFC r226611 (pjd): - Allow to specify multiple files to check, eg. zfsboottest gpt/system0 gpt/system1 - /boot/kernel/kernel /boot/zfsloader - Instead of printing file's content calculate MD5 hash of the file, so it can be easly compared to the hash calculated via file system. - Some other minor improvements. MFC r226612 (pjd): Because ZFS boot code was very fragile in the past and real PITA to debug, introduce zfsboottest.sh script that will verify if it will be possible to boot from the given pool. # zfsboottest.sh system Where "system" is pool name of the pool we want to boot from. What is being verified by the script: - Does the pool exist? - Does it have bootfs property configured? - Is mountpoint property of the boot dataset set to 'legacy'? Dataset configured in bootfs property has to be mounted to perform more checks: - Does the /boot directory in boot dataset exist? - Is this dataset configured as root file system in /etc/fstab or set in vfs.root.mountfrom variable in /boot/loader.conf? By using zfsboottest tool the script will read all the files in /boot directory using ZFS boot code and calculate their checksums. Then, it will walk /boot directory using find(1) though regular file sytem and also read all the files in /boot directory and calculate their checksums. If any of the files cannot be looked up, read or checksum is invalid it will be reported and booting off of this pool is probably not possible. Some additional checks may be interesting as well. For example if the disks contain proper pmbr and gptzfsboot code or if all expected files in /boot/ are present. When upgrading FreeBSD, one should snapshot datasets that contain operating system, upgrade (install new world and kernel) and use zfsboottest.sh to verify if it will be possible to boot from new configuration. If all is good one should upgrade boot blocks, by eg.: # gpart -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 If something is wrong, one should rollback datasets and report the problems. Added: stable/8/tools/tools/zfsboottest/ - copied from r225608, head/tools/tools/zfsboottest/ stable/8/tools/tools/zfsboottest/zfsboottest.sh - copied unchanged from r226612, head/tools/tools/zfsboottest/zfsboottest.sh Modified: stable/8/tools/tools/zfsboottest/Makefile stable/8/tools/tools/zfsboottest/zfsboottest.c Directory Properties: stable/8/tools/ (props changed) stable/8/tools/tools/ (props changed) Modified: stable/8/tools/tools/zfsboottest/Makefile ============================================================================== --- head/tools/tools/zfsboottest/Makefile Fri Sep 16 08:22:48 2011 (r225608) +++ stable/8/tools/tools/zfsboottest/Makefile Sat Jan 7 02:35:00 2012 (r229761) @@ -2,7 +2,12 @@ .PATH: ${.CURDIR}/../../../sys/boot/zfs ${.CURDIR}/../../../sys/cddl/boot/zfs +BINDIR?= /usr/bin +SCRIPTSDIR?= /usr/bin + PROG= zfsboottest +SCRIPTS= zfsboottest.sh +SCRIPTSNAME= zfsboottest.sh NO_MAN= CFLAGS= -O1 \ @@ -12,8 +17,9 @@ CFLAGS= -O1 \ -fdiagnostics-show-option \ -W -Wextra -Wno-sign-compare -Wno-unused-parameter \ -Werror +LDFLAGS+=-lmd -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_ARCH} == "amd64" beforedepend zfsboottest.o: machine CLEANFILES+= machine machine: Modified: stable/8/tools/tools/zfsboottest/zfsboottest.c ============================================================================== --- head/tools/tools/zfsboottest/zfsboottest.c Fri Sep 16 08:22:48 2011 (r225608) +++ stable/8/tools/tools/zfsboottest/zfsboottest.c Sat Jan 7 02:35:00 2012 (r229761) @@ -1,5 +1,7 @@ /*- * Copyright (c) 2010 Doug Rabson + * Copyright (c) 2011 Andriy Gapon + * Copyright (c) 2011 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,14 +26,13 @@ * SUCH DAMAGE. */ /* $FreeBSD$ */ -/* - * Compile with 'cc -I. -I../../cddl/boot/zfs zfstest.c -o zfstest' - */ #include #include +#include #include #include +#include #include #include #include @@ -45,15 +46,19 @@ void pager_output(const char *line) { + fprintf(stderr, "%s", line); } +#define ZFS_TEST +#define printf(...) fprintf(stderr, __VA_ARGS__) #include "zfsimpl.c" +#undef printf static int vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) { - int fd = *(int *) priv; + int fd = *(int *)priv; if (pread(fd, buf, bytes, off) != bytes) return (-1); @@ -72,7 +77,7 @@ zfs_read(spa_t *spa, dnode_phys_t *dn, v n = zp->zp_size - off; rc = dnode_read(spa, dn, off, buf, n); - if (rc) + if (rc != 0) return (-rc); return (n); @@ -81,29 +86,49 @@ zfs_read(spa_t *spa, dnode_phys_t *dn, v int main(int argc, char** argv) { - char buf[512]; - int fd[100]; + char buf[512], hash[33]; + MD5_CTX ctx; struct stat sb; dnode_phys_t dn; spa_t *spa; - int i, n, off; + off_t off; + ssize_t n; + int i, failures, *fd; zfs_init(); if (argc == 1) { static char *av[] = { - "zfstest", "COPYRIGHT", - "/dev/da0p2", "/dev/da1p2", "/dev/da2p2", + "zfsboottest", + "/dev/gpt/system0", + "/dev/gpt/system1", + "-", + "/boot/zfsloader", + "/boot/support.4th", + "/boot/kernel/kernel", NULL, }; - argc = 5; + argc = sizeof(av) / sizeof(av[0]) - 1; argv = av; } - for (i = 2; i < argc; i++) { - fd[i] = open(argv[i], O_RDONLY); - if (fd[i] < 0) + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-") == 0) + break; + } + fd = malloc(sizeof(fd[0]) * (i - 1)); + if (fd == NULL) + errx(1, "Unable to allocate memory."); + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-") == 0) + break; + fd[i - 1] = open(argv[i], O_RDONLY); + if (fd[i - 1] == -1) { + warn("open(%s) failed", argv[i]); continue; - if (vdev_probe(vdev_read, &fd[i], NULL) != 0) - close(fd[i]); + } + if (vdev_probe(vdev_read, &fd[i - 1], NULL) != 0) { + warnx("vdev_probe(%s) failed", argv[i]); + close(fd[i - 1]); + } } spa_all_status(); @@ -118,27 +143,40 @@ main(int argc, char** argv) exit(1); } - if (zfs_lookup(spa, argv[1], &dn)) { - fprintf(stderr, "can't lookup\n"); - exit(1); - } - - if (zfs_dnode_stat(spa, &dn, &sb)) { - fprintf(stderr, "can't stat\n"); - exit(1); - } - + printf("\n"); + for (++i, failures = 0; i < argc; i++) { + if (zfs_lookup(spa, argv[i], &dn)) { + fprintf(stderr, "%s: can't lookup\n", argv[i]); + failures++; + continue; + } - off = 0; - do { - n = zfs_read(spa, &dn, buf, 512, off); - if (n < 0) { - fprintf(stderr, "zfs_read failed\n"); - exit(1); + if (zfs_dnode_stat(spa, &dn, &sb)) { + fprintf(stderr, "%s: can't stat\n", argv[i]); + failures++; + continue; } - write(1, buf, n); - off += n; - } while (off < sb.st_size); - return (0); + off = 0; + MD5Init(&ctx); + do { + n = sb.st_size - off; + n = n > sizeof(buf) ? sizeof(buf) : n; + n = zfs_read(spa, &dn, buf, n, off); + if (n < 0) { + fprintf(stderr, "%s: zfs_read failed\n", + argv[i]); + failures++; + break; + } + MD5Update(&ctx, buf, n); + off += n; + } while (off < sb.st_size); + if (off < sb.st_size) + continue; + MD5End(&ctx, hash); + printf("%s %s\n", hash, argv[i]); + } + + return (failures == 0 ? 0 : 1); } Copied: stable/8/tools/tools/zfsboottest/zfsboottest.sh (from r226612, head/tools/tools/zfsboottest/zfsboottest.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/tools/zfsboottest/zfsboottest.sh Sat Jan 7 02:35:00 2012 (r229761, copy of r226612, head/tools/tools/zfsboottest/zfsboottest.sh) @@ -0,0 +1,130 @@ +#!/bin/sh +# +# Copyright (c) 2011 Pawel Jakub Dawidek +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +if [ $# -ne 1 ]; then + echo "usage: zfsboottest.sh " >&2 + exit 1 +fi + +which -s zfsboottest +if [ $? -eq 0 ]; then + zfsboottest="zfsboottest" +else + if [ ! -x "/usr/src/tools/tools/zfsboottest/zfsboottest" ]; then + echo "Unable to find \"zfsboottest\" utility." >&2 + exit 1 + fi + zfsboottest="/usr/src/tools/tools/zfsboottest/zfsboottest" +fi + +startdir="/boot" + +pool="${1}" +zpool list "${pool}" >/dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "No such pool \"${pool}\"." >&2 + exit 1 +fi +bootfs=`zpool get bootfs "${pool}" | tail -1 | awk '{print $3}'` +if [ "${bootfs}" = "-" ]; then + echo "The \"bootfs\" property is not configured for pool \"${pool}\"." >&2 + exit 1 +fi +# Dataset's mountpoint property should be set to 'legacy'. +if [ "`zfs get -H -o value mountpoint ${bootfs}`" != "legacy" ]; then + echo "The \"mountpoint\" property of dataset \"${bootfs}\" should be set to \"legacy\"." >&2 + exit 1 +fi +mountpoint=`df -t zfs "${bootfs}" 2>/dev/null | tail -1 | awk '{print $6}'` +if [ -z "${mountpoint}" ]; then + echo "The \"${bootfs}\" dataset is not mounted." >&2 + exit 1 +fi +if [ ! -d "${mountpoint}${startdir}" ]; then + echo "The \"${mountpoint}${startdir}\" directory doesn't exist." >&2 + exit 1 +fi +# To be able to mount root ZFS file system we need either /etc/fstab entry +# or vfs.root.mountfrom variable set in /boot/loader.conf. +egrep -q '^'"${bootfs}"'[[:space:]]+/[[:space:]]+zfs[[:space:]]+' "${mountpoint}/etc/fstab" 2>/dev/null +if [ $? -ne 0 ]; then + egrep -q 'vfs.root.mountfrom="?'"${bootfs}"'"?[[:space:]]*$' "${mountpoint}/boot/loader.conf" 2>/dev/null + if [ $? -ne 0 ]; then + echo "To be able to boot from \"${bootfs}\", you need to declare" >&2 + echo "\"${bootfs}\" as being root file system in ${mountpoint}/etc/fstab" >&2 + echo "or add \"vfs.root.mountfrom\" variable set to \"${bootfs}\" to" >&2 + echo "${mountpoint}/boot/loader.conf." >&2 + exit 1 + fi +fi +vdevs="" +for vdev in `zpool status "${pool}" | grep ONLINE | awk '{print $1}'`; do + vdev="/dev/${vdev#/dev/}" + if [ -c "${vdev}" ]; then + if [ -z "${vdevs}" ]; then + vdevs="${vdev}" + else + vdevs="${vdevs} ${vdev}" + fi + fi +done + +list0=`mktemp /tmp/zfsboottest.XXXXXXXXXX` +if [ $? -ne 0 ]; then + echo "Unable to create temporary file." >&2 + exit 1 +fi +list1=`mktemp /tmp/zfsboottest.XXXXXXXXXX` +if [ $? -ne 0 ]; then + echo "Unable to create temporary file." >&2 + rm -f "${list0}" + exit 1 +fi + +echo "zfsboottest.sh is reading all the files in ${mountpoint}${startdir} using" +echo "boot code and using file system code." +echo "It calculates MD5 checksums for all the files and will compare them." +echo "If all files can be properly read using boot code, it is very likely you" +echo "will be able to boot from \"${pool}\" pool>:> Good luck!" +echo + +"${zfsboottest}" ${vdevs} - `find "${mountpoint}${startdir}" -type f | sed "s@^${mountpoint}@@"` | egrep '^[0-9a-z]{32} /' | sort -k 2 >"${list0}" +find "${mountpoint}${startdir}" -type f | xargs md5 -r | sed "s@ ${mountpoint}@ @" | egrep '^[0-9a-z]{32} /' | sort -k 2 >"${list1}" + +diff -u "${list0}" "${list1}" +ec=$? + +rm -f "${list0}" "${list1}" + +if [ $? -ne 0 ]; then + echo >&2 + echo "You may not be able to boot." >&2 + exit 1 +fi + +echo "OK" From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 03:32:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D14A11065673; Sat, 7 Jan 2012 03:32:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFC528FC16; Sat, 7 Jan 2012 03:32:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q073WOUi022708; Sat, 7 Jan 2012 03:32:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q073WOvK022706; Sat, 7 Jan 2012 03:32:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201070332.q073WOvK022706@svn.freebsd.org> From: Eitan Adler Date: Sat, 7 Jan 2012 03:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229763 - stable/8/sbin/md5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 03:32:24 -0000 Author: eadler (ports committer) Date: Sat Jan 7 03:32:24 2012 New Revision: 229763 URL: http://svn.freebsd.org/changeset/base/229763 Log: MFC r227491: - new sentence should start on new line. Approved by: gjb Modified: stable/8/sbin/md5/md5.1 Directory Properties: stable/8/sbin/md5/ (props changed) Modified: stable/8/sbin/md5/md5.1 ============================================================================== --- stable/8/sbin/md5/md5.1 Sat Jan 7 03:31:40 2012 (r229762) +++ stable/8/sbin/md5/md5.1 Sat Jan 7 03:32:24 2012 (r229763) @@ -78,8 +78,8 @@ The hexadecimal checksum of each file li after the options are processed. .Bl -tag -width indent .It Fl c Ar string -Compare files to this md5 string. (Note that this option is not yet useful -if multiple files are specified.) +Compare files to this md5 string. +(Note that this option is not yet useful if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 7 16:16:14 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 289E5106566C; Sat, 7 Jan 2012 16:16:14 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1013D8FC0C; Sat, 7 Jan 2012 16:16:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q07GGDeB047283; Sat, 7 Jan 2012 16:16:13 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GGDQD047281; Sat, 7 Jan 2012 16:16:13 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201071616.q07GGDQD047281@svn.freebsd.org> From: Kevin Lo Date: Sat, 7 Jan 2012 16:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229786 - stable/8/sys/dev/vte X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jan 2012 16:16:14 -0000 Author: kevlo Date: Sat Jan 7 16:16:13 2012 New Revision: 229786 URL: http://svn.freebsd.org/changeset/base/229786 Log: MFC r227871: Remove unused variable mii. This variable is initialized but not used. Reviewed by: yongari Modified: stable/8/sys/dev/vte/if_vte.c Modified: stable/8/sys/dev/vte/if_vte.c ============================================================================== --- stable/8/sys/dev/vte/if_vte.c Sat Jan 7 16:14:53 2012 (r229785) +++ stable/8/sys/dev/vte/if_vte.c Sat Jan 7 16:16:13 2012 (r229786) @@ -1621,14 +1621,12 @@ static void vte_init_locked(struct vte_softc *sc) { struct ifnet *ifp; - struct mii_data *mii; bus_addr_t paddr; uint8_t *eaddr; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - mii = device_get_softc(sc->vte_miibus); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return;