From owner-svn-src-stable@freebsd.org Sun Dec 6 00:27:37 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28139A3FE5A; Sun, 6 Dec 2015 00:27:37 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA5961FF7; Sun, 6 Dec 2015 00:27:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB60RaFx068266; Sun, 6 Dec 2015 00:27:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB60RaxT068265; Sun, 6 Dec 2015 00:27:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512060027.tB60RaxT068265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 6 Dec 2015 00:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r291878 - stable/9/lib/libc/locale X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2015 00:27:37 -0000 Author: ngie Date: Sun Dec 6 00:27:35 2015 New Revision: 291878 URL: https://svnweb.freebsd.org/changeset/base/291878 Log: MFstable/10 r291871: MFC r291296: Link localeconv(3) to localeconv_l(3) Modified: stable/9/lib/libc/locale/Makefile.inc Directory Properties: stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/locale/Makefile.inc ============================================================================== --- stable/9/lib/libc/locale/Makefile.inc Sun Dec 6 00:20:45 2015 (r291877) +++ stable/9/lib/libc/locale/Makefile.inc Sun Dec 6 00:27:35 2015 (r291878) @@ -78,6 +78,7 @@ MLINKS+=iswalnum_l.3 iswalpha_l.3 iswaln iswalnum_l.3 iswspecial_l.3 iswalnum_l.3 nextwctype_l.3 \ iswalnum_l.3 towctrans_l.3 iswalnum_l.3 wctrans_l.3 MLINKS+=isxdigit.3 ishexnumber.3 +MLINKS+=localeconv.3 localeconv_l.3 MLINKS+=mbrtowc.3 mbrtoc16.3 mbrtowc.3 mbrtoc32.3 MLINKS+=mbsrtowcs.3 mbsnrtowcs.3 MLINKS+=wcrtomb.3 c16rtomb.3 wcrtomb.3 c32rtomb.3 From owner-svn-src-stable@freebsd.org Sun Dec 6 17:11:25 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E1BD9A0D19; Sun, 6 Dec 2015 17:11:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8F7E1CB0; Sun, 6 Dec 2015 17:11:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB6HBNqq063979; Sun, 6 Dec 2015 17:11:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB6HBNhR063978; Sun, 6 Dec 2015 17:11:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512061711.tB6HBNhR063978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Dec 2015 17:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291905 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2015 17:11:25 -0000 Author: kib Date: Sun Dec 6 17:11:23 2015 New Revision: 291905 URL: https://svnweb.freebsd.org/changeset/base/291905 Log: MFC r291446: Minor cleanup. Systematically use ANSI C functions definitions. Correct type of the flags argument to the dev_pager_putpages() function. vm_pager_free_nonreq() does not exist in stable/10, this part is not merged. Modified: stable/10/sys/vm/device_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/device_pager.c ============================================================================== --- stable/10/sys/vm/device_pager.c Sun Dec 6 16:17:57 2015 (r291904) +++ stable/10/sys/vm/device_pager.c Sun Dec 6 17:11:23 2015 (r291905) @@ -60,10 +60,8 @@ static vm_object_t dev_pager_alloc(void vm_ooffset_t, struct ucred *); static void dev_pager_dealloc(vm_object_t); static int dev_pager_getpages(vm_object_t, vm_page_t *, int, int); -static void dev_pager_putpages(vm_object_t, vm_page_t *, int, - boolean_t, int *); -static boolean_t dev_pager_haspage(vm_object_t, vm_pindex_t, int *, - int *); +static void dev_pager_putpages(vm_object_t, vm_page_t *, int, int, int *); +static boolean_t dev_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); static void dev_pager_free_page(vm_object_t object, vm_page_t m); /* list of device pager objects */ @@ -101,8 +99,9 @@ static struct cdev_pager_ops old_dev_pag }; static void -dev_pager_init() +dev_pager_init(void) { + TAILQ_INIT(&dev_pager_object_list); mtx_init(&dev_pager_mtx, "dev_pager list", NULL, MTX_DEF); } @@ -231,8 +230,7 @@ dev_pager_free_page(vm_object_t object, } static void -dev_pager_dealloc(object) - vm_object_t object; +dev_pager_dealloc(vm_object_t object) { vm_page_t m; @@ -362,24 +360,18 @@ old_dev_pager_fault(vm_object_t object, } static void -dev_pager_putpages(object, m, count, sync, rtvals) - vm_object_t object; - vm_page_t *m; - int count; - boolean_t sync; - int *rtvals; +dev_pager_putpages(vm_object_t object, vm_page_t *m, int count, int flags, + int *rtvals) { panic("dev_pager_putpage called"); } static boolean_t -dev_pager_haspage(object, pindex, before, after) - vm_object_t object; - vm_pindex_t pindex; - int *before; - int *after; +dev_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, + int *after) { + if (before != NULL) *before = 0; if (after != NULL) From owner-svn-src-stable@freebsd.org Mon Dec 7 11:12:04 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBDBB9B95A5; Mon, 7 Dec 2015 11:12:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB3C11372; Mon, 7 Dec 2015 11:12:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB7BC3UY007187; Mon, 7 Dec 2015 11:12:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB7BC3VP007185; Mon, 7 Dec 2015 11:12:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512071112.tB7BC3VP007185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Dec 2015 11:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291933 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 11:12:05 -0000 Author: kib Date: Mon Dec 7 11:12:03 2015 New Revision: 291933 URL: https://svnweb.freebsd.org/changeset/base/291933 Log: MFC r290915: Do not skip a process which has inhibited thread due to the swap-out, in the OOM selection loop. Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Mon Dec 7 11:04:50 2015 (r291932) +++ stable/10/sys/vm/vm_pageout.c Mon Dec 7 11:12:03 2015 (r291933) @@ -1570,7 +1570,8 @@ vm_pageout_oom(int shortage) if (!TD_ON_RUNQ(td) && !TD_IS_RUNNING(td) && !TD_IS_SLEEPING(td) && - !TD_IS_SUSPENDED(td)) { + !TD_IS_SUSPENDED(td) && + !TD_IS_SWAPPED(td)) { thread_unlock(td); breakout = 1; break; From owner-svn-src-stable@freebsd.org Mon Dec 7 11:14:58 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 597A89B97AF; Mon, 7 Dec 2015 11:14:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34EF6186B; Mon, 7 Dec 2015 11:14:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB7BEvIY009353; Mon, 7 Dec 2015 11:14:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB7BEvaT009352; Mon, 7 Dec 2015 11:14:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512071114.tB7BEvaT009352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Dec 2015 11:14:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291934 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 11:14:58 -0000 Author: kib Date: Mon Dec 7 11:14:57 2015 New Revision: 291934 URL: https://svnweb.freebsd.org/changeset/base/291934 Log: MFC r290917: Provide the OOM-specific vm_pageout_oom_pagecount() function which estimates the amount of reclamaible memory which could be stolen if the process is killed. Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Mon Dec 7 11:12:03 2015 (r291933) +++ stable/10/sys/vm/vm_pageout.c Mon Dec 7 11:14:57 2015 (r291934) @@ -1526,6 +1526,65 @@ vm_pageout_mightbe_oom(struct vm_domain atomic_subtract_int(&vm_pageout_oom_vote, 1); } +/* + * The OOM killer is the page daemon's action of last resort when + * memory allocation requests have been stalled for a prolonged period + * of time because it cannot reclaim memory. This function computes + * the approximate number of physical pages that could be reclaimed if + * the specified address space is destroyed. + * + * Private, anonymous memory owned by the address space is the + * principal resource that we expect to recover after an OOM kill. + * Since the physical pages mapped by the address space's COW entries + * are typically shared pages, they are unlikely to be released and so + * they are not counted. + * + * To get to the point where the page daemon runs the OOM killer, its + * efforts to write-back vnode-backed pages may have stalled. This + * could be caused by a memory allocation deadlock in the write path + * that might be resolved by an OOM kill. Therefore, physical pages + * belonging to vnode-backed objects are counted, because they might + * be freed without being written out first if the address space holds + * the last reference to an unlinked vnode. + * + * Similarly, physical pages belonging to OBJT_PHYS objects are + * counted because the address space might hold the last reference to + * the object. + */ +static long +vm_pageout_oom_pagecount(struct vmspace *vmspace) +{ + vm_map_t map; + vm_map_entry_t entry; + vm_object_t obj; + long res; + + map = &vmspace->vm_map; + KASSERT(!map->system_map, ("system map")); + sx_assert(&map->lock, SA_LOCKED); + res = 0; + for (entry = map->header.next; entry != &map->header; + entry = entry->next) { + if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) + continue; + obj = entry->object.vm_object; + if (obj == NULL) + continue; + if ((entry->eflags & MAP_ENTRY_NEEDS_COPY) != 0 && + obj->ref_count != 1) + continue; + switch (obj->type) { + case OBJT_DEFAULT: + case OBJT_SWAP: + case OBJT_PHYS: + case OBJT_VNODE: + res += obj->resident_page_count; + break; + } + } + return (res); +} + void vm_pageout_oom(int shortage) { @@ -1599,12 +1658,13 @@ vm_pageout_oom(int shortage) } PROC_UNLOCK(p); size = vmspace_swap_count(vm); - vm_map_unlock_read(&vm->vm_map); if (shortage == VM_OOM_MEM) - size += vmspace_resident_count(vm); + size += vm_pageout_oom_pagecount(vm); + vm_map_unlock_read(&vm->vm_map); vmspace_free(vm); + /* - * if the this process is bigger than the biggest one + * If this process is bigger than the biggest one, * remember it. */ if (size > bigsize) { From owner-svn-src-stable@freebsd.org Mon Dec 7 11:21:51 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A75A9B9982; Mon, 7 Dec 2015 11:21:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18C5F1C93; Mon, 7 Dec 2015 11:21:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB7BLo3J010392; Mon, 7 Dec 2015 11:21:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB7BLoI6010390; Mon, 7 Dec 2015 11:21:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512071121.tB7BLoI6010390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Dec 2015 11:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291935 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 11:21:51 -0000 Author: kib Date: Mon Dec 7 11:21:49 2015 New Revision: 291935 URL: https://svnweb.freebsd.org/changeset/base/291935 Log: MFC r290920: Raise OOM when pagedaemon is unable to produce a free page in several back-to-back passes. Modified: stable/10/sys/vm/vm_page.h stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.h ============================================================================== --- stable/10/sys/vm/vm_page.h Mon Dec 7 11:14:57 2015 (r291934) +++ stable/10/sys/vm/vm_page.h Mon Dec 7 11:21:49 2015 (r291935) @@ -227,6 +227,7 @@ struct vm_domain { long vmd_segs; /* bitmask of the segments */ boolean_t vmd_oom; int vmd_pass; /* local pagedaemon pass */ + int vmd_oom_seq; int vmd_last_active_scan; struct vm_page vmd_marker; /* marker for pagedaemon private use */ }; Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Mon Dec 7 11:14:57 2015 (r291934) +++ stable/10/sys/vm/vm_pageout.c Mon Dec 7 11:21:49 2015 (r291935) @@ -121,7 +121,8 @@ static void vm_pageout(void); static void vm_pageout_init(void); static int vm_pageout_clean(vm_page_t); static void vm_pageout_scan(struct vm_domain *vmd, int pass); -static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int pass); +static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage, + int starting_page_shortage); SYSINIT(pagedaemon_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_FIRST, vm_pageout_init, NULL); @@ -158,6 +159,7 @@ int vm_pages_needed; /* Event on which int vm_pageout_deficit; /* Estimated number of pages deficit */ int vm_pageout_pages_needed; /* flag saying that the pageout daemon needs pages */ int vm_pageout_wakeup_thresh; +static int vm_pageout_oom_seq = 12; #if !defined(NO_SWAPPING) static int vm_pageout_req_swapout; /* XXX */ @@ -217,6 +219,10 @@ static int pageout_lock_miss; SYSCTL_INT(_vm, OID_AUTO, pageout_lock_miss, CTLFLAG_RD, &pageout_lock_miss, 0, "vget() lock misses during pageout"); +SYSCTL_INT(_vm, OID_AUTO, pageout_oom_seq, + CTLFLAG_RW, &vm_pageout_oom_seq, 0, + "back-to-back calls to oom detector to start OOM"); + #define VM_PAGEOUT_PAGE_COUNT 16 int vm_pageout_page_count = VM_PAGEOUT_PAGE_COUNT; @@ -941,7 +947,7 @@ vm_pageout_scan(struct vm_domain *vmd, i long min_scan; int act_delta, addl_page_shortage, deficit, maxscan, page_shortage; int vnodes_skipped = 0; - int maxlaunder, scan_tick, scanned; + int maxlaunder, scan_tick, scanned, starting_page_shortage; int lockmode; boolean_t queues_locked; @@ -981,6 +987,7 @@ vm_pageout_scan(struct vm_domain *vmd, i page_shortage = vm_paging_target() + deficit; } else page_shortage = deficit = 0; + starting_page_shortage = page_shortage; /* * maxlaunder limits the number of dirty pages we flush per scan. @@ -1358,6 +1365,12 @@ relock_queues: (void)speedup_syncer(); /* + * If the inactive queue scan fails repeatedly to meet its + * target, kill the largest process. + */ + vm_pageout_mightbe_oom(vmd, page_shortage, starting_page_shortage); + + /* * Compute the number of pages we want to try to move from the * active queue to the inactive queue. */ @@ -1469,15 +1482,6 @@ relock_queues: } } #endif - - /* - * If we are critically low on one of RAM or swap and low on - * the other, kill the largest process. However, we avoid - * doing this on the first pass in order to give ourselves a - * chance to flush out dirty vnode-backed pages and to allow - * active pages to be moved to the inactive queue and reclaimed. - */ - vm_pageout_mightbe_oom(vmd, pass); } static int vm_pageout_oom_vote; @@ -1488,12 +1492,17 @@ static int vm_pageout_oom_vote; * failed to reach free target is premature. */ static void -vm_pageout_mightbe_oom(struct vm_domain *vmd, int pass) +vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage, + int starting_page_shortage) { int old_vote; - if (pass <= 1 || !((swap_pager_avail < 64 && vm_page_count_min()) || - (swap_pager_full && vm_paging_target() > 0))) { + if (starting_page_shortage <= 0 || starting_page_shortage != + page_shortage) + vmd->vmd_oom_seq = 0; + else + vmd->vmd_oom_seq++; + if (vmd->vmd_oom_seq < vm_pageout_oom_seq) { if (vmd->vmd_oom) { vmd->vmd_oom = FALSE; atomic_subtract_int(&vm_pageout_oom_vote, 1); @@ -1501,6 +1510,12 @@ vm_pageout_mightbe_oom(struct vm_domain return; } + /* + * Do not follow the call sequence until OOM condition is + * cleared. + */ + vmd->vmd_oom_seq = 0; + if (vmd->vmd_oom) return; From owner-svn-src-stable@freebsd.org Mon Dec 7 19:19:52 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2AC39D28ED; Mon, 7 Dec 2015 19:19:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF4C31C35; Mon, 7 Dec 2015 19:19:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB7JJp4s052484; Mon, 7 Dec 2015 19:19:51 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB7JJpDg052483; Mon, 7 Dec 2015 19:19:51 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201512071919.tB7JJpDg052483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 7 Dec 2015 19:19:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291956 - in stable: 10/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 19:19:53 -0000 Author: gjb Date: Mon Dec 7 19:19:51 2015 New Revision: 291956 URL: https://svnweb.freebsd.org/changeset/base/291956 Log: Document SA-15:26 Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Mon Dec 7 19:15:52 2015 (r291955) +++ stable/10/release/doc/share/xml/security.xml Mon Dec 7 19:19:51 2015 (r291956) @@ -46,6 +46,13 @@ 26 October 2015 Multiple vulnerabilities + + + FreeBSD-SA-15:26.openssl + 5 December 2015 + Multiple vulnerabilities + From owner-svn-src-stable@freebsd.org Mon Dec 7 19:19:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 335449D28F3; Mon, 7 Dec 2015 19:19:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 006EF1C36; Mon, 7 Dec 2015 19:19:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB7JJqLC052490; Mon, 7 Dec 2015 19:19:52 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB7JJq0J052489; Mon, 7 Dec 2015 19:19:52 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201512071919.tB7JJq0J052489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 7 Dec 2015 19:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r291956 - in stable: 10/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 19:19:53 -0000 Author: gjb Date: Mon Dec 7 19:19:51 2015 New Revision: 291956 URL: https://svnweb.freebsd.org/changeset/base/291956 Log: Document SA-15:26 Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml Modified: stable/9/release/doc/share/xml/security.xml ============================================================================== --- stable/9/release/doc/share/xml/security.xml Mon Dec 7 19:15:52 2015 (r291955) +++ stable/9/release/doc/share/xml/security.xml Mon Dec 7 19:19:51 2015 (r291956) @@ -245,6 +245,13 @@ 26 October 2015 Multiple vulnerabilities + + + FreeBSD-SA-15:26.openssl + 5 December 2015 + Multiple vulnerabilities + From owner-svn-src-stable@freebsd.org Tue Dec 8 00:24:43 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EA2F9B908D; Tue, 8 Dec 2015 00:24:43 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0DF31C9B; Tue, 8 Dec 2015 00:24:42 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB80Ofir043838; Tue, 8 Dec 2015 00:24:41 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB80OfB4043837; Tue, 8 Dec 2015 00:24:41 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201512080024.tB80OfB4043837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 8 Dec 2015 00:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291974 - stable/10/gnu/usr.bin/binutils/ld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 00:24:43 -0000 Author: bdrewery Date: Tue Dec 8 00:24:41 2015 New Revision: 291974 URL: https://svnweb.freebsd.org/changeset/base/291974 Log: MFC r291226: Fix ld not respecting --sysroot. Relnotes: yes Modified: stable/10/gnu/usr.bin/binutils/ld/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/gnu/usr.bin/binutils/ld/Makefile ============================================================================== --- stable/10/gnu/usr.bin/binutils/ld/Makefile Tue Dec 8 00:22:24 2015 (r291973) +++ stable/10/gnu/usr.bin/binutils/ld/Makefile Tue Dec 8 00:24:41 2015 (r291974) @@ -54,7 +54,7 @@ FILES= ${LDSCRIPTS:S|^|ldscripts/|} FILESDIR= ${SCRIPTDIR} HOST= ${TARGET_TUPLE} -LIBSEARCHPATH= \"${TOOLS_PREFIX}/lib\":\"${TOOLS_PREFIX}/usr/lib\" +LIBSEARCHPATH= \"=/lib\":\"=/usr/lib\" .for ext in ${ELF_SCR_EXT} LDSCRIPTS+= ${NATIVE_EMULATION}.${ext} ldscripts/${NATIVE_EMULATION}.${ext}: e${NATIVE_EMULATION}.c From owner-svn-src-stable@freebsd.org Tue Dec 8 00:25:01 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80BA09B912E; Tue, 8 Dec 2015 00:25:01 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50E9C1E35; Tue, 8 Dec 2015 00:25:01 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB80P0E4043898; Tue, 8 Dec 2015 00:25:00 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB80P0kg043897; Tue, 8 Dec 2015 00:25:00 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201512080025.tB80P0kg043897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 8 Dec 2015 00:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r291975 - stable/9/gnu/usr.bin/binutils/ld X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 00:25:01 -0000 Author: bdrewery Date: Tue Dec 8 00:25:00 2015 New Revision: 291975 URL: https://svnweb.freebsd.org/changeset/base/291975 Log: MFC r291226: Fix ld not respecting --sysroot. Relnotes: yes Modified: stable/9/gnu/usr.bin/binutils/ld/Makefile Directory Properties: stable/9/gnu/usr.bin/binutils/ (props changed) Modified: stable/9/gnu/usr.bin/binutils/ld/Makefile ============================================================================== --- stable/9/gnu/usr.bin/binutils/ld/Makefile Tue Dec 8 00:24:41 2015 (r291974) +++ stable/9/gnu/usr.bin/binutils/ld/Makefile Tue Dec 8 00:25:00 2015 (r291975) @@ -49,7 +49,7 @@ FILES= ${LDSCRIPTS:S|^|ldscripts/|} FILESDIR= ${SCRIPTDIR} HOST= ${TARGET_TUPLE} -LIBSEARCHPATH= \"${TOOLS_PREFIX}/lib\":\"${TOOLS_PREFIX}/usr/lib\" +LIBSEARCHPATH= \"=/lib\":\"=/usr/lib\" .for ext in ${ELF_SCR_EXT} LDSCRIPTS+= ${NATIVE_EMULATION}.${ext} ldscripts/${NATIVE_EMULATION}.${ext}: e${NATIVE_EMULATION}.c From owner-svn-src-stable@freebsd.org Tue Dec 8 00:27:36 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6CD99B943D; Tue, 8 Dec 2015 00:27:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82C5A1081; Tue, 8 Dec 2015 00:27:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB80RZxD044017; Tue, 8 Dec 2015 00:27:35 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB80RZ8M044014; Tue, 8 Dec 2015 00:27:35 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201512080027.tB80RZ8M044014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 8 Dec 2015 00:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291976 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 00:27:36 -0000 Author: bdrewery Date: Tue Dec 8 00:27:35 2015 New Revision: 291976 URL: https://svnweb.freebsd.org/changeset/base/291976 Log: MFC r291605: Fix errors being ignored in many phases of the build since the bmake integration. Modified: stable/10/Makefile stable/10/Makefile.inc1 stable/10/UPDATING Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile ============================================================================== --- stable/10/Makefile Tue Dec 8 00:25:00 2015 (r291975) +++ stable/10/Makefile Tue Dec 8 00:27:35 2015 (r291976) @@ -366,21 +366,21 @@ make bmake: .PHONY @echo ">>> Building an up-to-date make(1)" @echo "--------------------------------------------------------------" ${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \ - ${MMAKE} obj && \ - ${MMAKE} depend && \ - ${MMAKE} all && \ + ${MMAKE} obj; \ + ${MMAKE} depend; \ + ${MMAKE} all; \ ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= tinderbox toolchains kernel-toolchains: upgrade_checks tinderbox: - @cd ${.CURDIR} && ${SUB_MAKE} DOING_TINDERBOX=YES universe + @cd ${.CURDIR}; ${SUB_MAKE} DOING_TINDERBOX=YES universe toolchains: - @cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe + @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe kernel-toolchains: - @cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe + @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe # # universe @@ -467,7 +467,7 @@ universe_${target}_kernels: universe_${t (echo "${target} 'make LINT' failed," \ "check _.${target}.makeLINT for details"| ${MAKEFAIL})) .endif - @cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \ + @cd ${.CURDIR}; ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \ universe_kernels .endif @echo ">> ${target} completed on `LC_ALL=C date`" Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Tue Dec 8 00:25:00 2015 (r291975) +++ stable/10/Makefile.inc1 Tue Dec 8 00:27:35 2015 (r291976) @@ -1167,7 +1167,7 @@ doxygen: .PHONY echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ exit 1; \ fi - ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all + ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all # # update @@ -1187,7 +1187,7 @@ update: @echo "--------------------------------------------------------------" @echo ">>> Updating ${.CURDIR} using Subversion" @echo "--------------------------------------------------------------" - @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) + @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) .endif # @@ -1211,11 +1211,11 @@ legacy: .endif .for _tool in tools/build ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ - cd ${.CURDIR}/${_tool} && \ - ${MAKE} DIRPRFX=${_tool}/ obj && \ - ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \ - ${MAKE} DIRPRFX=${_tool}/ depend && \ - ${MAKE} DIRPRFX=${_tool}/ all && \ + cd ${.CURDIR}/${_tool}; \ + ${MAKE} DIRPRFX=${_tool}/ obj; \ + ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ + ${MAKE} DIRPRFX=${_tool}/ depend; \ + ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install .endfor @@ -1379,10 +1379,10 @@ bootstrap-tools: .PHONY ${_vtfontcvt} ${_bt}-${_tool}: .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_tool} && \ - ${MAKE} DIRPRFX=${_tool}/ obj && \ - ${MAKE} DIRPRFX=${_tool}/ depend && \ - ${MAKE} DIRPRFX=${_tool}/ all && \ + cd ${.CURDIR}/${_tool}; \ + ${MAKE} DIRPRFX=${_tool}/ obj; \ + ${MAKE} DIRPRFX=${_tool}/ depend; \ + ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install bootstrap-tools: ${_bt}-${_tool} @@ -1418,16 +1418,16 @@ build-tools: .MAKE usr.bin/mkcsmapper_static \ usr.bin/vi/catalog ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ - cd ${.CURDIR}/${_tool} && \ - ${MAKE} DIRPRFX=${_tool}/ obj && \ + cd ${.CURDIR}/${_tool}; \ + ${MAKE} DIRPRFX=${_tool}/ obj; \ ${MAKE} DIRPRFX=${_tool}/ build-tools .endfor .for _tool in \ ${_gcc_tools} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ - cd ${.CURDIR}/${_tool} && \ - ${MAKE} DIRPRFX=${_tool}/ obj && \ - ${MAKE} DIRPRFX=${_tool}/ depend && \ + cd ${.CURDIR}/${_tool}; \ + ${MAKE} DIRPRFX=${_tool}/ obj; \ + ${MAKE} DIRPRFX=${_tool}/ depend; \ ${MAKE} DIRPRFX=${_tool}/ all .endfor @@ -1491,10 +1491,10 @@ cross-tools: .MAKE .PHONY ${_crunchide} \ ${_kgzip} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_tool} && \ - ${MAKE} DIRPRFX=${_tool}/ obj && \ - ${MAKE} DIRPRFX=${_tool}/ depend && \ - ${MAKE} DIRPRFX=${_tool}/ all && \ + cd ${.CURDIR}/${_tool}; \ + ${MAKE} DIRPRFX=${_tool}/ obj; \ + ${MAKE} DIRPRFX=${_tool}/ depend; \ + ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor @@ -1579,10 +1579,10 @@ native-xtools: .PHONY usr.bin/yacc \ usr.sbin/chown ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_tool} && \ - ${NXBMAKE} DIRPRFX=${_tool}/ obj && \ - ${NXBMAKE} DIRPRFX=${_tool}/ depend && \ - ${NXBMAKE} DIRPRFX=${_tool}/ all && \ + cd ${.CURDIR}/${_tool}; \ + ${NXBMAKE} DIRPRFX=${_tool}/ obj; \ + ${NXBMAKE} DIRPRFX=${_tool}/ depend; \ + ${NXBMAKE} DIRPRFX=${_tool}/ all; \ ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install .endfor @@ -1590,7 +1590,7 @@ native-xtools: .PHONY # hierarchy - ensure that all the needed directories are present # hierarchy hier: .MAKE .PHONY - ${_+_}cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs + ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs # # libraries - build all libraries, and install them under ${DESTDIR}. @@ -1600,10 +1600,10 @@ hierarchy hier: .MAKE .PHONY # ${.CURDIR}/tools/make_libdeps.sh script. # libraries: .MAKE .PHONY - ${_+_}cd ${.CURDIR} && \ - ${MAKE} -f Makefile.inc1 _prereq_libs && \ - ${MAKE} -f Makefile.inc1 _startup_libs && \ - ${MAKE} -f Makefile.inc1 _prebuild_libs && \ + ${_+_}cd ${.CURDIR}; \ + ${MAKE} -f Makefile.inc1 _prereq_libs; \ + ${MAKE} -f Makefile.inc1 _startup_libs; \ + ${MAKE} -f Makefile.inc1 _prebuild_libs; \ ${MAKE} -f Makefile.inc1 _generic_libs # @@ -1805,11 +1805,11 @@ gnu/lib/libdialog__L: lib/msun__L lib/nc ${_lib}__PL: .PHONY .MAKE .if exists(${.CURDIR}/${_lib}) ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_lib} && \ - ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \ - ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \ + cd ${.CURDIR}/${_lib}; \ + ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj; \ + ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend; \ ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \ - DIRPRFX=${_lib}/ all && \ + DIRPRFX=${_lib}/ all; \ ${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \ DIRPRFX=${_lib}/ install .endif @@ -1819,10 +1819,10 @@ ${_lib}__PL: .PHONY .MAKE ${_lib}__L: .PHONY .MAKE .if exists(${.CURDIR}/${_lib}) ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_lib} && \ - ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \ - ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \ - ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ all && \ + cd ${.CURDIR}/${_lib}; \ + ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj; \ + ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend; \ + ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ all; \ ${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ install .endif .endfor @@ -1832,11 +1832,11 @@ ${_lib}__L: .PHONY .MAKE # modules. lib/libpam__L: .PHONY .MAKE ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ - cd ${.CURDIR}/lib/libpam && \ - ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ obj && \ - ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ depend && \ + cd ${.CURDIR}/lib/libpam; \ + ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ obj; \ + ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ depend; \ ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \ - -D_NO_LIBPAM_SO_YET all && \ + -D_NO_LIBPAM_SO_YET all; \ ${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \ -D_NO_LIBPAM_SO_YET install @@ -2108,10 +2108,10 @@ _xb-bootstrap-tools: .PHONY .for _tool in \ ${_clang_tblgen} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ - cd ${.CURDIR}/${_tool} && \ - ${CDMAKE} DIRPRFX=${_tool}/ obj && \ - ${CDMAKE} DIRPRFX=${_tool}/ depend && \ - ${CDMAKE} DIRPRFX=${_tool}/ all && \ + cd ${.CURDIR}/${_tool}; \ + ${CDMAKE} DIRPRFX=${_tool}/ obj; \ + ${CDMAKE} DIRPRFX=${_tool}/ depend; \ + ${CDMAKE} DIRPRFX=${_tool}/ all; \ ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install .endfor @@ -2127,9 +2127,9 @@ _xb-cross-tools: .PHONY ${_clang} \ ${_cc} ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ - cd ${.CURDIR}/${_tool} && \ - ${CDMAKE} DIRPRFX=${_tool}/ obj && \ - ${CDMAKE} DIRPRFX=${_tool}/ depend && \ + cd ${.CURDIR}/${_tool}; \ + ${CDMAKE} DIRPRFX=${_tool}/ obj; \ + ${CDMAKE} DIRPRFX=${_tool}/ depend; \ ${CDMAKE} DIRPRFX=${_tool}/ all .endfor Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Tue Dec 8 00:25:00 2015 (r291975) +++ stable/10/UPDATING Tue Dec 8 00:27:35 2015 (r291976) @@ -400,14 +400,6 @@ older version of current is a bit fragil keep 64-bits counters. Thus all tools, that work with networking statistics, must be rebuilt (netstat(1), bsnmpd(1), etc.) -20130629: - Fix targets that run multiple make's to use && rather than ; - so that subsequent steps depend on success of previous. - - NOTE: if building 'universe' with -j* on stable/8 or stable/9 - it would be better to start the build using bmake, to avoid - overloading the machine. - 20130618: Fix a bug that allowed a tracing process (e.g. gdb) to write to a memory-mapped file in the traced process's address space From owner-svn-src-stable@freebsd.org Tue Dec 8 07:26:17 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E437B9D4345; Tue, 8 Dec 2015 07:26:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A37D1EED; Tue, 8 Dec 2015 07:26:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB87QGPI072450; Tue, 8 Dec 2015 07:26:16 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB87QGOb072449; Tue, 8 Dec 2015 07:26:16 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201512080726.tB87QGOb072449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 8 Dec 2015 07:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291986 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 07:26:18 -0000 Author: ae Date: Tue Dec 8 07:26:16 2015 New Revision: 291986 URL: https://svnweb.freebsd.org/changeset/base/291986 Log: MFC r291578: mld_v2_dispatch_general_query() is used by mld_fasttimo_vnet() to send a reply to the MLDv2 General Query. In case when router has a lot of multicast groups, the reply can take several packets due to MTU limitation. Also we have a limit MLD_MAX_RESPONSE_BURST == 4, that limits the number of packets we send in one shot. Then we recalculate the timer value and schedule the remaining packets for sending. The problem is that when we call mld_v2_dispatch_general_query() to send remaining packets, we queue new reply in the same mbuf queue. And when number of packets is bigger than MLD_MAX_RESPONSE_BURST, we get endless reply of MLDv2 reports. To fix this, add the check for remaining packets in the queue. PR: 204831 Modified: stable/10/sys/netinet6/mld6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/mld6.c ============================================================================== --- stable/10/sys/netinet6/mld6.c Tue Dec 8 06:25:52 2015 (r291985) +++ stable/10/sys/netinet6/mld6.c Tue Dec 8 07:26:16 2015 (r291986) @@ -2989,6 +2989,15 @@ mld_v2_dispatch_general_query(struct mld KASSERT(mli->mli_version == MLD_VERSION_2, ("%s: called when version %d", __func__, mli->mli_version)); + /* + * Check that there are some packets queued. If so, send them first. + * For large number of groups the reply to general query can take + * many packets, we should finish sending them before starting of + * queuing the new reply. + */ + if (mli->mli_gq.ifq_head != NULL) { + goto send; + ifp = mli->mli_ifp; IF_ADDR_RLOCK(ifp); @@ -3024,6 +3033,7 @@ mld_v2_dispatch_general_query(struct mld } IF_ADDR_RUNLOCK(ifp); +send: mld_dispatch_queue(&mli->mli_gq, MLD_MAX_RESPONSE_BURST); /* From owner-svn-src-stable@freebsd.org Tue Dec 8 07:31:27 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BE3D9D4753; Tue, 8 Dec 2015 07:31:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39A6414B8; Tue, 8 Dec 2015 07:31:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB87VQmJ073556; Tue, 8 Dec 2015 07:31:26 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB87VQ53073555; Tue, 8 Dec 2015 07:31:26 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201512080731.tB87VQ53073555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 8 Dec 2015 07:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291987 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 07:31:27 -0000 Author: ae Date: Tue Dec 8 07:31:26 2015 New Revision: 291987 URL: https://svnweb.freebsd.org/changeset/base/291987 Log: Fix typo in r291986. (this is derect commit to stable/10) Modified: stable/10/sys/netinet6/mld6.c Modified: stable/10/sys/netinet6/mld6.c ============================================================================== --- stable/10/sys/netinet6/mld6.c Tue Dec 8 07:26:16 2015 (r291986) +++ stable/10/sys/netinet6/mld6.c Tue Dec 8 07:31:26 2015 (r291987) @@ -2995,7 +2995,7 @@ mld_v2_dispatch_general_query(struct mld * many packets, we should finish sending them before starting of * queuing the new reply. */ - if (mli->mli_gq.ifq_head != NULL) { + if (mli->mli_gq.ifq_head != NULL) goto send; ifp = mli->mli_ifp; From owner-svn-src-stable@freebsd.org Tue Dec 8 07:36:27 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F7CA9D4AA4; Tue, 8 Dec 2015 07:36:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1908919EC; Tue, 8 Dec 2015 07:36:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB87aQOq075855; Tue, 8 Dec 2015 07:36:26 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB87aQub075854; Tue, 8 Dec 2015 07:36:26 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201512080736.tB87aQub075854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 8 Dec 2015 07:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r291988 - stable/9/sys/netinet6 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 07:36:27 -0000 Author: ae Date: Tue Dec 8 07:36:26 2015 New Revision: 291988 URL: https://svnweb.freebsd.org/changeset/base/291988 Log: MFC r291578: mld_v2_dispatch_general_query() is used by mld_fasttimo_vnet() to send a reply to the MLDv2 General Query. In case when router has a lot of multicast groups, the reply can take several packets due to MTU limitation. Also we have a limit MLD_MAX_RESPONSE_BURST == 4, that limits the number of packets we send in one shot. Then we recalculate the timer value and schedule the remaining packets for sending. The problem is that when we call mld_v2_dispatch_general_query() to send remaining packets, we queue new reply in the same mbuf queue. And when number of packets is bigger than MLD_MAX_RESPONSE_BURST, we get endless reply of MLDv2 reports. To fix this, add the check for remaining packets in the queue. PR: 204831 Modified: stable/9/sys/netinet6/mld6.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/mld6.c ============================================================================== --- stable/9/sys/netinet6/mld6.c Tue Dec 8 07:31:26 2015 (r291987) +++ stable/9/sys/netinet6/mld6.c Tue Dec 8 07:36:26 2015 (r291988) @@ -2989,6 +2989,15 @@ mld_v2_dispatch_general_query(struct mld KASSERT(mli->mli_version == MLD_VERSION_2, ("%s: called when version %d", __func__, mli->mli_version)); + /* + * Check that there are some packets queued. If so, send them first. + * For large number of groups the reply to general query can take + * many packets, we should finish sending them before starting of + * queuing the new reply. + */ + if (mli->mli_gq.ifq_head != NULL) + goto send; + ifp = mli->mli_ifp; IF_ADDR_RLOCK(ifp); @@ -3024,6 +3033,7 @@ mld_v2_dispatch_general_query(struct mld } IF_ADDR_RUNLOCK(ifp); +send: mld_dispatch_queue(&mli->mli_gq, MLD_MAX_RESPONSE_BURST); /* From owner-svn-src-stable@freebsd.org Tue Dec 8 07:43:13 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C1E9D304F; Tue, 8 Dec 2015 07:43:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A1D5107E; Tue, 8 Dec 2015 07:43:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB87hCJU079079; Tue, 8 Dec 2015 07:43:12 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB87hCVK079078; Tue, 8 Dec 2015 07:43:12 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201512080743.tB87hCVK079078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 8 Dec 2015 07:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291990 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 07:43:13 -0000 Author: ae Date: Tue Dec 8 07:43:12 2015 New Revision: 291990 URL: https://svnweb.freebsd.org/changeset/base/291990 Log: MFC r291579: In the same way fix the problem described in r291578 for IGMPv3. In case when router has a lot of multicast groups, the reply can take several packets due to MTU limitation. Also we have a limit IGMP_MAX_RESPONSE_BURST == 4, that limits the number of packets we send in one shot. Then we recalculate the timer value and schedule the remaining packets for sending. The problem is that when we call igmp_v3_dispatch_general_query() to send remaining packets, we queue new reply in the same mbuf queue. And when number of packets is bigger than IGMP_MAX_RESPONSE_BURST, we get endless reply of IGMPv3 reports. To fix this, add the check for remaining packets in the queue. Modified: stable/10/sys/netinet/igmp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/igmp.c ============================================================================== --- stable/10/sys/netinet/igmp.c Tue Dec 8 07:39:39 2015 (r291989) +++ stable/10/sys/netinet/igmp.c Tue Dec 8 07:43:12 2015 (r291990) @@ -3327,6 +3327,15 @@ igmp_v3_dispatch_general_query(struct ig KASSERT(igi->igi_version == IGMP_VERSION_3, ("%s: called when version %d", __func__, igi->igi_version)); + /* + * Check that there are some packets queued. If so, send them first. + * For large number of groups the reply to general query can take + * many packets, we should finish sending them before starting of + * queuing the new reply. + */ + if (igi->igi_gq.ifq_head != NULL) + goto send; + ifp = igi->igi_ifp; IF_ADDR_RLOCK(ifp); @@ -3362,6 +3371,7 @@ igmp_v3_dispatch_general_query(struct ig } IF_ADDR_RUNLOCK(ifp); +send: loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop); From owner-svn-src-stable@freebsd.org Tue Dec 8 07:47:02 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B2869D326A; Tue, 8 Dec 2015 07:47:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FFAC128B; Tue, 8 Dec 2015 07:47:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB87l1NI079487; Tue, 8 Dec 2015 07:47:01 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB87l1qR079486; Tue, 8 Dec 2015 07:47:01 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201512080747.tB87l1qR079486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 8 Dec 2015 07:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r291991 - stable/9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 07:47:02 -0000 Author: ae Date: Tue Dec 8 07:47:01 2015 New Revision: 291991 URL: https://svnweb.freebsd.org/changeset/base/291991 Log: MFC r291579: In the same way fix the problem described in r291578 for IGMPv3. In case when router has a lot of multicast groups, the reply can take several packets due to MTU limitation. Also we have a limit IGMP_MAX_RESPONSE_BURST == 4, that limits the number of packets we send in one shot. Then we recalculate the timer value and schedule the remaining packets for sending. The problem is that when we call igmp_v3_dispatch_general_query() to send remaining packets, we queue new reply in the same mbuf queue. And when number of packets is bigger than IGMP_MAX_RESPONSE_BURST, we get endless reply of IGMPv3 reports. To fix this, add the check for remaining packets in the queue. Modified: stable/9/sys/netinet/igmp.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/igmp.c ============================================================================== --- stable/9/sys/netinet/igmp.c Tue Dec 8 07:43:12 2015 (r291990) +++ stable/9/sys/netinet/igmp.c Tue Dec 8 07:47:01 2015 (r291991) @@ -3326,6 +3326,15 @@ igmp_v3_dispatch_general_query(struct ig KASSERT(igi->igi_version == IGMP_VERSION_3, ("%s: called when version %d", __func__, igi->igi_version)); + /* + * Check that there are some packets queued. If so, send them first. + * For large number of groups the reply to general query can take + * many packets, we should finish sending them before starting of + * queuing the new reply. + */ + if (igi->igi_gq.ifq_head != NULL) + goto send; + ifp = igi->igi_ifp; IF_ADDR_RLOCK(ifp); @@ -3361,6 +3370,7 @@ igmp_v3_dispatch_general_query(struct ig } IF_ADDR_RUNLOCK(ifp); +send: loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop); From owner-svn-src-stable@freebsd.org Wed Dec 9 21:34:05 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 177009D6F95; Wed, 9 Dec 2015 21:34:05 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A47E31AC3; Wed, 9 Dec 2015 21:34:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB9LY3XQ031579; Wed, 9 Dec 2015 21:34:03 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB9LY3YM031577; Wed, 9 Dec 2015 21:34:03 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512092134.tB9LY3YM031577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 9 Dec 2015 21:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292025 - in stable/10/usr.sbin/pw: . tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 21:34:05 -0000 Author: bapt Date: Wed Dec 9 21:34:03 2015 New Revision: 292025 URL: https://svnweb.freebsd.org/changeset/base/292025 Log: MFC: r291657 Fix handling of numeric-only names with pw lock Add a regression test about it PR: 204968 Modified: stable/10/usr.sbin/pw/pw_user.c stable/10/usr.sbin/pw/tests/pw_lock.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Wed Dec 9 19:25:45 2015 (r292024) +++ stable/10/usr.sbin/pw/pw_user.c Wed Dec 9 21:34:03 2015 (r292025) @@ -272,7 +272,7 @@ pw_userlock(char *arg1, int mode) char *passtmp = NULL; char *name; bool locked = false; - uid_t id; + uid_t id = (uid_t)-1; if (geteuid() != 0) errx(EX_NOPERM, "you must be root"); @@ -280,16 +280,19 @@ pw_userlock(char *arg1, int mode) if (arg1 == NULL) errx(EX_DATAERR, "username or id required"); - if (arg1[strspn(arg1, "0123456789")] == '\0') { - id = pw_checkid(arg1, UID_MAX); - name = NULL; - } else - name = arg1; - - pwd = (name != NULL) ? GETPWNAM(pw_checkname(name, 0)) : GETPWUID(id); + name = arg1; + if (arg1[strspn(name, "0123456789")] == '\0') + id = pw_checkid(name, UID_MAX); + + pwd = GETPWNAM(pw_checkname(name, 0)); + if (pwd == NULL && id != (uid_t)-1) { + pwd = GETPWUID(id); + if (pwd != NULL) + name = pwd->pw_name; + } if (pwd == NULL) { - if (name == NULL) - errx(EX_NOUSER, "no such uid `%ju'", (uintmax_t) id); + if (id == (uid_t)-1) + errx(EX_NOUSER, "no such name or uid `%ju'", (uintmax_t) id); errx(EX_NOUSER, "no such user `%s'", name); } Modified: stable/10/usr.sbin/pw/tests/pw_lock.sh ============================================================================== --- stable/10/usr.sbin/pw/tests/pw_lock.sh Wed Dec 9 19:25:45 2015 (r292024) +++ stable/10/usr.sbin/pw/tests/pw_lock.sh Wed Dec 9 21:34:03 2015 (r292025) @@ -16,7 +16,27 @@ user_locking_body() { grep "^test:\*:1001:" $HOME/master.passwd } +atf_test_case numeric_locking cleanup +numeric_locking_body() { + populate_etc_skel + ${PW} useradd test || atf_fail "Creating test user" + ${PW} lock 1001 || atf_fail "Locking the user" + atf_check -s exit:0 -o match:"^test:\*LOCKED\*\*:1001:" \ + grep "^test:\*LOCKED\*\*:1001:" $HOME/master.passwd + ${PW} unlock 1001 || atf_fail "Unlocking the user" + atf_check -s exit:0 -o match:"^test:\*:1001:" \ + grep "^test:\*:1001:" $HOME/master.passwd + # Now numeric names + ${PW} useradd -n 1001 || atf_fail "Creating test user" + ${PW} lock 1001 || atf_fail "Locking the user" + atf_check -s exit:0 -o match:"^1001:\*LOCKED\*\*:1002:" \ + grep "^1001:\*LOCKED\*\*:1002:" $HOME/master.passwd + ${PW} unlock 1001 || atf_fail "Unlocking the user" + atf_check -s exit:0 -o match:"^1001:\*:1002:" \ + grep "^1001:\*:1002:" $HOME/master.passwd +} atf_init_test_cases() { atf_add_test_case user_locking + atf_add_test_case numeric_locking } From owner-svn-src-stable@freebsd.org Wed Dec 9 21:38:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E3289D52FE; Wed, 9 Dec 2015 21:38:28 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E13AE1DD4; Wed, 9 Dec 2015 21:38:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB9LcQwT031822; Wed, 9 Dec 2015 21:38:26 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB9LcQOE031821; Wed, 9 Dec 2015 21:38:26 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512092138.tB9LcQOE031821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 9 Dec 2015 21:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292026 - stable/10/usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 21:38:28 -0000 Author: bapt Date: Wed Dec 9 21:38:26 2015 New Revision: 292026 URL: https://svnweb.freebsd.org/changeset/base/292026 Log: MFC: r291658 pw_checkname since the beginning is too strict on GECOS field, relax it a bit so gecos can be used to store multibytes data. This was unseen before FreeBSD 10.2 as this validation function was motly unused since FreeBSD 10.2 the usage of this function has been generalized to improve Reported by: des Modified: stable/10/usr.sbin/pw/pw_user.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Wed Dec 9 21:34:03 2015 (r292025) +++ stable/10/usr.sbin/pw/pw_user.c Wed Dec 9 21:38:26 2015 (r292026) @@ -640,7 +640,8 @@ pw_checkname(char *name, int gecos) } if (!reject) { while (*ch) { - if (strchr(badchars, *ch) != NULL || *ch < ' ' || + if (strchr(badchars, *ch) != NULL || + (!gecos && *ch < ' ') || *ch == 127) { reject = 1; break; From owner-svn-src-stable@freebsd.org Thu Dec 10 07:11:47 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFDD89D6EDE; Thu, 10 Dec 2015 07:11:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 800C31198; Thu, 10 Dec 2015 07:11:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBA7Bkko005015; Thu, 10 Dec 2015 07:11:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBA7BkKT005014; Thu, 10 Dec 2015 07:11:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512100711.tBA7BkKT005014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 10 Dec 2015 07:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292049 - stable/10/bin/ls/tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2015 07:11:47 -0000 Author: ngie Date: Thu Dec 10 07:11:46 2015 New Revision: 292049 URL: https://svnweb.freebsd.org/changeset/base/292049 Log: MFC r291919: Enable bin/ls testcases disabled previously because of issues with how kyua 0.11's version of report-junit was rendering non-printable characters Upgrade to kyua 0.12 to obtain a fixed version of the command Output verified with python 2.7.10's xml.dom.minidom module Sponsored by: EMC / Isilon Storage Division Modified: stable/10/bin/ls/tests/ls_tests.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/ls/tests/ls_tests.sh ============================================================================== --- stable/10/bin/ls/tests/ls_tests.sh Thu Dec 10 07:04:36 2015 (r292048) +++ stable/10/bin/ls/tests/ls_tests.sh Thu Dec 10 07:11:46 2015 (r292049) @@ -170,8 +170,6 @@ B_flag_head() B_flag_body() { - atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136" - atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" atf_check -e empty -o match:'y\\013z' -s exit:0 ls -B } @@ -467,8 +465,6 @@ b_flag_head() b_flag_body() { - atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136" - atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" atf_check -e empty -o match:'y\\vz' -s exit:0 ls -b } @@ -747,8 +743,6 @@ q_flag_and_w_flag_head() q_flag_and_w_flag_body() { - atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136" - create_test_dir test_file="$(printf "y\01z")" From owner-svn-src-stable@freebsd.org Thu Dec 10 23:44:36 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F47B9D78E3; Thu, 10 Dec 2015 23:44:36 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 014A11162; Thu, 10 Dec 2015 23:44:35 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBANiZM6097837; Thu, 10 Dec 2015 23:44:35 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBANiYmA097827; Thu, 10 Dec 2015 23:44:34 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201512102344.tBANiYmA097827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 10 Dec 2015 23:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292068 - in stable/10: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/lst.lib contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2015 23:44:36 -0000 Author: sjg Date: Thu Dec 10 23:44:34 2015 New Revision: 292068 URL: https://svnweb.freebsd.org/changeset/base/292068 Log: Merge bmake-20151201 Added: stable/10/contrib/bmake/metachar.c - copied unchanged from r289842, head/contrib/bmake/metachar.c stable/10/contrib/bmake/metachar.h - copied unchanged from r289842, head/contrib/bmake/metachar.h stable/10/contrib/bmake/mk/cython.mk - copied unchanged from r281812, head/contrib/bmake/mk/cython.mk stable/10/contrib/bmake/mk/manifest.mk - copied unchanged from r281812, head/contrib/bmake/mk/manifest.mk stable/10/contrib/bmake/mk/mkopt.sh - copied, changed from r281812, head/contrib/bmake/mk/mkopt.sh stable/10/contrib/bmake/mk/whats.mk - copied unchanged from r281812, head/contrib/bmake/mk/whats.mk stable/10/contrib/bmake/unit-tests/comment.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/comment.exp stable/10/contrib/bmake/unit-tests/comment.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/comment.mk stable/10/contrib/bmake/unit-tests/cond1.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/cond1.exp stable/10/contrib/bmake/unit-tests/cond1.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/cond1.mk stable/10/contrib/bmake/unit-tests/cond2.exp - copied unchanged from r282740, head/contrib/bmake/unit-tests/cond2.exp stable/10/contrib/bmake/unit-tests/cond2.mk - copied, changed from r282740, head/contrib/bmake/unit-tests/cond2.mk stable/10/contrib/bmake/unit-tests/doterror.exp - copied, changed from r281812, head/contrib/bmake/unit-tests/doterror.exp stable/10/contrib/bmake/unit-tests/doterror.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/doterror.mk stable/10/contrib/bmake/unit-tests/dotwait.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/dotwait.exp stable/10/contrib/bmake/unit-tests/dotwait.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/dotwait.mk stable/10/contrib/bmake/unit-tests/error.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/error.exp stable/10/contrib/bmake/unit-tests/error.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/error.mk stable/10/contrib/bmake/unit-tests/escape.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/escape.exp stable/10/contrib/bmake/unit-tests/escape.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/escape.mk stable/10/contrib/bmake/unit-tests/export-all.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/export-all.exp stable/10/contrib/bmake/unit-tests/export-all.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/export-all.mk stable/10/contrib/bmake/unit-tests/export-env.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/export-env.exp stable/10/contrib/bmake/unit-tests/export-env.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/export-env.mk stable/10/contrib/bmake/unit-tests/export.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/export.exp stable/10/contrib/bmake/unit-tests/export.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/export.mk stable/10/contrib/bmake/unit-tests/forloop.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/forloop.exp stable/10/contrib/bmake/unit-tests/forloop.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/forloop.mk stable/10/contrib/bmake/unit-tests/forsubst.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/forsubst.exp stable/10/contrib/bmake/unit-tests/forsubst.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/forsubst.mk stable/10/contrib/bmake/unit-tests/hash.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/hash.exp stable/10/contrib/bmake/unit-tests/hash.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/hash.mk stable/10/contrib/bmake/unit-tests/impsrc.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/impsrc.exp stable/10/contrib/bmake/unit-tests/impsrc.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/impsrc.mk stable/10/contrib/bmake/unit-tests/misc.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/misc.exp stable/10/contrib/bmake/unit-tests/misc.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/misc.mk stable/10/contrib/bmake/unit-tests/moderrs.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/moderrs.exp stable/10/contrib/bmake/unit-tests/moderrs.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/moderrs.mk stable/10/contrib/bmake/unit-tests/modmatch.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/modmatch.exp stable/10/contrib/bmake/unit-tests/modmatch.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/modmatch.mk stable/10/contrib/bmake/unit-tests/modmisc.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/modmisc.exp stable/10/contrib/bmake/unit-tests/modmisc.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/modmisc.mk stable/10/contrib/bmake/unit-tests/modorder.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/modorder.exp stable/10/contrib/bmake/unit-tests/modorder.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/modorder.mk stable/10/contrib/bmake/unit-tests/modts.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/modts.exp stable/10/contrib/bmake/unit-tests/modts.mk - copied, changed from r281812, head/contrib/bmake/unit-tests/modts.mk stable/10/contrib/bmake/unit-tests/modword.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/modword.exp stable/10/contrib/bmake/unit-tests/modword.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/modword.mk stable/10/contrib/bmake/unit-tests/order.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/order.exp stable/10/contrib/bmake/unit-tests/order.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/order.mk stable/10/contrib/bmake/unit-tests/phony-end.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/phony-end.exp stable/10/contrib/bmake/unit-tests/phony-end.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/phony-end.mk stable/10/contrib/bmake/unit-tests/posix.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/posix.exp stable/10/contrib/bmake/unit-tests/posix.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/posix.mk stable/10/contrib/bmake/unit-tests/posix1.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/posix1.exp stable/10/contrib/bmake/unit-tests/posix1.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/posix1.mk stable/10/contrib/bmake/unit-tests/qequals.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/qequals.exp stable/10/contrib/bmake/unit-tests/qequals.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/qequals.mk stable/10/contrib/bmake/unit-tests/suffixes.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/suffixes.exp stable/10/contrib/bmake/unit-tests/suffixes.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/suffixes.mk stable/10/contrib/bmake/unit-tests/sunshcmd.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/sunshcmd.exp stable/10/contrib/bmake/unit-tests/sunshcmd.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/sunshcmd.mk stable/10/contrib/bmake/unit-tests/sysv.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/sysv.exp stable/10/contrib/bmake/unit-tests/sysv.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/sysv.mk stable/10/contrib/bmake/unit-tests/ternary.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/ternary.exp stable/10/contrib/bmake/unit-tests/ternary.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/ternary.mk stable/10/contrib/bmake/unit-tests/unexport-env.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/unexport-env.exp stable/10/contrib/bmake/unit-tests/unexport-env.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/unexport-env.mk stable/10/contrib/bmake/unit-tests/unexport.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/unexport.exp stable/10/contrib/bmake/unit-tests/unexport.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/unexport.mk stable/10/contrib/bmake/unit-tests/varcmd.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/varcmd.exp stable/10/contrib/bmake/unit-tests/varcmd.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/varcmd.mk stable/10/contrib/bmake/unit-tests/varmisc.exp - copied, changed from r281812, head/contrib/bmake/unit-tests/varmisc.exp stable/10/contrib/bmake/unit-tests/varmisc.mk - copied, changed from r281812, head/contrib/bmake/unit-tests/varmisc.mk stable/10/contrib/bmake/unit-tests/varshell.exp - copied unchanged from r281812, head/contrib/bmake/unit-tests/varshell.exp stable/10/contrib/bmake/unit-tests/varshell.mk - copied unchanged from r281812, head/contrib/bmake/unit-tests/varshell.mk Deleted: stable/10/contrib/bmake/unit-tests/comment stable/10/contrib/bmake/unit-tests/cond1 stable/10/contrib/bmake/unit-tests/doterror stable/10/contrib/bmake/unit-tests/dotwait stable/10/contrib/bmake/unit-tests/error stable/10/contrib/bmake/unit-tests/export stable/10/contrib/bmake/unit-tests/export-all stable/10/contrib/bmake/unit-tests/export-env stable/10/contrib/bmake/unit-tests/forloop stable/10/contrib/bmake/unit-tests/forsubst stable/10/contrib/bmake/unit-tests/hash stable/10/contrib/bmake/unit-tests/misc stable/10/contrib/bmake/unit-tests/moderrs stable/10/contrib/bmake/unit-tests/modmatch stable/10/contrib/bmake/unit-tests/modmisc stable/10/contrib/bmake/unit-tests/modorder stable/10/contrib/bmake/unit-tests/modts stable/10/contrib/bmake/unit-tests/modword stable/10/contrib/bmake/unit-tests/order stable/10/contrib/bmake/unit-tests/phony-end stable/10/contrib/bmake/unit-tests/posix stable/10/contrib/bmake/unit-tests/qequals stable/10/contrib/bmake/unit-tests/sunshcmd stable/10/contrib/bmake/unit-tests/sysv stable/10/contrib/bmake/unit-tests/ternary stable/10/contrib/bmake/unit-tests/test.exp stable/10/contrib/bmake/unit-tests/unexport stable/10/contrib/bmake/unit-tests/unexport-env stable/10/contrib/bmake/unit-tests/varcmd Modified: stable/10/contrib/bmake/ChangeLog stable/10/contrib/bmake/FILES stable/10/contrib/bmake/Makefile stable/10/contrib/bmake/PSD.doc/Makefile stable/10/contrib/bmake/PSD.doc/tutorial.ms stable/10/contrib/bmake/arch.c stable/10/contrib/bmake/bmake.1 stable/10/contrib/bmake/bmake.cat1 stable/10/contrib/bmake/boot-strap stable/10/contrib/bmake/compat.c stable/10/contrib/bmake/cond.c stable/10/contrib/bmake/config.h.in stable/10/contrib/bmake/configure stable/10/contrib/bmake/configure.in stable/10/contrib/bmake/for.c stable/10/contrib/bmake/job.c stable/10/contrib/bmake/lst.h stable/10/contrib/bmake/lst.lib/lstInt.h stable/10/contrib/bmake/lst.lib/lstRemove.c stable/10/contrib/bmake/machine.sh stable/10/contrib/bmake/main.c stable/10/contrib/bmake/make-bootstrap.sh.in stable/10/contrib/bmake/make.1 stable/10/contrib/bmake/make.c stable/10/contrib/bmake/make.h stable/10/contrib/bmake/meta.c stable/10/contrib/bmake/mk/ChangeLog stable/10/contrib/bmake/mk/FILES stable/10/contrib/bmake/mk/auto.dep.mk stable/10/contrib/bmake/mk/auto.obj.mk stable/10/contrib/bmake/mk/autodep.mk stable/10/contrib/bmake/mk/dep.mk stable/10/contrib/bmake/mk/dirdeps.mk stable/10/contrib/bmake/mk/doc.mk stable/10/contrib/bmake/mk/gendirdeps.mk stable/10/contrib/bmake/mk/host-target.mk stable/10/contrib/bmake/mk/init.mk stable/10/contrib/bmake/mk/install-mk stable/10/contrib/bmake/mk/lib.mk stable/10/contrib/bmake/mk/links.mk stable/10/contrib/bmake/mk/meta.autodep.mk stable/10/contrib/bmake/mk/meta.stage.mk stable/10/contrib/bmake/mk/meta.subdir.mk stable/10/contrib/bmake/mk/meta.sys.mk stable/10/contrib/bmake/mk/meta2deps.py stable/10/contrib/bmake/mk/meta2deps.sh stable/10/contrib/bmake/mk/mk-files.txt stable/10/contrib/bmake/mk/own.mk stable/10/contrib/bmake/mk/rst2htm.mk stable/10/contrib/bmake/mk/sys.dependfile.mk stable/10/contrib/bmake/mk/sys.mk stable/10/contrib/bmake/nonints.h stable/10/contrib/bmake/os.sh stable/10/contrib/bmake/parse.c stable/10/contrib/bmake/suff.c stable/10/contrib/bmake/targ.c stable/10/contrib/bmake/unit-tests/Makefile.in stable/10/contrib/bmake/var.c stable/10/usr.bin/bmake/Makefile stable/10/usr.bin/bmake/config.h stable/10/usr.bin/bmake/unit-tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bmake/ChangeLog ============================================================================== --- stable/10/contrib/bmake/ChangeLog Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/ChangeLog Thu Dec 10 23:44:34 2015 (r292068) @@ -1,8 +1,164 @@ +2015-12-01 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20151201 + Merge with NetBSD make, pick up + o cond.c: CondCvtArg: avoid access beyond end of empty buffer. + o meta.c: meta_oodate: use lstat(2) for checking link target + in case it is a symlink. + o var.c: avoid calling brk_string and Var_Export1 with empty + strings. + +2015-11-26 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20151126 + Merge with NetBSD make, pick up + o parse.c: ParseTrackInput don't access beyond + end of old value. + +2015-10-22 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20151022 + + * Add support for BSD/OS which lacks inttypes.h + and really needs sys/param.h for sys/sysctl.h + also 'type' is not a shell builtin. + + * var.c: eliminate uint32_t and need for inttypes.h + + * main.c: PrintOnError flush stdout before run .ERROR + + * parse.c: cope with _SC_PAGESIZE not being defined. + + +2015-10-20 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20151020 + Merge with NetBSD make, pick up + o var.c: fix uninitialized var + +2015-10-12 Simon J. Gerraty + + * var.c: the conditional expressions used with ':?' can be + expensive, if already discarding do not evaluate or expand + anything. + +2015-10-10 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20151010 + Merge with NetBSD make, pick up + o Add Boolean wantit flag to Var_Subst and Var_Parse + when FALSE we know we are discarding the result and can + skip operations like Cmd_Exec. + +2015-10-09 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20151009 + Merge with NetBSD make, pick up + o var.c: don't check for NULL before free() + o meta.c: meta_oodate, do not hard code ignore of makeDependfile + +2015-09-10 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150910 + Merge with NetBSD make, pick up + o main.c: with -w print Enter/Leaving messages for objdir too + if necessary. + o centralize shell metachar handling + + * FILES: add metachar.[ch] + +2015-06-06 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150606 + Merge with NetBSD make, pick up + o make.1: document .OBJDIR target + +2015-05-05 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150505 + Merge with NetBSD make, pick up + o cond.c: be strict about lhs of comparison when evaluating .if + but less so when called from variable expansion. + o unit-tests/cond2.mk: test various error conditions + +2015-05-04 Simon J. Gerraty + + * machine.sh (MACHINE): Add Bitrig + patch from joerg@netbsd.org + +2015-04-18 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150418 + Merge with NetBSD make, pick up + o job.c: use memmove() rather than memcpy() + + * unit-tests/varshell.mk: SunOS cannot handle the TERMINATED_BY_SIGNAL + case, so skip it. + +2015-04-11 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150411 + bump version - only mk/ changes. + +2015-04-10 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150410 + Merge with NetBSD make, pick up + o document different handling of '-' in jobs mode vs compat + o fix jobs mode so that '-' only applies to whole job + when shell lacks hasErrCtl + o meta.c: use separate vars to track lcwd and latestdir (read) + per process + +2015-04-01 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150401 + Merge with NetBSD make, pick up + o meta.c: close meta file in child + + * Makefile: use BINDIR.bmake if set. + Same for MANDIR and SHAREDIR + Handy for testing release candidates + in various environments. + +2015-03-26 Simon J. Gerraty + + * move initialization of savederr to block where it is used + to avoid spurious warning from gcc5 + +2014-11-11 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20141111 + just a cooler number + +2014-11-05 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20141105 + Merge with NetBSD make, pick up + o revert major overhaul of suffix handling + and POSIX compliance - too much breakage + and impossible to make backwards compatible. + o we still have the new unit test structure which is ok. + o meta.c ensure "-- filemon" is at start of line. + +2014-09-17 Simon J. Gerraty + + * configure.in: test that result of getconf PATH_MAX is numeric + and discard if not. Apparently needed for Hurd. + +2014-08-30 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20140830 + Merge with NetBSD make, pick up + o major overhaul of suffix handling + o improved POSIX compliance + o overhauled unit-tests + 2014-06-20 Simon J. Gerraty * Makefile (MAKE_VERSION): 20140620 Merge with NetBSD make, pick up - o var.c return varNoError rather than var_Error for ::= modidiers. + o var.c return varNoError rather than var_Error for ::= modifiers. 2014-05-22 Simon J. Gerraty Modified: stable/10/contrib/bmake/FILES ============================================================================== --- stable/10/contrib/bmake/FILES Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/FILES Thu Dec 10 23:44:34 2015 (r292068) @@ -71,6 +71,8 @@ make_malloc.h makefile.in meta.c meta.h +metachar.c +metachar.h missing/sys/cdefs.h mkdeps.sh nonints.h @@ -92,35 +94,76 @@ targ.c trace.c trace.h unit-tests/Makefile.in -unit-tests/comment -unit-tests/cond1 -unit-tests/doterror -unit-tests/dotwait -unit-tests/error -unit-tests/export -unit-tests/export-all -unit-tests/export-env -unit-tests/forloop -unit-tests/forsubst -unit-tests/hash -unit-tests/misc -unit-tests/moderrs -unit-tests/modmatch -unit-tests/modmisc -unit-tests/modorder -unit-tests/modts -unit-tests/modword -unit-tests/order -unit-tests/phony-end -unit-tests/posix -unit-tests/qequals -unit-tests/sunshcmd -unit-tests/sysv -unit-tests/ternary -unit-tests/test.exp -unit-tests/unexport -unit-tests/unexport-env -unit-tests/varcmd +unit-tests/comment.exp +unit-tests/comment.mk +unit-tests/cond1.exp +unit-tests/cond1.mk +unit-tests/cond2.exp +unit-tests/cond2.mk +unit-tests/doterror.exp +unit-tests/doterror.mk +unit-tests/dotwait.exp +unit-tests/dotwait.mk +unit-tests/error.exp +unit-tests/error.mk +unit-tests/escape.exp +unit-tests/escape.mk +unit-tests/export-all.exp +unit-tests/export-all.mk +unit-tests/export-env.exp +unit-tests/export-env.mk +unit-tests/export.exp +unit-tests/export.mk +unit-tests/forloop.exp +unit-tests/forloop.mk +unit-tests/forsubst.exp +unit-tests/forsubst.mk +unit-tests/hash.exp +unit-tests/hash.mk +unit-tests/impsrc.exp +unit-tests/impsrc.mk +unit-tests/misc.exp +unit-tests/misc.mk +unit-tests/moderrs.exp +unit-tests/moderrs.mk +unit-tests/modmatch.exp +unit-tests/modmatch.mk +unit-tests/modmisc.exp +unit-tests/modmisc.mk +unit-tests/modorder.exp +unit-tests/modorder.mk +unit-tests/modts.exp +unit-tests/modts.mk +unit-tests/modword.exp +unit-tests/modword.mk +unit-tests/order.exp +unit-tests/order.mk +unit-tests/phony-end.exp +unit-tests/phony-end.mk +unit-tests/posix.exp +unit-tests/posix.mk +unit-tests/posix1.exp +unit-tests/posix1.mk +unit-tests/qequals.exp +unit-tests/qequals.mk +unit-tests/suffixes.exp +unit-tests/suffixes.mk +unit-tests/sunshcmd.exp +unit-tests/sunshcmd.mk +unit-tests/sysv.exp +unit-tests/sysv.mk +unit-tests/ternary.exp +unit-tests/ternary.mk +unit-tests/unexport-env.exp +unit-tests/unexport-env.mk +unit-tests/unexport.exp +unit-tests/unexport.mk +unit-tests/varcmd.exp +unit-tests/varcmd.mk +unit-tests/varmisc.exp +unit-tests/varmisc.mk +unit-tests/varshell.exp +unit-tests/varshell.mk util.c var.c wait.h Modified: stable/10/contrib/bmake/Makefile ============================================================================== --- stable/10/contrib/bmake/Makefile Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/Makefile Thu Dec 10 23:44:34 2015 (r292068) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.27 2014/06/20 14:51:54 sjg Exp $ +# $Id: Makefile,v 1.48 2015/12/02 00:36:42 sjg Exp $ # Base version on src date -MAKE_VERSION= 20140620 +MAKE_VERSION= 20151201 PROG= bmake @@ -18,6 +18,7 @@ SRCS= \ make.c \ make_malloc.c \ meta.c \ + metachar.c \ parse.c \ str.c \ strlist.c \ @@ -94,7 +95,7 @@ SUBDIR+= unit-tests # we skip a lot of this when building as part of FreeBSD etc. # list of OS's which are derrived from BSD4.4 -BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly +BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly MirBSD Bitrig # we are... OS!= uname -s # are we 4.4BSD ? @@ -180,9 +181,9 @@ COPTS.parse.c += -Wno-format-nonliteral COPTS.var.c += -Wno-format-nonliteral # Force these -SHAREDIR= ${prefix}/share -BINDIR= ${prefix}/bin -MANDIR= ${SHAREDIR}/man +SHAREDIR= ${SHAREDIR.bmake:U${prefix}/share} +BINDIR= ${BINDIR.bmake:U${prefix}/bin} +MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man} .if !exists(.depend) ${OBJS}: config.h Modified: stable/10/contrib/bmake/PSD.doc/Makefile ============================================================================== --- stable/10/contrib/bmake/PSD.doc/Makefile Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/PSD.doc/Makefile Thu Dec 10 23:44:34 2015 (r292068) @@ -1,8 +1,10 @@ -# $NetBSD: Makefile,v 1.2 1995/06/14 15:20:23 christos Exp $ +# $NetBSD: Makefile,v 1.4 2014/07/05 19:22:43 dholland Exp $ # @(#)Makefile 8.1 (Berkeley) 8/14/93 -DIR= psd/12.make +SECTION=reference/ref1 +ARTICLE=make SRCS= tutorial.ms MACROS= -ms +EXTRAHTMLFILES=make1.png make2.png .include Modified: stable/10/contrib/bmake/PSD.doc/tutorial.ms ============================================================================== --- stable/10/contrib/bmake/PSD.doc/tutorial.ms Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/PSD.doc/tutorial.ms Thu Dec 10 23:44:34 2015 (r292068) @@ -1,4 +1,4 @@ -.\" $NetBSD: tutorial.ms,v 1.11 2011/08/18 15:19:30 sjg Exp $ +.\" $NetBSD: tutorial.ms,v 1.12 2014/09/30 21:33:14 christos Exp $ .\" Copyright (c) 1988, 1989, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -67,6 +67,16 @@ .\" .EH 'PSD:12-%''PMake \*- A Tutorial' .OH 'PMake \*- A Tutorial''PSD:12-%' +.\" Ix is an indexing macro similar to .IX but I've disabled it for now +.\" Since that would require 2 passes and I am not in the mood for that. +.de Ix +.. +.\" Rd is section (region) define and Rm is region mention? Again disable for +.\" now. +.de Rd +.. +.de Rm +.. .\" xH is a macro to provide numbered headers that are automatically stuffed .\" into a table-of-contents, properly indented, etc. If the first argument .\" is numeric, it is taken as the depth for numbering (as for .NH), else Modified: stable/10/contrib/bmake/arch.c ============================================================================== --- stable/10/contrib/bmake/arch.c Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/arch.c Thu Dec 10 23:44:34 2015 (r292068) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.63 2012/06/12 19:21:50 joerg Exp $ */ +/* $NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.63 2012/06/12 19:21:50 joerg Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.63 2012/06/12 19:21:50 joerg Exp $"); +__RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -310,7 +310,7 @@ Arch_ParseArchive(char **linePtr, Lst no void *freeIt; char *result; - result = Var_Parse(cp, ctxt, TRUE, &length, &freeIt); + result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt); if (freeIt) free(freeIt); if (result == var_Error) { @@ -325,7 +325,7 @@ Arch_ParseArchive(char **linePtr, Lst no *cp++ = '\0'; if (subLibName) { - libName = Var_Subst(NULL, libName, ctxt, TRUE); + libName = Var_Subst(NULL, libName, ctxt, TRUE, TRUE); } @@ -351,7 +351,7 @@ Arch_ParseArchive(char **linePtr, Lst no void *freeIt; char *result; - result = Var_Parse(cp, ctxt, TRUE, &length, &freeIt); + result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt); if (freeIt) free(freeIt); if (result == var_Error) { @@ -404,7 +404,7 @@ Arch_ParseArchive(char **linePtr, Lst no char *oldMemName = memName; size_t sz; - memName = Var_Subst(NULL, memName, ctxt, TRUE); + memName = Var_Subst(NULL, memName, ctxt, TRUE, TRUE); /* * Now form an archive spec and recurse to deal with nested Modified: stable/10/contrib/bmake/bmake.1 ============================================================================== --- stable/10/contrib/bmake/bmake.1 Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/bmake.1 Thu Dec 10 23:44:34 2015 (r292068) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.229 2014/01/19 10:23:29 apb Exp $ +.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd February 14, 2014 +.Dd June 4, 2015 .Dt MAKE 1 .Os .Sh NAME @@ -209,8 +209,6 @@ Force the option to print raw values of variables. .It Ar v Print debugging information about variable assignment. -.It Ar w -Print entering and leaving directory messages, pre and post processing. .It Ar x Run shell commands with .Fl x @@ -352,6 +350,8 @@ contains a then the value will be expanded before printing. .It Fl W Treat any warnings during makefile parsing as errors. +.It Fl w +Print entering and leaving directory messages, pre and post processing. .It Fl X Don't export variables passed on the command line to the environment individually. @@ -441,17 +441,29 @@ The value need not necessarily be used to describe existing files. Expansion is in directory order, not alphabetically as done in the shell. .Sh SHELL COMMANDS -Each target may have associated with it a series of shell commands, normally +Each target may have associated with it one or more lines of shell +commands, normally used to create the target. -Each of the commands in this script +Each of the lines in this script .Em must be preceded by a tab. -While any target may appear on a dependency line, only one of these -dependencies may be followed by a creation script, unless the +(For historical reasons, spaces are not accepted.) +While targets can appear in many dependency lines if desired, by +default only one of these rules may be followed by a creation +script. +If the .Ql Ic \&:: -operator is used. +operator is used, however, all rules may include scripts and the +scripts are executed in the order found. .Pp -If the first characters of the command line are any combination of +Each line is treated as a separate shell command, unless the end of +line is escaped with a backslash +.Pq Ql \e +in which case that line and the next are combined. +.\" The escaped newline is retained and passed to the shell, which +.\" normally ignores it. +.\" However, the tab at the beginning of the following line is removed. +If the first characters of the command are any combination of .Ql Ic @ , .Ql Ic + , or @@ -469,6 +481,7 @@ This is similar to the effect of the .MA except that the effect can be limited to a single line of a script. A .Ql Ic \- +in compatibility mode causes any non-zero exit status of the command line to be ignored. .Pp When @@ -477,22 +490,21 @@ is run in jobs mode with .Fl j Ar max_jobs , the entire script for the target is fed to a single instance of the shell. -.Pp In compatibility (non-jobs) mode, each command is run in a separate process. If the command contains any shell meta characters .Pq Ql #=|^(){};&<>*?[]:$`\e\en -it will be passed to the shell, otherwise +it will be passed to the shell; otherwise .Nm will attempt direct execution. -.Pp -Since -.Nm -will -.Xr chdir 2 -to -.Ql Va .OBJDIR -before executing any targets, each child process -starts with that as its current working directory. +If a line starts with +.Ql Ic \- +and the shell has ErrCtl enabled then failure of the command line +will be ignored as in compatibility mode. +Otherwise +.Ql Ic \- +affects the entire job; +the script will stop at the first command line that fails, +but the target will not be deemed to have failed. .Pp Makefiles should be written so that the mode of .Nm @@ -500,20 +512,32 @@ operation does not change their behavior For example, any command which needs to use .Dq cd or -.Dq chdir , -without side-effect should be put in parenthesis: +.Dq chdir +without potentially changing the directory for subsequent commands +should be put in parentheses so it executes in a subshell. +To force the use of one shell, escape the line breaks so as to make +the whole script one command. +For example: .Bd -literal -offset indent - avoid-chdir-side-effects: @echo Building $@ in `pwd` - @(cd ${.CURDIR} && ${.MAKE} $@) + @(cd ${.CURDIR} && ${MAKE} $@) @echo Back in `pwd` ensure-one-shell-regardless-of-mode: - @echo Building $@ in `pwd`; \\ - (cd ${.CURDIR} && ${.MAKE} $@); \\ + @echo Building $@ in `pwd`; \e + (cd ${.CURDIR} && ${MAKE} $@); \e echo Back in `pwd` .Ed +.Pp +Since +.Nm +will +.Xr chdir 2 +to +.Ql Va .OBJDIR +before executing any targets, each child process +starts with that as its current working directory. .Sh VARIABLE ASSIGNMENTS Variables in make are much like variables in the shell, and, by tradition, consist of all upper-case letters. @@ -624,13 +648,19 @@ Variables defined in the makefile or in Variables defined as part of the command line. .It Local variables Variables that are defined specific to a certain target. +.El +.Pp +Local variables are all built in and their values vary magically from +target to target. +It is not currently possible to define new local variables. The seven local variables are as follows: -.Bl -tag -width ".ARCHIVE" +.Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as .Ql Va \&\*[Gt] . .It Va .ARCHIVE -The name of the archive file. +The name of the archive file; also known as +.Ql Va \&! . .It Va .IMPSRC In suffix-transformation rules, the name/path of the source from which the target is to be transformed (the @@ -639,7 +669,8 @@ source); also known as .Ql Va \&\*[Lt] . It is not defined in explicit rules. .It Va .MEMBER -The name of the archive member. +The name of the archive member; also known as +.Ql Va % . .It Va .OODATE The list of sources for this target that were deemed out-of-date; also known as @@ -648,31 +679,41 @@ known as The file prefix of the target, containing only the file portion, no suffix or preceding directory components; also known as .Ql Va * . +The suffix must be one of the known suffixes declared with +.Ic .SUFFIXES +or it will not be recognized. .It Va .TARGET The name of the target; also known as .Ql Va @ . .El .Pp The shorter forms -.Ql Va @ , +.Ql ( Va \*[Gt] , +.Ql Va \&! , +.Ql Va \*[Lt] , +.Ql Va % , .Ql Va \&? , -.Ql Va \&\*[Lt] , -.Ql Va \&\*[Gt] , +.Ql Va * , and -.Ql Va * +.Ql Va @ ) are permitted for backward -compatibility with historical makefiles and are not recommended. -The six variables -.Ql Va "@F" , -.Ql Va "@D" , -.Ql Va "\*[Lt]F" , -.Ql Va "\*[Lt]D" , -.Ql Va "*F" , +compatibility with historical makefiles and legacy POSIX make and are +not recommended. +.Pp +Variants of these variables with the punctuation followed immediately by +.Ql D +or +.Ql F , +e.g. +.Ql Va $(@D) , +are legacy forms equivalent to using the +.Ql :H and -.Ql Va "*D" -are permitted for compatibility with +.Ql :T +modifiers. +These forms are accepted for compatibility with .At V -makefiles and are not recommended. +makefiles and POSIX but are not recommended. .Pp Four of the local variables may be used in sources on dependency lines because they expand to the proper value for each target on the line. @@ -682,7 +723,6 @@ These variables are .Ql Va .ARCHIVE , and .Ql Va .MEMBER . -.El .Ss Additional built-in variables In addition, .Nm @@ -953,14 +993,15 @@ This is especially useful with .Ql Ev MAKEOBJDIR . .Pp .Ql Va .OBJDIR -may be modified in the makefile as a global variable. +may be modified in the makefile via the special target +.Ql Ic .OBJDIR . In all cases, .Nm will .Xr chdir 2 -to +to the specified directory if it exists, and set .Ql Va .OBJDIR -and set +and .Ql Ev PWD to that directory before executing any targets. . @@ -1961,6 +2002,15 @@ Disable parallel mode. Synonym for .Ic .NOTPARALLEL , for compatibility with other pmake variants. +.It Ic .OBJDIR +The source is a new value for +.Ql Va .OBJDIR . +If it exists, +.Nm +will +.Xr chdir 2 +to it and update the value of +.Ql Va .OBJDIR . .It Ic .ORDER The named targets are made in sequence. This ordering does not add targets to the list of targets to be made. @@ -2119,19 +2169,87 @@ system makefile system makefile directory .El .Sh COMPATIBILITY -The basic make syntax is compatible between different versions of make, +The basic make syntax is compatible between different versions of make; however the special variables, variable modifiers and conditionals are not. -.Pp -The way that parallel makes are scheduled changed in -NetBSD 4.0 -so that .ORDER and .WAIT apply recursively to the dependent nodes. -The algorithms used may change again in the future. +.Ss Older versions +An incomplete list of changes in older versions of +.Nm : .Pp The way that .for loop variables are substituted changed after NetBSD 5.0 so that they still appear to be variable expansions. In particular this stops them being treated as syntax, and removes some obscure problems using them in .if statements. +.Pp +The way that parallel makes are scheduled changed in +NetBSD 4.0 +so that .ORDER and .WAIT apply recursively to the dependent nodes. +The algorithms used may change again in the future. +.Ss Other make dialects +Other make dialects (GNU make, SVR4 make, POSIX make, etc.) do not +support most of the features of +.Nm +as described in this manual. +Most notably: +.Bl -bullet -offset indent +.It +The +.Ic .WAIT +and +.Ic .ORDER +declarations and most functionality pertaining to parallelization. +(GNU make supports parallelization but lacks these features needed to +control it effectively.) +.It +Directives, including for loops and conditionals and most of the +forms of include files. +(GNU make has its own incompatible and less powerful syntax for +conditionals.) +.It +All built-in variables that begin with a dot. +.It +Most of the special sources and targets that begin with a dot, +with the notable exception of +.Ic .PHONY , +.Ic .PRECIOUS , +and +.Ic .SUFFIXES . +.It +Variable modifiers, except for the +.Dl :old=new +string substitution, which does not portably support globbing with +.Ql % +and historically only works on declared suffixes. +.It +The +.Ic $> +variable even in its short form; most makes support this functionality +but its name varies. +.El +.Pp +Some features are somewhat more portable, such as assignment with +.Ic += , +.Ic ?= , +and +.Ic != . +The +.Ic .PATH +functionality is based on an older feature +.Ic VPATH +found in GNU make and many versions of SVR4 make; however, +historically its behavior is too ill-defined (and too buggy) to rely +upon. +.Pp +The +.Ic $@ +and +.Ic $< +variables are more or less universally portable, as is the +.Ic $(MAKE) +variable. +Basic use of suffix rules (for files only in the current directory, +not trying to chain transformations together, etc.) is also reasonably +portable. .Sh SEE ALSO .Xr mkdep 1 .Sh HISTORY Modified: stable/10/contrib/bmake/bmake.cat1 ============================================================================== --- stable/10/contrib/bmake/bmake.cat1 Thu Dec 10 22:57:27 2015 (r292067) +++ stable/10/contrib/bmake/bmake.cat1 Thu Dec 10 23:44:34 2015 (r292068) @@ -122,9 +122,6 @@ DDEESSCCRRIIPPTTIIOONN _v Print debugging information about variable assignment. - _w Print entering and leaving directory messages, pre and - post processing. - _x Run shell commands with --xx so the actual commands are printed as they are executed. @@ -221,6 +218,9 @@ DDEESSCCRRIIPPTTIIOONN --WW Treat any warnings during makefile parsing as errors. + --ww Print entering and leaving directory messages, pre and post pro- + cessing. + --XX Don't export variables passed on the command line to the environ- ment individually. Variables passed on the command line are still exported via the _M_A_K_E_F_L_A_G_S environment variable. This @@ -273,46 +273,55 @@ FFIILLEE DDEEPPEENNDDEENNCC done in the shell. SSHHEELLLL CCOOMMMMAANNDDSS - Each target may have associated with it a series of shell commands, nor- - mally used to create the target. Each of the commands in this script - _m_u_s_t be preceded by a tab. While any target may appear on a dependency - line, only one of these dependencies may be followed by a creation - script, unless the `::::' operator is used. - - If the first characters of the command line are any combination of `@@', - `++', or `--', the command is treated specially. A `@@' causes the command - not to be echoed before it is executed. A `++' causes the command to be - executed even when --nn is given. This is similar to the effect of the - .MAKE special source, except that the effect can be limited to a single - line of a script. A `--' causes any non-zero exit status of the command - line to be ignored. + Each target may have associated with it one or more lines of shell com- + mands, normally used to create the target. Each of the lines in this + script _m_u_s_t be preceded by a tab. (For historical reasons, spaces are + not accepted.) While targets can appear in many dependency lines if + desired, by default only one of these rules may be followed by a creation + script. If the `::::' operator is used, however, all rules may include + scripts and the scripts are executed in the order found. + + Each line is treated as a separate shell command, unless the end of line + is escaped with a backslash (`\') in which case that line and the next + are combined. If the first characters of the command are any combination + of `@@', `++', or `--', the command is treated specially. A `@@' causes the + command not to be echoed before it is executed. A `++' causes the command + to be executed even when --nn is given. This is similar to the effect of + the .MAKE special source, except that the effect can be limited to a sin- + gle line of a script. A `--' in compatibility mode causes any non-zero + exit status of the command line to be ignored. When bbmmaakkee is run in jobs mode with --jj _m_a_x___j_o_b_s, the entire script for - the target is fed to a single instance of the shell. - - In compatibility (non-jobs) mode, each command is run in a separate - process. If the command contains any shell meta characters - (`#=|^(){};&<>*?[]:$`\\n') it will be passed to the shell, otherwise - bbmmaakkee will attempt direct execution. - - Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each - child process starts with that as its current working directory. + the target is fed to a single instance of the shell. In compatibility + (non-jobs) mode, each command is run in a separate process. If the com- + mand contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n') it + will be passed to the shell; otherwise bbmmaakkee will attempt direct execu- + tion. If a line starts with `--' and the shell has ErrCtl enabled then + failure of the command line will be ignored as in compatibility mode. + Otherwise `--' affects the entire job; the script will stop at the first + command line that fails, but the target will not be deemed to have + failed. Makefiles should be written so that the mode of bbmmaakkee operation does not change their behavior. For example, any command which needs to use - ``cd'' or ``chdir'', without side-effect should be put in parenthesis: - + ``cd'' or ``chdir'' without potentially changing the directory for subse- + quent commands should be put in parentheses so it executes in a subshell. + To force the use of one shell, escape the line breaks so as to make the + whole script one command. For example: avoid-chdir-side-effects: @echo Building $@ in `pwd` - @(cd ${.CURDIR} && ${.MAKE} $@) + @(cd ${.CURDIR} && ${MAKE} $@) @echo Back in `pwd` ensure-one-shell-regardless-of-mode: @echo Building $@ in `pwd`; \ - (cd ${.CURDIR} && ${.MAKE} $@); \ + (cd ${.CURDIR} && ${MAKE} $@); \ echo Back in `pwd` + Since bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' before executing any targets, each + child process starts with that as its current working directory. + VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS Variables in make are much like variables in the shell, and, by tradi- tion, consist of all upper-case letters. @@ -402,40 +411,47 @@ VVAARRIIAABBLLEE AASSSSIIGG Variables defined as part of the command line. Local variables - Variables that are defined specific to a certain target. The - seven local variables are as follows: + Variables that are defined specific to a certain target. + + Local variables are all built in and their values vary magically from + target to target. It is not currently possible to define new local vari- + ables. The seven local variables are as follows: - _._A_L_L_S_R_C The list of all sources for this target; also known as - `_>'. + _._A_L_L_S_R_C The list of all sources for this target; also known as + `_>'. - _._A_R_C_H_I_V_E The name of the archive file. + _._A_R_C_H_I_V_E The name of the archive file; also known as `_!'. - _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the - source from which the target is to be transformed (the - ``implied'' source); also known as `_<'. It is not - defined in explicit rules. + _._I_M_P_S_R_C In suffix-transformation rules, the name/path of the + source from which the target is to be transformed (the + ``implied'' source); also known as `_<'. It is not + defined in explicit rules. - _._M_E_M_B_E_R The name of the archive member. + _._M_E_M_B_E_R The name of the archive member; also known as `_%'. - _._O_O_D_A_T_E The list of sources for this target that were deemed - out-of-date; also known as `_?'. + _._O_O_D_A_T_E The list of sources for this target that were deemed out- + of-date; also known as `_?'. - _._P_R_E_F_I_X The file prefix of the target, containing only the file - portion, no suffix or preceding directory components; - also known as `_*'. + _._P_R_E_F_I_X The file prefix of the target, containing only the file + portion, no suffix or preceding directory components; + also known as `_*'. The suffix must be one of the known + suffixes declared with ..SSUUFFFFIIXXEESS or it will not be recog- + nized. - _._T_A_R_G_E_T The name of the target; also known as `_@'. + _._T_A_R_G_E_T The name of the target; also known as `_@'. - The shorter forms `_@', `_?', `_<', `_>', and `_*' are permitted for - backward compatibility with historical makefiles and are not rec- - ommended. The six variables `_@_F', `_@_D', `_<_F', `_<_D', `_*_F', and - `_*_D' are permitted for compatibility with AT&T System V UNIX - makefiles and are not recommended. + The shorter forms (`_>', `_!', `_<', `_%', `_?', `_*', and `_@') are permitted + for backward compatibility with historical makefiles and legacy POSIX + make and are not recommended. - Four of the local variables may be used in sources on dependency - lines because they expand to the proper value for each target on - the line. These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', - and `_._M_E_M_B_E_R'. + Variants of these variables with the punctuation followed immediately by + `D' or `F', e.g. `_$_(_@_D_)', are legacy forms equivalent to using the `:H' + and `:T' modifiers. These forms are accepted for compatibility with AT&T + System V UNIX makefiles and POSIX but are not recommended. + + Four of the local variables may be used in sources on dependency lines + because they expand to the proper value for each target on the line. + These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E', and `_._M_E_M_B_E_R'. AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess In addition, bbmmaakkee sets or knows about the following variables: @@ -631,10 +647,10 @@ VVAARRIIAABBLLEE AASSSSIIGG may be used. This is especially useful with `MAKEOBJDIR'. - `_._O_B_J_D_I_R' may be modified in the makefile as a global - variable. In all cases, bbmmaakkee will chdir(2) to `_._O_B_J_D_I_R' - and set `PWD' to that directory before executing any tar- - gets. + `_._O_B_J_D_I_R' may be modified in the makefile via the special + target `..OOBBJJDDIIRR'. In all cases, bbmmaakkee will chdir(2) to + the specified directory if it exists, and set `_._O_B_J_D_I_R' + and `PWD' to that directory before executing any targets. _._P_A_R_S_E_D_I_R A path to the directory of the current `_M_a_k_e_f_i_l_e' being parsed. @@ -1255,6 +1271,9 @@ SSPPEECCIIAALL TTAARRGGEETT Synonym for ..NNOOTTPPAARRAALLLLEELL, for compatibility with other pmake variants. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Dec 11 06:41:03 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A68749D5750; Fri, 11 Dec 2015 06:41:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 642A81006; Fri, 11 Dec 2015 06:41:03 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBB6f2iQ041869; Fri, 11 Dec 2015 06:41:02 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBB6f1Fe041861; Fri, 11 Dec 2015 06:41:01 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201512110641.tBB6f1Fe041861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Fri, 11 Dec 2015 06:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292089 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 06:41:03 -0000 Author: arybchik Date: Fri Dec 11 06:41:01 2015 New Revision: 292089 URL: https://svnweb.freebsd.org/changeset/base/292089 Log: sfxge: implement interface statistics shown by netstat PR: 202907 Submitted by: Boris Misenov Reviewed by: gnn, philip Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D4317 Modified: stable/10/sys/dev/sfxge/sfxge.c stable/10/sys/dev/sfxge/sfxge.h stable/10/sys/dev/sfxge/sfxge_port.c stable/10/sys/dev/sfxge/sfxge_tx.c stable/10/sys/dev/sfxge/sfxge_tx.h stable/10/sys/dev/sfxge/sfxge_version.h Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Fri Dec 11 06:28:15 2015 (r292088) +++ stable/10/sys/dev/sfxge/sfxge.c Fri Dec 11 06:41:01 2015 (r292089) @@ -69,10 +69,10 @@ __FBSDID("$FreeBSD$"); IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6 | \ IFCAP_TSO4 | IFCAP_TSO6 | \ IFCAP_JUMBO_MTU | \ - IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) + IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWSTATS) #define SFXGE_CAP_ENABLE SFXGE_CAP #define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | \ - IFCAP_JUMBO_MTU | IFCAP_LINKSTATE) + IFCAP_JUMBO_MTU | IFCAP_LINKSTATE | IFCAP_HWSTATS) MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver"); @@ -94,6 +94,14 @@ SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_ring, &sfxge_tx_ring_entries, 0, "Maximum number of descriptors in a transmit ring"); +#define SFXGE_PARAM_STATS_UPDATE_PERIOD SFXGE_PARAM(stats_update_period) +static int sfxge_stats_update_period = SFXGE_CALLOUT_TICKS; +TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD, + &sfxge_stats_update_period); +SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period, CTLFLAG_RDTUN, + &sfxge_stats_update_period, 0, + "netstat interface statistics update period in ticks"); + static void sfxge_reset(void *arg, int npending); @@ -506,10 +514,24 @@ sfxge_if_ioctl(struct ifnet *ifp, unsign } static void +sfxge_tick(void *arg) +{ + struct sfxge_softc *sc = arg; + + sfxge_port_update_stats(sc); + sfxge_tx_update_stats(sc); + + callout_reset(&sc->tick_callout, sfxge_stats_update_period, + sfxge_tick, sc); +} + +static void sfxge_ifnet_fini(struct ifnet *ifp) { struct sfxge_softc *sc = ifp->if_softc; + callout_drain(&sc->tick_callout); + SFXGE_ADAPTER_LOCK(sc); sfxge_stop(sc); SFXGE_ADAPTER_UNLOCK(sc); @@ -555,10 +577,15 @@ sfxge_ifnet_init(struct ifnet *ifp, stru ifp->if_transmit = sfxge_if_transmit; ifp->if_qflush = sfxge_if_qflush; + callout_init(&sc->tick_callout, B_TRUE); + DBGPRINT(sc->dev, "ifmedia_init"); if ((rc = sfxge_port_ifmedia_init(sc)) != 0) goto fail; + callout_reset(&sc->tick_callout, sfxge_stats_update_period, + sfxge_tick, sc); + return (0); fail: Modified: stable/10/sys/dev/sfxge/sfxge.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.h Fri Dec 11 06:28:15 2015 (r292088) +++ stable/10/sys/dev/sfxge/sfxge.h Fri Dec 11 06:41:01 2015 (r292089) @@ -121,6 +121,8 @@ enum sfxge_evq_state { #define SFXGE_EV_BATCH 16384 +#define SFXGE_CALLOUT_TICKS 100 + struct sfxge_evq { /* Structure members below are sorted by usage order */ struct sfxge_softc *sc; @@ -274,6 +276,8 @@ struct sfxge_softc { size_t rx_buffer_align; uma_zone_t rx_buffer_zone; + struct callout tick_callout; + unsigned int evq_max; unsigned int evq_count; unsigned int rxq_count; @@ -349,6 +353,7 @@ extern void sfxge_mac_link_update(struct efx_link_mode_t mode); extern int sfxge_mac_filter_set(struct sfxge_softc *sc); extern int sfxge_port_ifmedia_init(struct sfxge_softc *sc); +extern void sfxge_port_update_stats(struct sfxge_softc *sc); #define SFXGE_MAX_MTU (9 * 1024) Modified: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Fri Dec 11 06:28:15 2015 (r292088) +++ stable/10/sys/dev/sfxge/sfxge_port.c Fri Dec 11 06:41:01 2015 (r292089) @@ -87,6 +87,41 @@ out: return (rc); } +void +sfxge_port_update_stats(struct sfxge_softc *sc) +{ + struct ifnet *ifp; + uint64_t *mac_stats; + + SFXGE_PORT_LOCK(&sc->port); + + /* Ignore error and use old values */ + (void)sfxge_mac_stat_update(sc); + + ifp = sc->ifnet; + mac_stats = (uint64_t *)sc->port.mac_stats.decode_buf; + + ifp->if_ipackets = mac_stats[EFX_MAC_RX_PKTS]; + ifp->if_ierrors = mac_stats[EFX_MAC_RX_ERRORS]; + ifp->if_opackets = mac_stats[EFX_MAC_TX_PKTS]; + ifp->if_oerrors = mac_stats[EFX_MAC_TX_ERRORS]; + ifp->if_collisions = + mac_stats[EFX_MAC_TX_SGL_COL_PKTS] + + mac_stats[EFX_MAC_TX_MULT_COL_PKTS] + + mac_stats[EFX_MAC_TX_EX_COL_PKTS] + + mac_stats[EFX_MAC_TX_LATE_COL_PKTS]; + ifp->if_ibytes = mac_stats[EFX_MAC_RX_OCTETS]; + ifp->if_obytes = mac_stats[EFX_MAC_TX_OCTETS]; + /* if_imcasts is maintained in net/if_ethersubr.c */ + ifp->if_omcasts = + mac_stats[EFX_MAC_TX_MULTICST_PKTS] + + mac_stats[EFX_MAC_TX_BRDCST_PKTS]; + /* if_iqdrops is maintained in net/if_ethersubr.c */ + /* if_noproto is maintained in net/if_ethersubr.c */ + + SFXGE_PORT_UNLOCK(&sc->port); +} + static int sfxge_mac_stat_handler(SYSCTL_HANDLER_ARGS) { Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Fri Dec 11 06:28:15 2015 (r292088) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Fri Dec 11 06:41:01 2015 (r292089) @@ -1683,6 +1683,35 @@ sfxge_tx_stat_init(struct sfxge_softc *s } } +static uint64_t +sfxge_tx_get_drops(struct sfxge_softc *sc) +{ + unsigned int index; + uint64_t drops = 0; + struct sfxge_txq *txq; + + /* Sum across all TX queues */ + for (index = 0; index < sc->txq_count; index++) { + txq = sc->txq[index]; + /* + * In theory, txq->put_overflow and txq->netdown_drops + * should use atomic operation and other should be + * obtained under txq lock, but it is just statistics. + */ + drops += txq->drops + txq->get_overflow + + txq->get_non_tcp_overflow + + txq->put_overflow + txq->netdown_drops + + txq->tso_pdrop_too_many + txq->tso_pdrop_no_rsrc; + } + return (drops); +} + +void +sfxge_tx_update_stats(struct sfxge_softc *sc) +{ + sc->ifnet->if_oerrors += sfxge_tx_get_drops(sc); +} + void sfxge_tx_fini(struct sfxge_softc *sc) { Modified: stable/10/sys/dev/sfxge/sfxge_tx.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.h Fri Dec 11 06:28:15 2015 (r292088) +++ stable/10/sys/dev/sfxge/sfxge_tx.h Fri Dec 11 06:41:01 2015 (r292089) @@ -220,6 +220,7 @@ struct sfxge_txq { struct sfxge_evq; +extern void sfxge_tx_update_stats(struct sfxge_softc *sc); extern int sfxge_tx_init(struct sfxge_softc *sc); extern void sfxge_tx_fini(struct sfxge_softc *sc); Modified: stable/10/sys/dev/sfxge/sfxge_version.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_version.h Fri Dec 11 06:28:15 2015 (r292088) +++ stable/10/sys/dev/sfxge/sfxge_version.h Fri Dec 11 06:41:01 2015 (r292089) @@ -36,6 +36,6 @@ #ifndef _SFXGE_VERSION_H #define _SFXGE_VERSION_H -#define SFXGE_VERSION_STRING "v4.5.2.1000" +#define SFXGE_VERSION_STRING "v4.5.3.1002" #endif /* _SFXGE_DRIVER_VERSION_H */ From owner-svn-src-stable@freebsd.org Fri Dec 11 12:16:07 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 038FB9D53D9; Fri, 11 Dec 2015 12:16:07 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C58E810AC; Fri, 11 Dec 2015 12:16:06 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBCG5sU044331; Fri, 11 Dec 2015 12:16:05 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBCG5BI044327; Fri, 11 Dec 2015 12:16:05 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111216.tBBCG5BI044327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 12:16:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292094 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 12:16:07 -0000 Author: smh Date: Fri Dec 11 12:16:05 2015 New Revision: 292094 URL: https://svnweb.freebsd.org/changeset/base/292094 Log: MFC r277084,r277088,r277130,r277143,r277151,r277262 r277084: Intel I40E updates ixl v1.3.0 and ixlv 1.2.0 featuring RSS r277088, r277130, r277143, r277151 & r277262: Misc RSS fixes The main change is the addition of RSS, which is not supported in stable/10, however these commits also include other bug fixes. In order to bring those fixes in and facilitate easier merge of future updates the RSS changes are maintained but left disabled by the removal of the opt_rss.h include. Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/if_ixl.c stable/10/sys/dev/ixl/if_ixlv.c stable/10/sys/dev/ixl/ixl.h stable/10/sys/dev/ixl/ixl_txrx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 11:08:00 2015 (r292093) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:16:05 2015 (r292094) @@ -37,10 +37,14 @@ #include "ixl.h" #include "ixl_pf.h" +#ifdef RSS +#include +#endif + /********************************************************************* * Driver version *********************************************************************/ -char ixl_driver_version[] = "1.2.8"; +char ixl_driver_version[] = "1.3.1"; /********************************************************************* * PCI Device ID Table @@ -174,7 +178,7 @@ static void ixl_stat_update48(struct i40 static void ixl_stat_update32(struct i40e_hw *, u32, bool, u64 *, u64 *); -#ifdef IXL_DEBUG +#ifdef IXL_DEBUG_SYSCTL static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); @@ -427,7 +431,7 @@ ixl_attach(device_t dev) OID_AUTO, "dynamic_tx_itr", CTLFLAG_RW, &ixl_dynamic_tx_itr, 0, "Dynamic TX ITR"); -#ifdef IXL_DEBUG +#ifdef IXL_DEBUG_SYSCTL SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "link_status", CTLTYPE_STRING | CTLFLAG_RD, @@ -662,8 +666,9 @@ ixl_attach(device_t dev) /* Reset port's advertised speeds */ if (!i40e_is_40G_device(hw->device_id)) { - pf->advertised_speed = 0x7; - ixl_set_advertised_speeds(pf, 0x7); + pf->advertised_speed = + (hw->device_id == I40E_DEV_ID_10G_BASE_T) ? 0x7 : 0x6; + ixl_set_advertised_speeds(pf, pf->advertised_speed); } /* Register for VLAN events */ @@ -1407,6 +1412,12 @@ ixl_media_status(struct ifnet * ifp, str case I40E_PHY_TYPE_10GBASE_SFPP_CU: ifmr->ifm_active |= IFM_10G_TWINAX; break; + case I40E_PHY_TYPE_10GBASE_KR: + /* + ** this is not technically correct + ** but FreeBSD does not have the media + ** type defined yet, so its a compromise. + */ case I40E_PHY_TYPE_10GBASE_SR: ifmr->ifm_active |= IFM_10G_SR; break; @@ -1721,8 +1732,10 @@ ixl_local_timer(void *arg) vsi->active_queues |= ((u64)1 << que->me); } if (que->busy >= IXL_MAX_TX_BUSY) { +#ifdef IXL_DEBUG device_printf(dev,"Warning queue %d " "appears to be hung!\n", i); +#endif que->busy = IXL_QUEUE_HUNG; ++hung; } @@ -1765,6 +1778,15 @@ ixl_update_link_status(struct ixl_pf *pf "Full Duplex", ixl_fc_string[fc]); } vsi->link_active = TRUE; + /* + ** Warn user if link speed on NPAR enabled + ** partition is not at least 10GB + */ + if (hw->func_caps.npar_enable && + (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB || + hw->phy.link_info.link_speed == I40E_LINK_SPEED_100MB)) + device_printf(dev, "The partition detected link" + "speed that is less than 10Gbps\n"); if_link_state_change(ifp, LINK_STATE_UP); } } else { /* Link down */ @@ -1901,6 +1923,7 @@ ixl_assign_vsi_msix(struct ixl_pf *pf) /* Now set up the stations */ for (int i = 0; i < vsi->num_queues; i++, vector++, que++) { + int cpu_id = i; rid = vector + 1; txr = &que->txr; que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -1921,14 +1944,23 @@ ixl_assign_vsi_msix(struct ixl_pf *pf) } bus_describe_intr(dev, que->res, que->tag, "q%d", i); /* Bind the vector to a CPU */ - bus_bind_intr(dev, que->res, i); +#ifdef RSS + cpu_id = rss_getcpu(i % rss_getnumbuckets()); +#endif + bus_bind_intr(dev, que->res, cpu_id); que->msix = vector; TASK_INIT(&que->tx_task, 0, ixl_deferred_mq_start, que); TASK_INIT(&que->task, 0, ixl_handle_que, que); que->tq = taskqueue_create_fast("ixl_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); - taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", - device_get_nameunit(pf->dev)); +#ifdef RSS + taskqueue_start_threads_pinned(&que->tq, 1, PI_NET, + cpu_id, "%s (bucket %d)", + device_get_nameunit(dev), cpu_id); +#else + taskqueue_start_threads(&que->tq, 1, PI_NET, + "%s que", device_get_nameunit(dev)); +#endif } return (0); @@ -1995,6 +2027,12 @@ ixl_init_msix(struct ixl_pf *pf) if ((ixl_max_queues != 0) && (ixl_max_queues <= queues)) queues = ixl_max_queues; +#ifdef RSS + /* If we're doing RSS, clamp at the number of RSS buckets */ + if (queues > rss_getnumbuckets()) + queues = rss_getnumbuckets(); +#endif + /* ** Want one vector (RX/TX pair) per queue ** plus an additional for the admin queue. @@ -2015,6 +2053,25 @@ ixl_init_msix(struct ixl_pf *pf) "Using MSIX interrupts with %d vectors\n", vectors); pf->msix = vectors; pf->vsi.num_queues = queues; +#ifdef RSS + /* + * If we're doing RSS, the number of queues needs to + * match the number of RSS buckets that are configured. + * + * + If there's more queues than RSS buckets, we'll end + * up with queues that get no traffic. + * + * + If there's more RSS buckets than queues, we'll end + * up having multiple RSS buckets map to the same queue, + * so there'll be some contention. + */ + if (queues != rss_getnumbuckets()) { + device_printf(dev, + "%s: queues (%d) != RSS buckets (%d)" + "; performance will be impacted.\n", + __func__, queues, rss_getnumbuckets()); + } +#endif return (vectors); } msi: @@ -2383,7 +2440,8 @@ ixl_setup_interface(device_t dev, struct if (aq_error == I40E_ERR_UNKNOWN_PHY) { /* Need delay to detect fiber correctly */ i40e_msec_delay(200); - aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, TRUE, &abilities_resp, NULL); + aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, + TRUE, &abilities_resp, NULL); if (aq_error == I40E_ERR_UNKNOWN_PHY) device_printf(dev, "Unknown PHY type detected!\n"); else @@ -3043,7 +3101,6 @@ ixl_add_sysctls_eth_stats(struct sysctl_ "Multicast Packets Transmitted"}, {ð_stats->tx_broadcast, "bcast_pkts_txd", "Broadcast Packets Transmitted"}, - {ð_stats->tx_discards, "tx_discards", "Discarded TX packets"}, // end {0,0,0} }; @@ -3126,19 +3183,45 @@ static void ixl_config_rss(struct ixl_vs struct ixl_pf *pf = (struct ixl_pf *)vsi->back; struct i40e_hw *hw = vsi->hw; u32 lut = 0; - u64 set_hena, hena; - int i, j; + u64 set_hena = 0, hena; + int i, j, que_id; +#ifdef RSS + u32 rss_hash_config; + u32 rss_seed[IXL_KEYSZ]; +#else + u32 rss_seed[IXL_KEYSZ] = {0x41b01687, + 0x183cfd8c, 0xce880440, 0x580cbc3c, + 0x35897377, 0x328b25e1, 0x4fa98922, + 0xb7d90c14, 0xd5bad70d, 0xcd15a2c1}; +#endif - static const u32 seed[I40E_PFQF_HKEY_MAX_INDEX + 1] = {0x41b01687, - 0x183cfd8c, 0xce880440, 0x580cbc3c, 0x35897377, - 0x328b25e1, 0x4fa98922, 0xb7d90c14, 0xd5bad70d, - 0xcd15a2c1, 0xe8580225, 0x4a1e9d11, 0xfe5731be}; +#ifdef RSS + /* Fetch the configured RSS key */ + rss_getkey((uint8_t *) &rss_seed); +#endif /* Fill out hash function seed */ - for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) - wr32(hw, I40E_PFQF_HKEY(i), seed[i]); + for (i = 0; i < IXL_KEYSZ; i++) + wr32(hw, I40E_PFQF_HKEY(i), rss_seed[i]); /* Enable PCTYPES for RSS: */ +#ifdef RSS + rss_hash_config = rss_gethashconfig(); + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV4) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER); + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV4) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP); + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP); + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER); + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6); + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_TCP); + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_UDP); +#else set_hena = ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | @@ -3151,7 +3234,7 @@ static void ixl_config_rss(struct ixl_vs ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6) | ((u64)1 << I40E_FILTER_PCTYPE_L2_PAYLOAD); - +#endif hena = (u64)rd32(hw, I40E_PFQF_HENA(0)) | ((u64)rd32(hw, I40E_PFQF_HENA(1)) << 32); hena |= set_hena; @@ -3162,8 +3245,19 @@ static void ixl_config_rss(struct ixl_vs for (i = j = 0; i < pf->hw.func_caps.rss_table_size; i++, j++) { if (j == vsi->num_queues) j = 0; +#ifdef RSS + /* + * Fetch the RSS bucket id for the given indirection entry. + * Cap it at the number of configured buckets (which is + * num_queues.) + */ + que_id = rss_get_indirection_to_bucket(i); + que_id = que_id % vsi->num_queues; +#else + que_id = j; +#endif /* lut = 4-byte sliding window of 4 lut entries */ - lut = (lut << 8) | (j & + lut = (lut << 8) | (que_id & ((0x1 << pf->hw.func_caps.rss_table_entry_width) - 1)); /* On i = 3, we have 4 entries in lut; write to the register */ if ((i & 3) == 3) @@ -3401,7 +3495,7 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt, M_DEVBUF, M_NOWAIT | M_ZERO); if (a == NULL) { - device_printf(dev, "add hw filter failed to get memory\n"); + device_printf(dev, "add_hw_filters failed to get memory\n"); return; } @@ -3426,8 +3520,8 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, if (j > 0) { err = i40e_aq_add_macvlan(hw, vsi->seid, a, j, NULL); if (err) - device_printf(dev, "aq_add_macvlan failure %d\n", - hw->aq.asq_last_status); + device_printf(dev, "aq_add_macvlan err %d, aq_error %d\n", + err, hw->aq.asq_last_status); else vsi->hw_filters_add += j; } @@ -3476,6 +3570,7 @@ ixl_del_hw_filters(struct ixl_vsi *vsi, err = i40e_aq_remove_macvlan(hw, vsi->seid, d, j, NULL); /* NOTE: returns ENOENT every time but seems to work fine, so we'll ignore that specific error. */ + // TODO: Does this still occur on current firmwares? if (err && hw->aq.asq_last_status != I40E_AQ_RC_ENOENT) { int sc = 0; for (int i = 0; i < j; i++) @@ -3828,29 +3923,6 @@ ixl_update_stats_counters(struct ixl_pf pf->stat_offsets_loaded, &osd->link_xoff_tx, &nsd->link_xoff_tx); - /* Priority flow control stats */ -#if 0 - for (int i = 0; i < 8; i++) { - ixl_stat_update32(hw, I40E_GLPRT_PXONRXC(hw->port, i), - pf->stat_offsets_loaded, - &osd->priority_xon_rx[i], - &nsd->priority_xon_rx[i]); - ixl_stat_update32(hw, I40E_GLPRT_PXONTXC(hw->port, i), - pf->stat_offsets_loaded, - &osd->priority_xon_tx[i], - &nsd->priority_xon_tx[i]); - ixl_stat_update32(hw, I40E_GLPRT_PXOFFTXC(hw->port, i), - pf->stat_offsets_loaded, - &osd->priority_xoff_tx[i], - &nsd->priority_xoff_tx[i]); - ixl_stat_update32(hw, - I40E_GLPRT_RXON2OFFCNT(hw->port, i), - pf->stat_offsets_loaded, - &osd->priority_xon_2_xoff[i], - &nsd->priority_xon_2_xoff[i]); - } -#endif - /* Packet size stats rx */ ixl_stat_update48(hw, I40E_GLPRT_PRC64H(hw->port), I40E_GLPRT_PRC64L(hw->port), @@ -4377,6 +4449,15 @@ ixl_set_advertised_speeds(struct ixl_pf return (EAGAIN); } + /* + ** This seems a bit heavy handed, but we + ** need to get a reinit on some devices + */ + IXL_PF_LOCK(pf); + ixl_stop(pf); + ixl_init_locked(pf); + IXL_PF_UNLOCK(pf); + return (0); } @@ -4521,7 +4602,7 @@ ixl_sysctl_show_fw(SYSCTL_HANDLER_ARGS) } -#ifdef IXL_DEBUG +#ifdef IXL_DEBUG_SYSCTL static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS) { @@ -4630,6 +4711,16 @@ ixl_sysctl_sw_filter_list(SYSCTL_HANDLER #define IXL_SW_RES_SIZE 0x14 static int +ixl_res_alloc_cmp(const void *a, const void *b) +{ + const struct i40e_aqc_switch_resource_alloc_element_resp *one, *two; + one = (struct i40e_aqc_switch_resource_alloc_element_resp *)a; + two = (struct i40e_aqc_switch_resource_alloc_element_resp *)b; + + return ((int)one->resource_type - (int)two->resource_type); +} + +static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS) { struct ixl_pf *pf = (struct ixl_pf *)arg1; @@ -4647,6 +4738,7 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A return (ENOMEM); } + bzero(resp, sizeof(resp)); error = i40e_aq_get_switch_resource_alloc(hw, &num_entries, resp, IXL_SW_RES_SIZE, @@ -4657,9 +4749,14 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A sbuf_delete(buf); return error; } - device_printf(dev, "Num_entries: %d\n", num_entries); + + /* Sort entries by type for display */ + qsort(resp, num_entries, + sizeof(struct i40e_aqc_switch_resource_alloc_element_resp), + &ixl_res_alloc_cmp); sbuf_cat(buf, "\n"); + sbuf_printf(buf, "# of entries: %d\n", num_entries); sbuf_printf(buf, "Type | Guaranteed | Total | Used | Un-allocated\n" " | (this) | (all) | (this) | (all) \n"); @@ -4847,5 +4944,5 @@ ixl_sysctl_dump_txd(SYSCTL_HANDLER_ARGS) sbuf_delete(buf); return error; } -#endif +#endif /* IXL_DEBUG_SYSCTL */ Modified: stable/10/sys/dev/ixl/if_ixlv.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixlv.c Fri Dec 11 11:08:00 2015 (r292093) +++ stable/10/sys/dev/ixl/if_ixlv.c Fri Dec 11 12:16:05 2015 (r292094) @@ -37,10 +37,14 @@ #include "ixl.h" #include "ixlv.h" +#ifdef RSS +#include +#endif + /********************************************************************* * Driver version *********************************************************************/ -char ixlv_driver_version[] = "1.1.18"; +char ixlv_driver_version[] = "1.2.1"; /********************************************************************* * PCI Device ID Table @@ -1161,7 +1165,11 @@ ixlv_init_msix(struct ixlv_sc *sc) /* Override with hardcoded value if sane */ if ((ixlv_max_queues != 0) && (ixlv_max_queues <= queues)) queues = ixlv_max_queues; - +#ifdef RSS + /* If we're doing RSS, clamp at the number of RSS buckets */ + if (queues > rss_getnumbuckets()) + queues = rss_getnumbuckets(); +#endif /* Enforce the VF max value */ if (queues > IXLV_MAX_QUEUES) queues = IXLV_MAX_QUEUES; @@ -1181,6 +1189,26 @@ ixlv_init_msix(struct ixlv_sc *sc) goto fail; } +#ifdef RSS + /* + * If we're doing RSS, the number of queues needs to + * match the number of RSS buckets that are configured. + * + * + If there's more queues than RSS buckets, we'll end + * up with queues that get no traffic. + * + * + If there's more RSS buckets than queues, we'll end + * up having multiple RSS buckets map to the same queue, + * so there'll be some contention. + */ + if (queues != rss_getnumbuckets()) { + device_printf(dev, + "%s: queues (%d) != RSS buckets (%d)" + "; performance will be impacted.\n", + __func__, queues, rss_getnumbuckets()); + } +#endif + if (pci_alloc_msix(dev, &vectors) == 0) { device_printf(sc->dev, "Using MSIX interrupts with %d vectors\n", vectors); @@ -1352,6 +1380,7 @@ ixlv_assign_msix(struct ixlv_sc *sc) int error, rid, vector = 1; for (int i = 0; i < vsi->num_queues; i++, vector++, que++) { + int cpu_id = i; rid = vector + 1; txr = &que->txr; que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -1372,15 +1401,25 @@ ixlv_assign_msix(struct ixlv_sc *sc) } bus_describe_intr(dev, que->res, que->tag, "que %d", i); /* Bind the vector to a CPU */ - bus_bind_intr(dev, que->res, i); +#ifdef RSS + cpu_id = rss_getcpu(i % rss_getnumbuckets()); +#endif + bus_bind_intr(dev, que->res, cpu_id); que->msix = vector; vsi->que_mask |= (u64)(1 << que->msix); TASK_INIT(&que->tx_task, 0, ixl_deferred_mq_start, que); TASK_INIT(&que->task, 0, ixlv_handle_que, que); que->tq = taskqueue_create_fast("ixlv_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); - taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", - device_get_nameunit(sc->dev)); +#ifdef RSS + taskqueue_start_threads_pinned(&que->tq, 1, PI_NET, + cpu_id, "%s (bucket %d)", + device_get_nameunit(dev), cpu_id); +#else + taskqueue_start_threads(&que->tq, 1, PI_NET, + "%s que", device_get_nameunit(dev)); +#endif + } return (0); @@ -2521,16 +2560,18 @@ ixlv_config_rss(struct ixlv_sc *sc) struct i40e_hw *hw = &sc->hw; struct ixl_vsi *vsi = &sc->vsi; u32 lut = 0; - u64 set_hena, hena; - int i, j; - - /* set up random bits */ - static const u32 seed[I40E_VFQF_HKEY_MAX_INDEX + 1] = { - 0x794221b4, 0xbca0c5ab, 0x6cd5ebd9, 0x1ada6127, - 0x983b3aa1, 0x1c4e71eb, 0x7f6328b2, 0xfcdc0da0, - 0xc135cafa, 0x7a6f7e2d, 0xe7102d28, 0x163cd12e, - 0x4954b126 }; - + u64 set_hena = 0, hena; + int i, j, que_id; +#ifdef RSS + u32 rss_hash_config; + u32 rss_seed[IXL_KEYSZ]; +#else + u32 rss_seed[IXL_KEYSZ] = {0x41b01687, + 0x183cfd8c, 0xce880440, 0x580cbc3c, + 0x35897377, 0x328b25e1, 0x4fa98922, + 0xb7d90c14, 0xd5bad70d, 0xcd15a2c1}; +#endif + /* Don't set up RSS if using a single queue */ if (vsi->num_queues == 1) { wr32(hw, I40E_VFQF_HENA(0), 0); @@ -2539,11 +2580,32 @@ ixlv_config_rss(struct ixlv_sc *sc) return; } +#ifdef RSS + /* Fetch the configured RSS key */ + rss_getkey((uint8_t *) &rss_seed); +#endif /* Fill out hash function seed */ - for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) - wr32(hw, I40E_VFQF_HKEY(i), seed[i]); + for (i = 0; i <= IXL_KEYSZ; i++) + wr32(hw, I40E_VFQF_HKEY(i), rss_seed[i]); /* Enable PCTYPES for RSS: */ +#ifdef RSS + rss_hash_config = rss_gethashconfig(); + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV4) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER); + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV4) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP); + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP); + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER); + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6); + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_TCP); + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_UDP); +#else set_hena = ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | @@ -2556,7 +2618,7 @@ ixlv_config_rss(struct ixlv_sc *sc) ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6) | ((u64)1 << I40E_FILTER_PCTYPE_L2_PAYLOAD); - +#endif hena = (u64)rd32(hw, I40E_VFQF_HENA(0)) | ((u64)rd32(hw, I40E_VFQF_HENA(1)) << 32); hena |= set_hena; @@ -2564,16 +2626,26 @@ ixlv_config_rss(struct ixlv_sc *sc) wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32)); /* Populate the LUT with max no. of queues in round robin fashion */ - for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; j++) { + for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++, j++) { if (j == vsi->num_queues) j = 0; +#ifdef RSS + /* + * Fetch the RSS bucket id for the given indirection entry. + * Cap it at the number of configured buckets (which is + * num_queues.) + */ + que_id = rss_get_indirection_to_bucket(i); + que_id = que_id % vsi->num_queues; +#else + que_id = j; +#endif /* lut = 4-byte sliding window of 4 lut entries */ - lut = (lut << 8) | (j & 0xF); + lut = (lut << 8) | (que_id & 0xF); /* On i = 3, we have 4 entries in lut; write to the register */ - if ((j & 3) == 3) { + if ((i & 3) == 3) { wr32(hw, I40E_VFQF_HLUT(i), lut); DDPRINTF(sc->dev, "HLUT(%2d): %#010x", i, lut); - i++; } } ixl_flush(hw); Modified: stable/10/sys/dev/ixl/ixl.h ============================================================================== --- stable/10/sys/dev/ixl/ixl.h Fri Dec 11 11:08:00 2015 (r292093) +++ stable/10/sys/dev/ixl/ixl.h Fri Dec 11 12:16:05 2015 (r292094) @@ -93,7 +93,7 @@ #include "i40e_type.h" #include "i40e_prototype.h" -#ifdef IXL_DEBUG +#if defined(IXL_DEBUG) || defined(IXL_DEBUG_SYSCTL) #include #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x" @@ -101,7 +101,13 @@ (mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \ (mac_addr)[4], (mac_addr)[5] #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off") +#endif /* IXL_DEBUG || IXL_DEBUG_SYSCTL */ +#ifdef IXL_DEBUG +/* Enable debug sysctls */ +#ifndef IXL_DEBUG_SYSCTL +#define IXL_DEBUG_SYSCTL 1 +#endif #define _DBG_PRINTF(S, ...) printf("%s: " S "\n", __func__, ##__VA_ARGS__) #define _DEV_DBG_PRINTF(dev, S, ...) device_printf(dev, "%s: " S "\n", __func__, ##__VA_ARGS__) @@ -128,7 +134,7 @@ #define HW_DEBUGOUT(...) if (DEBUG_HW) _DBG_PRINTF(__VA_ARGS__) -#else +#else /* no IXL_DEBUG */ #define DEBUG_INIT 0 #define DEBUG_IOCTL 0 #define DEBUG_HW 0 @@ -144,7 +150,7 @@ #define IOCTL_DBG_IF2(...) #define IOCTL_DBG_IF(...) #define HW_DEBUGOUT(...) -#endif +#endif /* IXL_DEBUG */ /* Tunables */ @@ -214,6 +220,7 @@ #define IXL_MAX_TSO_SEGS 66 #define IXL_SPARSE_CHAIN 6 #define IXL_QUEUE_HUNG 0x80000000 +#define IXL_KEYSZ 10 /* ERJ: hardware can support ~1.5k filters between all functions */ #define IXL_MAX_FILTERS 256 Modified: stable/10/sys/dev/ixl/ixl_txrx.c ============================================================================== --- stable/10/sys/dev/ixl/ixl_txrx.c Fri Dec 11 11:08:00 2015 (r292093) +++ stable/10/sys/dev/ixl/ixl_txrx.c Fri Dec 11 12:16:05 2015 (r292094) @@ -42,6 +42,10 @@ #include "opt_inet6.h" #include "ixl.h" +#ifdef RSS +#include +#endif + /* Local Prototypes */ static void ixl_rx_checksum(struct mbuf *, u32, u32, u8); static void ixl_refresh_mbufs(struct ixl_queue *, int); @@ -65,14 +69,33 @@ ixl_mq_start(struct ifnet *ifp, struct m struct ixl_queue *que; struct tx_ring *txr; int err, i; +#ifdef RSS + u32 bucket_id; +#endif - /* check if flowid is set */ - if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) - i = m->m_pkthdr.flowid % vsi->num_queues; - else + /* + ** Which queue to use: + ** + ** When doing RSS, map it to the same outbound + ** queue as the incoming flow would be mapped to. + ** If everything is setup correctly, it should be + ** the same bucket that the current CPU we're on is. + */ + if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { +#ifdef RSS + if (rss_hash2bucket(m->m_pkthdr.flowid, + M_HASHTYPE_GET(m), &bucket_id) == 0) { + i = bucket_id % vsi->num_queues; + } else +#endif + i = m->m_pkthdr.flowid % vsi->num_queues; + } else i = curcpu % vsi->num_queues; - - /* Check for a hung queue and pick alternative */ + /* + ** This may not be perfect, but until something + ** better comes along it will keep from scheduling + ** on stalled queues. + */ if (((1 << i) & vsi->active_queues) == 0) i = ffsl(vsi->active_queues); @@ -1089,8 +1112,8 @@ int ixl_init_rx_ring(struct ixl_queue *que) { struct rx_ring *rxr = &que->rxr; -#if defined(INET6) || defined(INET) struct ixl_vsi *vsi = que->vsi; +#if defined(INET6) || defined(INET) struct ifnet *ifp = vsi->ifp; struct lro_ctrl *lro = &rxr->lro; #endif @@ -1345,6 +1368,63 @@ ixl_rx_discard(struct rx_ring *rxr, int return; } +#ifdef RSS +/* +** ixl_ptype_to_hash: parse the packet type +** to determine the appropriate hash. +*/ +static inline int +ixl_ptype_to_hash(u8 ptype) +{ + struct i40e_rx_ptype_decoded decoded; + u8 ex = 0; + + decoded = decode_rx_desc_ptype(ptype); + ex = decoded.outer_frag; + + if (!decoded.known) + return M_HASHTYPE_OPAQUE; + + if (decoded.outer_ip == I40E_RX_PTYPE_OUTER_L2) + return M_HASHTYPE_OPAQUE; + + /* Note: anything that gets to this point is IP */ + if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6) { + switch (decoded.inner_prot) { + case I40E_RX_PTYPE_INNER_PROT_TCP: + if (ex) + return M_HASHTYPE_RSS_TCP_IPV6_EX; + else + return M_HASHTYPE_RSS_TCP_IPV6; + case I40E_RX_PTYPE_INNER_PROT_UDP: + if (ex) + return M_HASHTYPE_RSS_UDP_IPV6_EX; + else + return M_HASHTYPE_RSS_UDP_IPV6; + default: + if (ex) + return M_HASHTYPE_RSS_IPV6_EX; + else + return M_HASHTYPE_RSS_IPV6; + } + } + if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV4) { + switch (decoded.inner_prot) { + case I40E_RX_PTYPE_INNER_PROT_TCP: + return M_HASHTYPE_RSS_TCP_IPV4; + case I40E_RX_PTYPE_INNER_PROT_UDP: + if (ex) + return M_HASHTYPE_RSS_UDP_IPV4_EX; + else + return M_HASHTYPE_RSS_UDP_IPV4; + default: + return M_HASHTYPE_RSS_IPV4; + } + } + /* We should never get here!! */ + return M_HASHTYPE_OPAQUE; +} +#endif /* RSS */ /********************************************************************* * @@ -1542,8 +1622,14 @@ ixl_rxeof(struct ixl_queue *que, int cou rxr->bytes += sendmp->m_pkthdr.len; if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) ixl_rx_checksum(sendmp, status, error, ptype); +#ifdef RSS + sendmp->m_pkthdr.flowid = + le32toh(cur->wb.qword0.hi_dword.rss); + M_HASHTYPE_SET(sendmp, ixl_ptype_to_hash(ptype)); +#else sendmp->m_pkthdr.flowid = que->msix; M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE); +#endif } next_desc: bus_dmamap_sync(rxr->dma.tag, rxr->dma.map, From owner-svn-src-stable@freebsd.org Fri Dec 11 12:20:59 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B3E9D58AC; Fri, 11 Dec 2015 12:20:59 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA5DB14A1; Fri, 11 Dec 2015 12:20:59 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBCKwS4046507; Fri, 11 Dec 2015 12:20:58 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBCKw3N046498; Fri, 11 Dec 2015 12:20:58 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111220.tBBCKw3N046498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 12:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292095 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 12:21:00 -0000 Author: smh Date: Fri Dec 11 12:20:58 2015 New Revision: 292095 URL: https://svnweb.freebsd.org/changeset/base/292095 Log: MFC r279033: Bring the XL710 drivers up to the SW3 Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/i40e_adminq.c stable/10/sys/dev/ixl/i40e_adminq_cmd.h stable/10/sys/dev/ixl/i40e_common.c stable/10/sys/dev/ixl/i40e_lan_hmc.c stable/10/sys/dev/ixl/i40e_prototype.h stable/10/sys/dev/ixl/i40e_type.h stable/10/sys/dev/ixl/if_ixl.c stable/10/sys/dev/ixl/if_ixlv.c stable/10/sys/dev/ixl/ixl.h stable/10/sys/dev/ixl/ixl_pf.h stable/10/sys/dev/ixl/ixl_txrx.c stable/10/sys/dev/ixl/ixlvc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/i40e_adminq.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq.c Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/i40e_adminq.c Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -614,7 +614,8 @@ enum i40e_status_code i40e_init_adminq(s goto init_adminq_free_arq; /* get the NVM version info */ - i40e_read_nvm_word(hw, I40E_SR_NVM_IMAGE_VERSION, &hw->nvm.version); + i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION, + &hw->nvm.version); i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_LO, &eetrack_lo); i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_HI, &eetrack_hi); hw->nvm.eetrack = (eetrack_hi << 16) | eetrack_lo; Modified: stable/10/sys/dev/ixl/i40e_adminq_cmd.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq_cmd.h Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/i40e_adminq_cmd.h Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ */ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR 0x0002 +#define I40E_FW_API_VERSION_MINOR 0x0004 struct i40e_aq_desc { __le16 flags; @@ -140,12 +140,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_list_func_capabilities = 0x000A, i40e_aqc_opc_list_dev_capabilities = 0x000B, - i40e_aqc_opc_set_cppm_configuration = 0x0103, - i40e_aqc_opc_set_arp_proxy_entry = 0x0104, - i40e_aqc_opc_set_ns_proxy_entry = 0x0105, - /* LAA */ - i40e_aqc_opc_mng_laa = 0x0106, /* AQ obsolete */ i40e_aqc_opc_mac_address_read = 0x0107, i40e_aqc_opc_mac_address_write = 0x0108, @@ -270,7 +265,6 @@ enum i40e_admin_queue_opc { /* Tunnel commands */ i40e_aqc_opc_add_udp_tunnel = 0x0B00, i40e_aqc_opc_del_udp_tunnel = 0x0B01, - i40e_aqc_opc_tunnel_key_structure = 0x0B10, /* Async Events */ i40e_aqc_opc_event_lan_overflow = 0x1001, @@ -282,8 +276,6 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_oem_ocbb_initialize = 0xFE03, /* debug commands */ - i40e_aqc_opc_debug_get_deviceid = 0xFF00, - i40e_aqc_opc_debug_set_mode = 0xFF01, i40e_aqc_opc_debug_read_reg = 0xFF03, i40e_aqc_opc_debug_write_reg = 0xFF04, i40e_aqc_opc_debug_modify_reg = 0xFF07, @@ -517,7 +509,8 @@ struct i40e_aqc_mac_address_read { #define I40E_AQC_SAN_ADDR_VALID 0x20 #define I40E_AQC_PORT_ADDR_VALID 0x40 #define I40E_AQC_WOL_ADDR_VALID 0x80 -#define I40E_AQC_ADDR_VALID_MASK 0xf0 +#define I40E_AQC_MC_MAG_EN_VALID 0x100 +#define I40E_AQC_ADDR_VALID_MASK 0x1F0 u8 reserved[6]; __le32 addr_high; __le32 addr_low; @@ -540,7 +533,9 @@ struct i40e_aqc_mac_address_write { #define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x0000 #define I40E_AQC_WRITE_TYPE_LAA_WOL 0x4000 #define I40E_AQC_WRITE_TYPE_PORT 0x8000 -#define I40E_AQC_WRITE_TYPE_MASK 0xc000 +#define I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG 0xC000 +#define I40E_AQC_WRITE_TYPE_MASK 0xC000 + __le16 mac_sah; __le32 mac_sal; u8 reserved[8]; @@ -1076,6 +1071,7 @@ struct i40e_aqc_set_vsi_promiscuous_mode __le16 seid; #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF __le16 vlan_tag; +#define I40E_AQC_SET_VSI_VLAN_MASK 0x0FFF #define I40E_AQC_SET_VSI_VLAN_VALID 0x8000 u8 reserved[8]; }; @@ -2070,6 +2066,12 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_star #define I40E_AQC_CEE_PFC_STATUS_MASK (0x7 << I40E_AQC_CEE_PFC_STATUS_SHIFT) #define I40E_AQC_CEE_APP_STATUS_SHIFT 0x8 #define I40E_AQC_CEE_APP_STATUS_MASK (0x7 << I40E_AQC_CEE_APP_STATUS_SHIFT) +#define I40E_AQC_CEE_FCOE_STATUS_SHIFT 0x8 +#define I40E_AQC_CEE_FCOE_STATUS_MASK (0x7 << I40E_AQC_CEE_FCOE_STATUS_SHIFT) +#define I40E_AQC_CEE_ISCSI_STATUS_SHIFT 0xA +#define I40E_AQC_CEE_ISCSI_STATUS_MASK (0x7 << I40E_AQC_CEE_ISCSI_STATUS_SHIFT) +#define I40E_AQC_CEE_FIP_STATUS_SHIFT 0x10 +#define I40E_AQC_CEE_FIP_STATUS_MASK (0x7 << I40E_AQC_CEE_FIP_STATUS_SHIFT) struct i40e_aqc_get_cee_dcb_cfg_v1_resp { u8 reserved1; u8 oper_num_tc; Modified: stable/10/sys/dev/ixl/i40e_common.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_common.c Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/i40e_common.c Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -37,6 +37,7 @@ #include "i40e_prototype.h" #include "i40e_virtchnl.h" + /** * i40e_set_mac_type - Sets MAC type * @hw: pointer to the HW structure @@ -61,6 +62,7 @@ enum i40e_status_code i40e_set_mac_type( case I40E_DEV_ID_QSFP_B: case I40E_DEV_ID_QSFP_C: case I40E_DEV_ID_10G_BASE_T: + case I40E_DEV_ID_20G_KR2: hw->mac.type = I40E_MAC_XL710; break; case I40E_DEV_ID_VF: @@ -840,12 +842,15 @@ static enum i40e_media_type i40e_get_med case I40E_PHY_TYPE_10GBASE_CR1: case I40E_PHY_TYPE_40GBASE_CR4: case I40E_PHY_TYPE_10GBASE_SFPP_CU: + case I40E_PHY_TYPE_40GBASE_AOC: + case I40E_PHY_TYPE_10GBASE_AOC: media = I40E_MEDIA_TYPE_DA; break; case I40E_PHY_TYPE_1000BASE_KX: case I40E_PHY_TYPE_10GBASE_KX4: case I40E_PHY_TYPE_10GBASE_KR: case I40E_PHY_TYPE_40GBASE_KR4: + case I40E_PHY_TYPE_20GBASE_KR2: media = I40E_MEDIA_TYPE_BACKPLANE; break; case I40E_PHY_TYPE_SGMII: @@ -1508,6 +1513,10 @@ enum i40e_status_code i40e_aq_get_link_i else hw_link_info->lse_enable = FALSE; + if ((hw->aq.fw_maj_ver < 4 || (hw->aq.fw_maj_ver == 4 && + hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) + hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; + /* save link status information */ if (link) i40e_memcpy(link, hw_link_info, sizeof(*hw_link_info), @@ -2807,12 +2816,13 @@ i40e_aq_erase_nvm_exit: #define I40E_DEV_FUNC_CAP_MSIX_VF 0x44 #define I40E_DEV_FUNC_CAP_FLOW_DIRECTOR 0x45 #define I40E_DEV_FUNC_CAP_IEEE_1588 0x46 -#define I40E_DEV_FUNC_CAP_MFP_MODE_1 0xF1 +#define I40E_DEV_FUNC_CAP_FLEX10 0xF1 #define I40E_DEV_FUNC_CAP_CEM 0xF2 #define I40E_DEV_FUNC_CAP_IWARP 0x51 #define I40E_DEV_FUNC_CAP_LED 0x61 #define I40E_DEV_FUNC_CAP_SDP 0x62 #define I40E_DEV_FUNC_CAP_MDIO 0x63 +#define I40E_DEV_FUNC_CAP_WR_CSR_PROT 0x64 /** * i40e_parse_discover_capabilities @@ -2830,6 +2840,7 @@ static void i40e_parse_discover_capabili struct i40e_aqc_list_capabilities_element_resp *cap; u32 valid_functions, num_functions; u32 number, logical_id, phys_id; + u8 major_rev; struct i40e_hw_capabilities *p; u32 i = 0; u16 id; @@ -2848,6 +2859,7 @@ static void i40e_parse_discover_capabili number = LE32_TO_CPU(cap->number); logical_id = LE32_TO_CPU(cap->logical_id); phys_id = LE32_TO_CPU(cap->phys_id); + major_rev = cap->major_rev; switch (id) { case I40E_DEV_FUNC_CAP_SWITCH_MODE: @@ -2922,9 +2934,21 @@ static void i40e_parse_discover_capabili case I40E_DEV_FUNC_CAP_MSIX_VF: p->num_msix_vectors_vf = number; break; - case I40E_DEV_FUNC_CAP_MFP_MODE_1: - if (number == 1) - p->mfp_mode_1 = TRUE; + case I40E_DEV_FUNC_CAP_FLEX10: + if (major_rev == 1) { + if (number == 1) { + p->flex10_enable = TRUE; + p->flex10_capable = TRUE; + } + } else { + /* Capability revision >= 2 */ + if (number & 1) + p->flex10_enable = TRUE; + if (number & 2) + p->flex10_capable = TRUE; + } + p->flex10_mode = logical_id; + p->flex10_status = phys_id; break; case I40E_DEV_FUNC_CAP_CEM: if (number == 1) @@ -2957,11 +2981,18 @@ static void i40e_parse_discover_capabili p->fd_filters_guaranteed = number; p->fd_filters_best_effort = logical_id; break; + case I40E_DEV_FUNC_CAP_WR_CSR_PROT: + p->wr_csr_prot = (u64)number; + p->wr_csr_prot |= (u64)logical_id << 32; + break; default: break; } } + if (p->fcoe) + i40e_debug(hw, I40E_DEBUG_ALL, "device is FCoE capable\n"); + /* Always disable FCoE if compiled without the I40E_FCOE_ENA flag */ p->fcoe = FALSE; @@ -4917,6 +4948,63 @@ void i40e_set_pci_config_data(struct i40 } /** + * i40e_aq_debug_dump + * @hw: pointer to the hardware structure + * @cluster_id: specific cluster to dump + * @table_id: table id within cluster + * @start_index: index of line in the block to read + * @buff_size: dump buffer size + * @buff: dump buffer + * @ret_buff_size: actual buffer size returned + * @ret_next_table: next block to read + * @ret_next_index: next index to read + * + * Dump internal FW/HW data for debug purposes. + * + **/ +enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id, + u8 table_id, u32 start_index, u16 buff_size, + void *buff, u16 *ret_buff_size, + u8 *ret_next_table, u32 *ret_next_index, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_debug_dump_internals *cmd = + (struct i40e_aqc_debug_dump_internals *)&desc.params.raw; + struct i40e_aqc_debug_dump_internals *resp = + (struct i40e_aqc_debug_dump_internals *)&desc.params.raw; + enum i40e_status_code status; + + if (buff_size == 0 || !buff) + return I40E_ERR_PARAM; + + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_debug_dump_internals); + /* Indirect Command */ + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); + if (buff_size > I40E_AQ_LARGE_BUF) + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB); + + cmd->cluster_id = cluster_id; + cmd->table_id = table_id; + cmd->idx = CPU_TO_LE32(start_index); + + desc.datalen = CPU_TO_LE16(buff_size); + + status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details); + if (!status) { + if (ret_buff_size != NULL) + *ret_buff_size = LE16_TO_CPU(desc.datalen); + if (ret_next_table != NULL) + *ret_next_table = resp->table_id; + if (ret_next_index != NULL) + *ret_next_index = LE32_TO_CPU(resp->idx); + } + + return status; +} + +/** * i40e_read_bw_from_alt_ram * @hw: pointer to the hardware structure * @max_bw: pointer for max_bw read Modified: stable/10/sys/dev/ixl/i40e_lan_hmc.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_lan_hmc.c Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/i40e_lan_hmc.c Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1218,7 +1218,7 @@ static enum i40e_status_code i40e_set_hm /** * i40e_hmc_get_object_va - retrieves an object's virtual address - * @hmc_info: pointer to i40e_hmc_info struct + * @hw: pointer to the hw structure * @object_base: pointer to u64 to get the va * @rsrc_type: the hmc resource type * @obj_idx: hmc object index @@ -1227,12 +1227,13 @@ static enum i40e_status_code i40e_set_hm * base pointer. This function is used for LAN Queue contexts. **/ static -enum i40e_status_code i40e_hmc_get_object_va(struct i40e_hmc_info *hmc_info, +enum i40e_status_code i40e_hmc_get_object_va(struct i40e_hw *hw, u8 **object_base, enum i40e_hmc_lan_rsrc_type rsrc_type, u32 obj_idx) { u32 obj_offset_in_sd, obj_offset_in_pd; + struct i40e_hmc_info *hmc_info = &hw->hmc; struct i40e_hmc_sd_entry *sd_entry; struct i40e_hmc_pd_entry *pd_entry; u32 pd_idx, pd_lmt, rel_pd_idx; @@ -1304,8 +1305,7 @@ enum i40e_status_code i40e_get_lan_tx_qu enum i40e_status_code err; u8 *context_bytes; - err = i40e_hmc_get_object_va(&hw->hmc, &context_bytes, - I40E_HMC_LAN_TX, queue); + err = i40e_hmc_get_object_va(hw, &context_bytes, I40E_HMC_LAN_TX, queue); if (err < 0) return err; @@ -1324,8 +1324,7 @@ enum i40e_status_code i40e_clear_lan_tx_ enum i40e_status_code err; u8 *context_bytes; - err = i40e_hmc_get_object_va(&hw->hmc, &context_bytes, - I40E_HMC_LAN_TX, queue); + err = i40e_hmc_get_object_va(hw, &context_bytes, I40E_HMC_LAN_TX, queue); if (err < 0) return err; @@ -1345,8 +1344,7 @@ enum i40e_status_code i40e_set_lan_tx_qu enum i40e_status_code err; u8 *context_bytes; - err = i40e_hmc_get_object_va(&hw->hmc, &context_bytes, - I40E_HMC_LAN_TX, queue); + err = i40e_hmc_get_object_va(hw, &context_bytes, I40E_HMC_LAN_TX, queue); if (err < 0) return err; @@ -1367,8 +1365,7 @@ enum i40e_status_code i40e_get_lan_rx_qu enum i40e_status_code err; u8 *context_bytes; - err = i40e_hmc_get_object_va(&hw->hmc, &context_bytes, - I40E_HMC_LAN_RX, queue); + err = i40e_hmc_get_object_va(hw, &context_bytes, I40E_HMC_LAN_RX, queue); if (err < 0) return err; @@ -1387,8 +1384,7 @@ enum i40e_status_code i40e_clear_lan_rx_ enum i40e_status_code err; u8 *context_bytes; - err = i40e_hmc_get_object_va(&hw->hmc, &context_bytes, - I40E_HMC_LAN_RX, queue); + err = i40e_hmc_get_object_va(hw, &context_bytes, I40E_HMC_LAN_RX, queue); if (err < 0) return err; @@ -1408,8 +1404,7 @@ enum i40e_status_code i40e_set_lan_rx_qu enum i40e_status_code err; u8 *context_bytes; - err = i40e_hmc_get_object_va(&hw->hmc, &context_bytes, - I40E_HMC_LAN_RX, queue); + err = i40e_hmc_get_object_va(hw, &context_bytes, I40E_HMC_LAN_RX, queue); if (err < 0) return err; Modified: stable/10/sys/dev/ixl/i40e_prototype.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_prototype.h Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/i40e_prototype.h Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -445,4 +445,9 @@ enum i40e_status_code i40e_aq_add_rem_co u16 vsi_seid, u16 queue, bool is_add, struct i40e_control_filter_stats *stats, struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id, + u8 table_id, u32 start_index, u16 buff_size, + void *buff, u16 *ret_buff_size, + u8 *ret_next_table, u32 *ret_next_index, + struct i40e_asq_cmd_details *cmd_details); #endif /* _I40E_PROTOTYPE_H_ */ Modified: stable/10/sys/dev/ixl/i40e_type.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_type.h Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/i40e_type.h Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -57,6 +57,7 @@ #define I40E_DEV_ID_QSFP_B 0x1584 #define I40E_DEV_ID_QSFP_C 0x1585 #define I40E_DEV_ID_10G_BASE_T 0x1586 +#define I40E_DEV_ID_20G_KR2 0x1587 #define I40E_DEV_ID_VF 0x154C #define I40E_DEV_ID_VF_HV 0x1571 @@ -286,7 +287,17 @@ struct i40e_hw_capabilities { bool dcb; bool fcoe; bool iscsi; /* Indicates iSCSI enabled */ - bool mfp_mode_1; + bool flex10_enable; + bool flex10_capable; + u32 flex10_mode; +#define I40E_FLEX10_MODE_UNKNOWN 0x0 +#define I40E_FLEX10_MODE_DCC 0x1 +#define I40E_FLEX10_MODE_DCI 0x2 + + u32 flex10_status; +#define I40E_FLEX10_STATUS_DCC_ERROR 0x1 +#define I40E_FLEX10_STATUS_VC_MODE 0x2 + bool mgmt_cem; bool ieee_1588; bool iwarp; @@ -315,6 +326,7 @@ struct i40e_hw_capabilities { u8 rx_buf_chain_len; u32 enabled_tcmap; u32 maxtc; + u64 wr_csr_prot; }; struct i40e_mac_info { @@ -560,7 +572,11 @@ struct i40e_hw { /* debug mask */ u32 debug_mask; }; -#define i40e_is_vf(_hw) ((_hw)->mac.type == I40E_MAC_VF) + +static INLINE bool i40e_is_vf(struct i40e_hw *hw) +{ + return hw->mac.type == I40E_MAC_VF; +} struct i40e_driver_version { u8 major_version; @@ -1258,6 +1274,9 @@ struct i40e_hw_port_stats { /* flow director stats */ u64 fd_atr_match; u64 fd_sb_match; + u64 fd_atr_tunnel_match; + u32 fd_atr_status; + u32 fd_sb_status; /* EEE LPI */ u32 tx_lpi_status; u32 rx_lpi_status; Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:16:05 2015 (r292094) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:20:58 2015 (r292095) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -32,8 +32,11 @@ ******************************************************************************/ /*$FreeBSD$*/ +#ifndef IXL_STANDALONE_BUILD #include "opt_inet.h" #include "opt_inet6.h" +#endif + #include "ixl.h" #include "ixl_pf.h" @@ -44,7 +47,7 @@ /********************************************************************* * Driver version *********************************************************************/ -char ixl_driver_version[] = "1.3.1"; +char ixl_driver_version[] = "1.3.6"; /********************************************************************* * PCI Device ID Table @@ -98,7 +101,7 @@ static void ixl_update_link_status(s static int ixl_allocate_pci_resources(struct ixl_pf *); static u16 ixl_get_bus_info(struct i40e_hw *, device_t); static int ixl_setup_stations(struct ixl_pf *); -static int ixl_setup_vsi(struct ixl_vsi *); +static int ixl_switch_config(struct ixl_pf *); static int ixl_initialize_vsi(struct ixl_vsi *); static int ixl_assign_vsi_msix(struct ixl_pf *); static int ixl_assign_vsi_legacy(struct ixl_pf *); @@ -498,48 +501,6 @@ ixl_attach(device_t dev) goto err_out; } - /* For now always do an initial CORE reset on first device */ - { - static int ixl_dev_count; - static int ixl_dev_track[32]; - u32 my_dev; - int i, found = FALSE; - u16 bus = pci_get_bus(dev); - - mtx_lock(&ixl_reset_mtx); - my_dev = (bus << 8) | hw->bus.device; - - for (i = 0; i < ixl_dev_count; i++) { - if (ixl_dev_track[i] == my_dev) - found = TRUE; - } - - if (!found) { - u32 reg; - - ixl_dev_track[ixl_dev_count] = my_dev; - ixl_dev_count++; - - INIT_DEBUGOUT("Initial CORE RESET\n"); - wr32(hw, I40E_GLGEN_RTRIG, I40E_GLGEN_RTRIG_CORER_MASK); - ixl_flush(hw); - i = 50; - do { - i40e_msec_delay(50); - reg = rd32(hw, I40E_GLGEN_RSTAT); - if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) - break; - } while (i--); - - /* paranoia */ - wr32(hw, I40E_PF_ATQLEN, 0); - wr32(hw, I40E_PF_ATQBAL, 0); - wr32(hw, I40E_PF_ATQBAH, 0); - i40e_clear_pxe_mode(hw); - } - mtx_unlock(&ixl_reset_mtx); - } - /* Set admin queue parameters */ hw->aq.num_arq_entries = IXL_AQ_LEN; hw->aq.num_asq_entries = IXL_AQ_LEN; @@ -629,13 +590,15 @@ ixl_attach(device_t dev) if (error) goto err_late; - i40e_msec_delay(75); - error = i40e_aq_set_link_restart_an(hw, TRUE, NULL); - if (error) { - device_printf(dev, "link restart failed, aq_err=%d\n", - pf->hw.aq.asq_last_status); + if (((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver < 33)) || + (hw->aq.fw_maj_ver < 4)) { + i40e_msec_delay(75); + error = i40e_aq_set_link_restart_an(hw, TRUE, NULL); + if (error) + device_printf(dev, "link restart failed, aq_err=%d\n", + pf->hw.aq.asq_last_status); } - + /* Determine link state */ vsi->link_up = ixl_config_link(hw); @@ -655,6 +618,18 @@ ixl_attach(device_t dev) goto err_late; } + error = ixl_switch_config(pf); + if (error) { + device_printf(dev, "Initial switch config failed: %d\n", error); + goto err_mac_hmc; + } + + /* Limit phy interrupts to link and modules failure */ + error = i40e_aq_set_phy_int_mask(hw, + I40E_AQ_EVENT_LINK_UPDOWN | I40E_AQ_EVENT_MODULE_QUAL_FAIL, NULL); + if (error) + device_printf(dev, "set phy mask failed: %d\n", error); + /* Get the bus configuration and set the shared code */ bus = ixl_get_bus_info(hw, dev); i40e_set_pci_config_data(hw, bus); @@ -664,13 +639,6 @@ ixl_attach(device_t dev) ixl_update_stats_counters(pf); ixl_add_hw_stats(pf); - /* Reset port's advertised speeds */ - if (!i40e_is_40G_device(hw->device_id)) { - pf->advertised_speed = - (hw->device_id == I40E_DEV_ID_10G_BASE_T) ? 0x7 : 0x6; - ixl_set_advertised_speeds(pf, pf->advertised_speed); - } - /* Register for VLAN events */ vsi->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, ixl_register_vlan, vsi, EVENTHANDLER_PRI_FIRST); @@ -722,9 +690,12 @@ ixl_detach(device_t dev) return (EBUSY); } - IXL_PF_LOCK(pf); - ixl_stop(pf); - IXL_PF_UNLOCK(pf); + ether_ifdetach(vsi->ifp); + if (vsi->ifp->if_drv_flags & IFF_DRV_RUNNING) { + IXL_PF_LOCK(pf); + ixl_stop(pf); + IXL_PF_UNLOCK(pf); + } for (int i = 0; i < vsi->num_queues; i++, que++) { if (que->tq) { @@ -752,7 +723,6 @@ ixl_detach(device_t dev) if (vsi->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, vsi->vlan_detach); - ether_ifdetach(vsi->ifp); callout_drain(&pf->timer); @@ -1121,11 +1091,8 @@ ixl_init_locked(struct ixl_pf *pf) /* Set up RSS */ ixl_config_rss(vsi); - /* Setup the VSI */ - ixl_setup_vsi(vsi); - /* - ** Prepare the rings, hmc contexts, etc... + ** Prepare the VSI: rings, hmc contexts, etc... */ if (ixl_initialize_vsi(vsi)) { device_printf(dev, "initialize vsi failed!!\n"); @@ -1408,16 +1375,14 @@ ixl_media_status(struct ifnet * ifp, str ifmr->ifm_active |= IFM_1000_LX; break; /* 10 G */ + case I40E_PHY_TYPE_10GBASE_CR1: case I40E_PHY_TYPE_10GBASE_CR1_CU: case I40E_PHY_TYPE_10GBASE_SFPP_CU: + /* Using this until a real KR media type */ + case I40E_PHY_TYPE_10GBASE_KR: + case I40E_PHY_TYPE_10GBASE_KX4: ifmr->ifm_active |= IFM_10G_TWINAX; break; - case I40E_PHY_TYPE_10GBASE_KR: - /* - ** this is not technically correct - ** but FreeBSD does not have the media - ** type defined yet, so its a compromise. - */ case I40E_PHY_TYPE_10GBASE_SR: ifmr->ifm_active |= IFM_10G_SR; break; @@ -1438,6 +1403,16 @@ ixl_media_status(struct ifnet * ifp, str case I40E_PHY_TYPE_40GBASE_LR4: ifmr->ifm_active |= IFM_40G_LR4; break; + /* + ** Set these to CR4 because OS does not + ** have types available yet. + */ + case I40E_PHY_TYPE_40GBASE_KR4: + case I40E_PHY_TYPE_XLAUI: + case I40E_PHY_TYPE_XLPPI: + case I40E_PHY_TYPE_40GBASE_AOC: + ifmr->ifm_active |= IFM_40G_CR4; + break; default: ifmr->ifm_active |= IFM_UNKNOWN; break; @@ -1764,18 +1739,17 @@ ixl_update_link_status(struct ixl_pf *pf struct i40e_hw *hw = &pf->hw; struct ifnet *ifp = vsi->ifp; device_t dev = pf->dev; - enum i40e_fc_mode fc; if (vsi->link_up){ if (vsi->link_active == FALSE) { i40e_aq_get_link_info(hw, TRUE, NULL, NULL); + pf->fc = hw->fc.current_mode; if (bootverbose) { - fc = hw->fc.current_mode; device_printf(dev,"Link is up %d Gbps %s," " Flow Control: %s\n", ((vsi->link_speed == I40E_LINK_SPEED_40GB)? 40:10), - "Full Duplex", ixl_fc_string[fc]); + "Full Duplex", ixl_fc_string[pf->fc]); } vsi->link_active = TRUE; /* @@ -2340,8 +2314,15 @@ ixl_add_ifmedia(struct ixl_vsi *vsi, u32 ifmedia_add(&vsi->media, IFM_ETHER | IFM_1000_T, 0, NULL); if (phy_type & (1 << I40E_PHY_TYPE_10GBASE_CR1_CU) || + phy_type & (1 << I40E_PHY_TYPE_10GBASE_KX4) || + phy_type & (1 << I40E_PHY_TYPE_10GBASE_KR) || + phy_type & (1 << I40E_PHY_TYPE_10GBASE_AOC) || + phy_type & (1 << I40E_PHY_TYPE_XAUI) || + phy_type & (1 << I40E_PHY_TYPE_XFI) || + phy_type & (1 << I40E_PHY_TYPE_SFI) || phy_type & (1 << I40E_PHY_TYPE_10GBASE_SFPP_CU)) ifmedia_add(&vsi->media, IFM_ETHER | IFM_10G_TWINAX, 0, NULL); + if (phy_type & (1 << I40E_PHY_TYPE_10GBASE_SR)) ifmedia_add(&vsi->media, IFM_ETHER | IFM_10G_SR, 0, NULL); if (phy_type & (1 << I40E_PHY_TYPE_10GBASE_LR)) @@ -2349,9 +2330,15 @@ ixl_add_ifmedia(struct ixl_vsi *vsi, u32 if (phy_type & (1 << I40E_PHY_TYPE_10GBASE_T)) ifmedia_add(&vsi->media, IFM_ETHER | IFM_10G_T, 0, NULL); - if (phy_type & (1 << I40E_PHY_TYPE_40GBASE_CR4_CU) || - phy_type & (1 << I40E_PHY_TYPE_40GBASE_CR4)) + if (phy_type & (1 << I40E_PHY_TYPE_40GBASE_CR4) || + phy_type & (1 << I40E_PHY_TYPE_40GBASE_CR4_CU) || + phy_type & (1 << I40E_PHY_TYPE_40GBASE_AOC) || + phy_type & (1 << I40E_PHY_TYPE_XLAUI) || + phy_type & (1 << I40E_PHY_TYPE_XLPPI) || + /* KR4 uses CR4 until the OS has the real media type */ + phy_type & (1 << I40E_PHY_TYPE_40GBASE_KR4)) ifmedia_add(&vsi->media, IFM_ETHER | IFM_40G_CR4, 0, NULL); + if (phy_type & (1 << I40E_PHY_TYPE_40GBASE_SR4)) ifmedia_add(&vsi->media, IFM_ETHER | IFM_40G_SR4, 0, NULL); if (phy_type & (1 << I40E_PHY_TYPE_40GBASE_LR4)) @@ -2369,7 +2356,7 @@ ixl_setup_interface(device_t dev, struct struct ifnet *ifp; struct i40e_hw *hw = vsi->hw; struct ixl_queue *que = vsi->queues; - struct i40e_aq_get_phy_abilities_resp abilities_resp; + struct i40e_aq_get_phy_abilities_resp abilities; enum i40e_status_code aq_error = 0; INIT_DEBUGOUT("ixl_setup_interface: begin"); @@ -2436,21 +2423,25 @@ ixl_setup_interface(device_t dev, struct ifmedia_init(&vsi->media, IFM_IMASK, ixl_media_change, ixl_media_status); - aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, TRUE, &abilities_resp, NULL); + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, TRUE, &abilities, NULL); + /* May need delay to detect fiber correctly */ if (aq_error == I40E_ERR_UNKNOWN_PHY) { - /* Need delay to detect fiber correctly */ i40e_msec_delay(200); aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, - TRUE, &abilities_resp, NULL); + TRUE, &abilities, NULL); + } + if (aq_error) { if (aq_error == I40E_ERR_UNKNOWN_PHY) device_printf(dev, "Unknown PHY type detected!\n"); else - ixl_add_ifmedia(vsi, abilities_resp.phy_type); - } else if (aq_error) { - device_printf(dev, "Error getting supported media types, err %d," - " AQ error %d\n", aq_error, hw->aq.asq_last_status); - } else - ixl_add_ifmedia(vsi, abilities_resp.phy_type); + device_printf(dev, + "Error getting supported media types, err %d," + " AQ error %d\n", aq_error, hw->aq.asq_last_status); + return (0); + } + + ixl_add_ifmedia(vsi, abilities.phy_type); /* Use autoselect media by default */ ifmedia_add(&vsi->media, IFM_ETHER | IFM_AUTO, 0, NULL); @@ -2476,20 +2467,23 @@ ixl_config_link(struct i40e_hw *hw) /********************************************************************* * - * Initialize this VSI + * Get Firmware Switch configuration + * - this will need to be more robust when more complex + * switch configurations are enabled. * **********************************************************************/ static int -ixl_setup_vsi(struct ixl_vsi *vsi) +ixl_switch_config(struct ixl_pf *pf) { - struct i40e_hw *hw = vsi->hw; + struct i40e_hw *hw = &pf->hw; + struct ixl_vsi *vsi = &pf->vsi; device_t dev = vsi->dev; struct i40e_aqc_get_switch_config_resp *sw_config; - struct i40e_vsi_context ctxt; u8 aq_buf[I40E_AQ_LARGE_BUF]; int ret = I40E_SUCCESS; u16 next = 0; + memset(&aq_buf, 0, sizeof(aq_buf)); sw_config = (struct i40e_aqc_get_switch_config_resp *)aq_buf; ret = i40e_aq_get_switch_config(hw, sw_config, sizeof(aq_buf), &next, NULL); @@ -2506,16 +2500,34 @@ ixl_setup_vsi(struct ixl_vsi *vsi) sw_config->element[0].uplink_seid, sw_config->element[0].downlink_seid); #endif - /* Save off this important value */ + /* Simplified due to a single VSI at the moment */ vsi->seid = sw_config->element[0].seid; + return (ret); +} + +/********************************************************************* + * + * Initialize the VSI: this handles contexts, which means things + * like the number of descriptors, buffer size, + * plus we init the rings thru this function. + * + **********************************************************************/ +static int +ixl_initialize_vsi(struct ixl_vsi *vsi) +{ + struct ixl_queue *que = vsi->queues; + device_t dev = vsi->dev; + struct i40e_hw *hw = vsi->hw; + struct i40e_vsi_context ctxt; + int err = 0; memset(&ctxt, 0, sizeof(ctxt)); ctxt.seid = vsi->seid; ctxt.pf_num = hw->pf_id; - ret = i40e_aq_get_vsi_params(hw, &ctxt, NULL); - if (ret) { - device_printf(dev,"get vsi params failed %x!!\n", ret); - return (ret); + err = i40e_aq_get_vsi_params(hw, &ctxt, NULL); + if (err) { + device_printf(dev,"get vsi params failed %x!!\n", err); + return (err); } #ifdef IXL_DEBUG printf("get_vsi_params: seid: %d, uplinkseid: %d, vsi_number: %d, " @@ -2552,29 +2564,12 @@ ixl_setup_vsi(struct ixl_vsi *vsi) vsi->hw_filters_add = 0; vsi->hw_filters_del = 0; - ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); - if (ret) + err = i40e_aq_update_vsi_params(hw, &ctxt, NULL); + if (err) { device_printf(dev,"update vsi params failed %x!!\n", hw->aq.asq_last_status); - return (ret); -} - - -/********************************************************************* - * - * Initialize the VSI: this handles contexts, which means things - * like the number of descriptors, buffer size, - * plus we init the rings thru this function. - * - **********************************************************************/ -static int -ixl_initialize_vsi(struct ixl_vsi *vsi) -{ - struct ixl_queue *que = vsi->queues; - device_t dev = vsi->dev; - struct i40e_hw *hw = vsi->hw; - int err = 0; - + return (err); + } for (int i = 0; i < vsi->num_queues; i++, que++) { struct tx_ring *txr = &que->txr; @@ -3215,7 +3210,7 @@ static void ixl_config_rss(struct ixl_vs set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP); if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6) set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER); - if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6); if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6) set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_TCP); @@ -3520,8 +3515,8 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, if (j > 0) { err = i40e_aq_add_macvlan(hw, vsi->seid, a, j, NULL); if (err) - device_printf(dev, "aq_add_macvlan err %d, aq_error %d\n", - err, hw->aq.asq_last_status); + device_printf(dev, "aq_add_macvlan err %d, " + "aq_error %d\n", err, hw->aq.asq_last_status); else vsi->hw_filters_add += j; } @@ -4306,24 +4301,15 @@ ixl_set_flowcntl(SYSCTL_HANDLER_ARGS) struct ixl_pf *pf = (struct ixl_pf *)arg1; struct i40e_hw *hw = &pf->hw; device_t dev = pf->dev; - int requested_fc = 0, error = 0; + int error = 0; enum i40e_status_code aq_error = 0; u8 fc_aq_err = 0; - aq_error = i40e_aq_get_link_info(hw, TRUE, NULL, NULL); - if (aq_error) { - device_printf(dev, - "%s: Error retrieving link info from aq, %d\n", - __func__, aq_error); - return (EAGAIN); - } - - /* Read in new mode */ - requested_fc = hw->fc.current_mode; - error = sysctl_handle_int(oidp, &requested_fc, 0, req); + /* Get request */ + error = sysctl_handle_int(oidp, &pf->fc, 0, req); if ((error) || (req->newptr == NULL)) return (error); - if (requested_fc < 0 || requested_fc > 3) { + if (pf->fc < 0 || pf->fc > 3) { device_printf(dev, "Invalid fc mode; valid modes are 0 through 3\n"); return (EINVAL); @@ -4341,7 +4327,7 @@ ixl_set_flowcntl(SYSCTL_HANDLER_ARGS) } /* Set fc ability for port */ - hw->fc.requested_mode = requested_fc; + hw->fc.requested_mode = pf->fc; aq_error = i40e_set_fc(hw, &fc_aq_err, TRUE); if (aq_error) { device_printf(dev, @@ -4350,14 +4336,6 @@ ixl_set_flowcntl(SYSCTL_HANDLER_ARGS) return (EAGAIN); } - if (hw->fc.current_mode != hw->fc.requested_mode) { - device_printf(dev, "%s: FC set failure:\n", __func__); - device_printf(dev, "%s: Current: %s / Requested: %s\n", - __func__, - ixl_fc_string[hw->fc.current_mode], - ixl_fc_string[hw->fc.requested_mode]); - } - return (0); } @@ -4416,9 +4394,11 @@ ixl_set_advertised_speeds(struct ixl_pf enum i40e_status_code aq_error = 0; /* Get current capability information */ - aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, FALSE, &abilities, NULL); + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, FALSE, &abilities, NULL); if (aq_error) { - device_printf(dev, "%s: Error getting phy capabilities %d," + device_printf(dev, + "%s: Error getting phy capabilities %d," " aq error: %d\n", __func__, aq_error, hw->aq.asq_last_status); return (EAGAIN); @@ -4443,7 +4423,8 @@ ixl_set_advertised_speeds(struct ixl_pf /* Do aq command & restart link */ aq_error = i40e_aq_set_phy_config(hw, &config, NULL); if (aq_error) { - device_printf(dev, "%s: Error setting new phy config %d," + device_printf(dev, + "%s: Error setting new phy config %d," " aq error: %d\n", __func__, aq_error, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Dec 11 12:22:40 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BD609D5B45 for ; Fri, 11 Dec 2015 12:22:40 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 246861946 for ; Fri, 11 Dec 2015 12:22:39 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x22f.google.com with SMTP id c17so9581226wmd.1 for ; Fri, 11 Dec 2015 04:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=wwejl9suL0kDnLkZU3npGI99INANAQAUD61UiIGFw1k=; b=jI6OFbxViDJDWQ2bm5mqlneONAb4tyfaG2qCmgGTUyeWVbO6rfcfUm3hBYixhDdpwH rUp83HxccowgKBGRkKXqMv4uOuImtH9OGTGxT9BHhXT1dKygu+bZo0xp2DIXJKW8N8TT JS6rtP8lF6pVXlPYxJPan584NhlsEGitJqGMwn76UcyVeINJFqMhtZ4bEUy0Qd6vssKw KLnMhcOzc8Zj5cJbEelQ7QUrAIlH+AXAGNuiaxJoDM86xoEIpWUKxMsNmdUsXjFtHjEB OsSI9/xgRvg9kiodqsfv5eXoVUCqDLkHWlmyCDFXb0djbR3qRGLFScHGu29MboM00lk7 ehMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=wwejl9suL0kDnLkZU3npGI99INANAQAUD61UiIGFw1k=; b=BghkbbkWlW/XF9PeLiww+nHcf+BZPeOBCGxUlwIuQ5XmoMCsqHLmZnJYRPqnISYaEI Loc04+NqOatIYuDjZ2G87ufa005jwmpAczNZ/ds8BKjnnJBQezBv+V3lpOjkQXHaq48t nZhGVn3KHrunKWayxma8PeXORkcVTkg0GW0e3+AglSc2QIvFrnMXxdUHU4DxbiJKDerJ ULM1OOznd29fuWRRK9G2B0oYTKaBnUGy9HtOSBLj4L6PfsQRGn+jssO5GZvdgqb8SBhM Bdz/8wMpsTV3doXJTNpgX6xsh30073B/RWYn6/71MKpdXBpbmW3iGhV4vT/8KG1Hh+uo oeow== X-Gm-Message-State: ALoCoQkfgDElnxo/M20vyoToLxk+G/oIajmnWEZj/S/2QIrtVSGddLj8iu1HaxBdRuOlgGZovqFLkrnIe0kOOeJxAUrTSqm8zw== X-Received: by 10.28.222.4 with SMTP id v4mr5751547wmg.67.1449836558253; Fri, 11 Dec 2015 04:22:38 -0800 (PST) Received: from [10.10.1.58] (liv3d.labs.multiplay.co.uk. [82.69.141.171]) by smtp.gmail.com with ESMTPSA id a63sm3172711wmc.5.2015.12.11.04.22.36 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Dec 2015 04:22:37 -0800 (PST) Subject: Re: svn commit: r292094 - stable/10/sys/dev/ixl To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201512111216.tBBCG5BI044327@repo.freebsd.org> From: Steven Hartland Message-ID: <566AC00D.4090200@multiplay.co.uk> Date: Fri, 11 Dec 2015 12:22:37 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <201512111216.tBBCG5BI044327@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 12:22:40 -0000 This should have referenced https://reviews.freebsd.org/D4265 On 11/12/2015 12:16, Steven Hartland wrote: > Author: smh > Date: Fri Dec 11 12:16:05 2015 > New Revision: 292094 > URL: https://svnweb.freebsd.org/changeset/base/292094 > > Log: > MFC r277084,r277088,r277130,r277143,r277151,r277262 > > r277084: Intel I40E updates ixl v1.3.0 and ixlv 1.2.0 featuring RSS > r277088, r277130, r277143, r277151 & r277262: Misc RSS fixes > > The main change is the addition of RSS, which is not supported in stable/10, > however these commits also include other bug fixes. In order to bring those > fixes in and facilitate easier merge of future updates the RSS changes are > maintained but left disabled by the removal of the opt_rss.h include. > > Sponsored by: Multiplay > > Modified: > stable/10/sys/dev/ixl/if_ixl.c > stable/10/sys/dev/ixl/if_ixlv.c > stable/10/sys/dev/ixl/ixl.h > stable/10/sys/dev/ixl/ixl_txrx.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/dev/ixl/if_ixl.c > ============================================================================== > --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 11:08:00 2015 (r292093) > +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:16:05 2015 (r292094) > @@ -37,10 +37,14 @@ > #include "ixl.h" > #include "ixl_pf.h" > > +#ifdef RSS > +#include > +#endif > + > /********************************************************************* > * Driver version > *********************************************************************/ > -char ixl_driver_version[] = "1.2.8"; > +char ixl_driver_version[] = "1.3.1"; > > /********************************************************************* > * PCI Device ID Table > @@ -174,7 +178,7 @@ static void ixl_stat_update48(struct i40 > static void ixl_stat_update32(struct i40e_hw *, u32, bool, > u64 *, u64 *); > > -#ifdef IXL_DEBUG > +#ifdef IXL_DEBUG_SYSCTL > static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); > static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); > static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); > @@ -427,7 +431,7 @@ ixl_attach(device_t dev) > OID_AUTO, "dynamic_tx_itr", CTLFLAG_RW, > &ixl_dynamic_tx_itr, 0, "Dynamic TX ITR"); > > -#ifdef IXL_DEBUG > +#ifdef IXL_DEBUG_SYSCTL > SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > OID_AUTO, "link_status", CTLTYPE_STRING | CTLFLAG_RD, > @@ -662,8 +666,9 @@ ixl_attach(device_t dev) > > /* Reset port's advertised speeds */ > if (!i40e_is_40G_device(hw->device_id)) { > - pf->advertised_speed = 0x7; > - ixl_set_advertised_speeds(pf, 0x7); > + pf->advertised_speed = > + (hw->device_id == I40E_DEV_ID_10G_BASE_T) ? 0x7 : 0x6; > + ixl_set_advertised_speeds(pf, pf->advertised_speed); > } > > /* Register for VLAN events */ > @@ -1407,6 +1412,12 @@ ixl_media_status(struct ifnet * ifp, str > case I40E_PHY_TYPE_10GBASE_SFPP_CU: > ifmr->ifm_active |= IFM_10G_TWINAX; > break; > + case I40E_PHY_TYPE_10GBASE_KR: > + /* > + ** this is not technically correct > + ** but FreeBSD does not have the media > + ** type defined yet, so its a compromise. > + */ > case I40E_PHY_TYPE_10GBASE_SR: > ifmr->ifm_active |= IFM_10G_SR; > break; > @@ -1721,8 +1732,10 @@ ixl_local_timer(void *arg) > vsi->active_queues |= ((u64)1 << que->me); > } > if (que->busy >= IXL_MAX_TX_BUSY) { > +#ifdef IXL_DEBUG > device_printf(dev,"Warning queue %d " > "appears to be hung!\n", i); > +#endif > que->busy = IXL_QUEUE_HUNG; > ++hung; > } > @@ -1765,6 +1778,15 @@ ixl_update_link_status(struct ixl_pf *pf > "Full Duplex", ixl_fc_string[fc]); > } > vsi->link_active = TRUE; > + /* > + ** Warn user if link speed on NPAR enabled > + ** partition is not at least 10GB > + */ > + if (hw->func_caps.npar_enable && > + (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB || > + hw->phy.link_info.link_speed == I40E_LINK_SPEED_100MB)) > + device_printf(dev, "The partition detected link" > + "speed that is less than 10Gbps\n"); > if_link_state_change(ifp, LINK_STATE_UP); > } > } else { /* Link down */ > @@ -1901,6 +1923,7 @@ ixl_assign_vsi_msix(struct ixl_pf *pf) > > /* Now set up the stations */ > for (int i = 0; i < vsi->num_queues; i++, vector++, que++) { > + int cpu_id = i; > rid = vector + 1; > txr = &que->txr; > que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, > @@ -1921,14 +1944,23 @@ ixl_assign_vsi_msix(struct ixl_pf *pf) > } > bus_describe_intr(dev, que->res, que->tag, "q%d", i); > /* Bind the vector to a CPU */ > - bus_bind_intr(dev, que->res, i); > +#ifdef RSS > + cpu_id = rss_getcpu(i % rss_getnumbuckets()); > +#endif > + bus_bind_intr(dev, que->res, cpu_id); > que->msix = vector; > TASK_INIT(&que->tx_task, 0, ixl_deferred_mq_start, que); > TASK_INIT(&que->task, 0, ixl_handle_que, que); > que->tq = taskqueue_create_fast("ixl_que", M_NOWAIT, > taskqueue_thread_enqueue, &que->tq); > - taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", > - device_get_nameunit(pf->dev)); > +#ifdef RSS > + taskqueue_start_threads_pinned(&que->tq, 1, PI_NET, > + cpu_id, "%s (bucket %d)", > + device_get_nameunit(dev), cpu_id); > +#else > + taskqueue_start_threads(&que->tq, 1, PI_NET, > + "%s que", device_get_nameunit(dev)); > +#endif > } > > return (0); > @@ -1995,6 +2027,12 @@ ixl_init_msix(struct ixl_pf *pf) > if ((ixl_max_queues != 0) && (ixl_max_queues <= queues)) > queues = ixl_max_queues; > > +#ifdef RSS > + /* If we're doing RSS, clamp at the number of RSS buckets */ > + if (queues > rss_getnumbuckets()) > + queues = rss_getnumbuckets(); > +#endif > + > /* > ** Want one vector (RX/TX pair) per queue > ** plus an additional for the admin queue. > @@ -2015,6 +2053,25 @@ ixl_init_msix(struct ixl_pf *pf) > "Using MSIX interrupts with %d vectors\n", vectors); > pf->msix = vectors; > pf->vsi.num_queues = queues; > +#ifdef RSS > + /* > + * If we're doing RSS, the number of queues needs to > + * match the number of RSS buckets that are configured. > + * > + * + If there's more queues than RSS buckets, we'll end > + * up with queues that get no traffic. > + * > + * + If there's more RSS buckets than queues, we'll end > + * up having multiple RSS buckets map to the same queue, > + * so there'll be some contention. > + */ > + if (queues != rss_getnumbuckets()) { > + device_printf(dev, > + "%s: queues (%d) != RSS buckets (%d)" > + "; performance will be impacted.\n", > + __func__, queues, rss_getnumbuckets()); > + } > +#endif > return (vectors); > } > msi: > @@ -2383,7 +2440,8 @@ ixl_setup_interface(device_t dev, struct > if (aq_error == I40E_ERR_UNKNOWN_PHY) { > /* Need delay to detect fiber correctly */ > i40e_msec_delay(200); > - aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, TRUE, &abilities_resp, NULL); > + aq_error = i40e_aq_get_phy_capabilities(hw, FALSE, > + TRUE, &abilities_resp, NULL); > if (aq_error == I40E_ERR_UNKNOWN_PHY) > device_printf(dev, "Unknown PHY type detected!\n"); > else > @@ -3043,7 +3101,6 @@ ixl_add_sysctls_eth_stats(struct sysctl_ > "Multicast Packets Transmitted"}, > {ð_stats->tx_broadcast, "bcast_pkts_txd", > "Broadcast Packets Transmitted"}, > - {ð_stats->tx_discards, "tx_discards", "Discarded TX packets"}, > // end > {0,0,0} > }; > @@ -3126,19 +3183,45 @@ static void ixl_config_rss(struct ixl_vs > struct ixl_pf *pf = (struct ixl_pf *)vsi->back; > struct i40e_hw *hw = vsi->hw; > u32 lut = 0; > - u64 set_hena, hena; > - int i, j; > + u64 set_hena = 0, hena; > + int i, j, que_id; > +#ifdef RSS > + u32 rss_hash_config; > + u32 rss_seed[IXL_KEYSZ]; > +#else > + u32 rss_seed[IXL_KEYSZ] = {0x41b01687, > + 0x183cfd8c, 0xce880440, 0x580cbc3c, > + 0x35897377, 0x328b25e1, 0x4fa98922, > + 0xb7d90c14, 0xd5bad70d, 0xcd15a2c1}; > +#endif > > - static const u32 seed[I40E_PFQF_HKEY_MAX_INDEX + 1] = {0x41b01687, > - 0x183cfd8c, 0xce880440, 0x580cbc3c, 0x35897377, > - 0x328b25e1, 0x4fa98922, 0xb7d90c14, 0xd5bad70d, > - 0xcd15a2c1, 0xe8580225, 0x4a1e9d11, 0xfe5731be}; > +#ifdef RSS > + /* Fetch the configured RSS key */ > + rss_getkey((uint8_t *) &rss_seed); > +#endif > > /* Fill out hash function seed */ > - for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) > - wr32(hw, I40E_PFQF_HKEY(i), seed[i]); > + for (i = 0; i < IXL_KEYSZ; i++) > + wr32(hw, I40E_PFQF_HKEY(i), rss_seed[i]); > > /* Enable PCTYPES for RSS: */ > +#ifdef RSS > + rss_hash_config = rss_gethashconfig(); > + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV4) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER); > + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV4) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP); > + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP); > + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER); > + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6); > + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_TCP); > + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_UDP); > +#else > set_hena = > ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | > ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | > @@ -3151,7 +3234,7 @@ static void ixl_config_rss(struct ixl_vs > ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | > ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6) | > ((u64)1 << I40E_FILTER_PCTYPE_L2_PAYLOAD); > - > +#endif > hena = (u64)rd32(hw, I40E_PFQF_HENA(0)) | > ((u64)rd32(hw, I40E_PFQF_HENA(1)) << 32); > hena |= set_hena; > @@ -3162,8 +3245,19 @@ static void ixl_config_rss(struct ixl_vs > for (i = j = 0; i < pf->hw.func_caps.rss_table_size; i++, j++) { > if (j == vsi->num_queues) > j = 0; > +#ifdef RSS > + /* > + * Fetch the RSS bucket id for the given indirection entry. > + * Cap it at the number of configured buckets (which is > + * num_queues.) > + */ > + que_id = rss_get_indirection_to_bucket(i); > + que_id = que_id % vsi->num_queues; > +#else > + que_id = j; > +#endif > /* lut = 4-byte sliding window of 4 lut entries */ > - lut = (lut << 8) | (j & > + lut = (lut << 8) | (que_id & > ((0x1 << pf->hw.func_caps.rss_table_entry_width) - 1)); > /* On i = 3, we have 4 entries in lut; write to the register */ > if ((i & 3) == 3) > @@ -3401,7 +3495,7 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, > a = malloc(sizeof(struct i40e_aqc_add_macvlan_element_data) * cnt, > M_DEVBUF, M_NOWAIT | M_ZERO); > if (a == NULL) { > - device_printf(dev, "add hw filter failed to get memory\n"); > + device_printf(dev, "add_hw_filters failed to get memory\n"); > return; > } > > @@ -3426,8 +3520,8 @@ ixl_add_hw_filters(struct ixl_vsi *vsi, > if (j > 0) { > err = i40e_aq_add_macvlan(hw, vsi->seid, a, j, NULL); > if (err) > - device_printf(dev, "aq_add_macvlan failure %d\n", > - hw->aq.asq_last_status); > + device_printf(dev, "aq_add_macvlan err %d, aq_error %d\n", > + err, hw->aq.asq_last_status); > else > vsi->hw_filters_add += j; > } > @@ -3476,6 +3570,7 @@ ixl_del_hw_filters(struct ixl_vsi *vsi, > err = i40e_aq_remove_macvlan(hw, vsi->seid, d, j, NULL); > /* NOTE: returns ENOENT every time but seems to work fine, > so we'll ignore that specific error. */ > + // TODO: Does this still occur on current firmwares? > if (err && hw->aq.asq_last_status != I40E_AQ_RC_ENOENT) { > int sc = 0; > for (int i = 0; i < j; i++) > @@ -3828,29 +3923,6 @@ ixl_update_stats_counters(struct ixl_pf > pf->stat_offsets_loaded, > &osd->link_xoff_tx, &nsd->link_xoff_tx); > > - /* Priority flow control stats */ > -#if 0 > - for (int i = 0; i < 8; i++) { > - ixl_stat_update32(hw, I40E_GLPRT_PXONRXC(hw->port, i), > - pf->stat_offsets_loaded, > - &osd->priority_xon_rx[i], > - &nsd->priority_xon_rx[i]); > - ixl_stat_update32(hw, I40E_GLPRT_PXONTXC(hw->port, i), > - pf->stat_offsets_loaded, > - &osd->priority_xon_tx[i], > - &nsd->priority_xon_tx[i]); > - ixl_stat_update32(hw, I40E_GLPRT_PXOFFTXC(hw->port, i), > - pf->stat_offsets_loaded, > - &osd->priority_xoff_tx[i], > - &nsd->priority_xoff_tx[i]); > - ixl_stat_update32(hw, > - I40E_GLPRT_RXON2OFFCNT(hw->port, i), > - pf->stat_offsets_loaded, > - &osd->priority_xon_2_xoff[i], > - &nsd->priority_xon_2_xoff[i]); > - } > -#endif > - > /* Packet size stats rx */ > ixl_stat_update48(hw, I40E_GLPRT_PRC64H(hw->port), > I40E_GLPRT_PRC64L(hw->port), > @@ -4377,6 +4449,15 @@ ixl_set_advertised_speeds(struct ixl_pf > return (EAGAIN); > } > > + /* > + ** This seems a bit heavy handed, but we > + ** need to get a reinit on some devices > + */ > + IXL_PF_LOCK(pf); > + ixl_stop(pf); > + ixl_init_locked(pf); > + IXL_PF_UNLOCK(pf); > + > return (0); > } > > @@ -4521,7 +4602,7 @@ ixl_sysctl_show_fw(SYSCTL_HANDLER_ARGS) > } > > > -#ifdef IXL_DEBUG > +#ifdef IXL_DEBUG_SYSCTL > static int > ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS) > { > @@ -4630,6 +4711,16 @@ ixl_sysctl_sw_filter_list(SYSCTL_HANDLER > > #define IXL_SW_RES_SIZE 0x14 > static int > +ixl_res_alloc_cmp(const void *a, const void *b) > +{ > + const struct i40e_aqc_switch_resource_alloc_element_resp *one, *two; > + one = (struct i40e_aqc_switch_resource_alloc_element_resp *)a; > + two = (struct i40e_aqc_switch_resource_alloc_element_resp *)b; > + > + return ((int)one->resource_type - (int)two->resource_type); > +} > + > +static int > ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS) > { > struct ixl_pf *pf = (struct ixl_pf *)arg1; > @@ -4647,6 +4738,7 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A > return (ENOMEM); > } > > + bzero(resp, sizeof(resp)); > error = i40e_aq_get_switch_resource_alloc(hw, &num_entries, > resp, > IXL_SW_RES_SIZE, > @@ -4657,9 +4749,14 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A > sbuf_delete(buf); > return error; > } > - device_printf(dev, "Num_entries: %d\n", num_entries); > + > + /* Sort entries by type for display */ > + qsort(resp, num_entries, > + sizeof(struct i40e_aqc_switch_resource_alloc_element_resp), > + &ixl_res_alloc_cmp); > > sbuf_cat(buf, "\n"); > + sbuf_printf(buf, "# of entries: %d\n", num_entries); > sbuf_printf(buf, > "Type | Guaranteed | Total | Used | Un-allocated\n" > " | (this) | (all) | (this) | (all) \n"); > @@ -4847,5 +4944,5 @@ ixl_sysctl_dump_txd(SYSCTL_HANDLER_ARGS) > sbuf_delete(buf); > return error; > } > -#endif > +#endif /* IXL_DEBUG_SYSCTL */ > > > Modified: stable/10/sys/dev/ixl/if_ixlv.c > ============================================================================== > --- stable/10/sys/dev/ixl/if_ixlv.c Fri Dec 11 11:08:00 2015 (r292093) > +++ stable/10/sys/dev/ixl/if_ixlv.c Fri Dec 11 12:16:05 2015 (r292094) > @@ -37,10 +37,14 @@ > #include "ixl.h" > #include "ixlv.h" > > +#ifdef RSS > +#include > +#endif > + > /********************************************************************* > * Driver version > *********************************************************************/ > -char ixlv_driver_version[] = "1.1.18"; > +char ixlv_driver_version[] = "1.2.1"; > > /********************************************************************* > * PCI Device ID Table > @@ -1161,7 +1165,11 @@ ixlv_init_msix(struct ixlv_sc *sc) > /* Override with hardcoded value if sane */ > if ((ixlv_max_queues != 0) && (ixlv_max_queues <= queues)) > queues = ixlv_max_queues; > - > +#ifdef RSS > + /* If we're doing RSS, clamp at the number of RSS buckets */ > + if (queues > rss_getnumbuckets()) > + queues = rss_getnumbuckets(); > +#endif > /* Enforce the VF max value */ > if (queues > IXLV_MAX_QUEUES) > queues = IXLV_MAX_QUEUES; > @@ -1181,6 +1189,26 @@ ixlv_init_msix(struct ixlv_sc *sc) > goto fail; > } > > +#ifdef RSS > + /* > + * If we're doing RSS, the number of queues needs to > + * match the number of RSS buckets that are configured. > + * > + * + If there's more queues than RSS buckets, we'll end > + * up with queues that get no traffic. > + * > + * + If there's more RSS buckets than queues, we'll end > + * up having multiple RSS buckets map to the same queue, > + * so there'll be some contention. > + */ > + if (queues != rss_getnumbuckets()) { > + device_printf(dev, > + "%s: queues (%d) != RSS buckets (%d)" > + "; performance will be impacted.\n", > + __func__, queues, rss_getnumbuckets()); > + } > +#endif > + > if (pci_alloc_msix(dev, &vectors) == 0) { > device_printf(sc->dev, > "Using MSIX interrupts with %d vectors\n", vectors); > @@ -1352,6 +1380,7 @@ ixlv_assign_msix(struct ixlv_sc *sc) > int error, rid, vector = 1; > > for (int i = 0; i < vsi->num_queues; i++, vector++, que++) { > + int cpu_id = i; > rid = vector + 1; > txr = &que->txr; > que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, > @@ -1372,15 +1401,25 @@ ixlv_assign_msix(struct ixlv_sc *sc) > } > bus_describe_intr(dev, que->res, que->tag, "que %d", i); > /* Bind the vector to a CPU */ > - bus_bind_intr(dev, que->res, i); > +#ifdef RSS > + cpu_id = rss_getcpu(i % rss_getnumbuckets()); > +#endif > + bus_bind_intr(dev, que->res, cpu_id); > que->msix = vector; > vsi->que_mask |= (u64)(1 << que->msix); > TASK_INIT(&que->tx_task, 0, ixl_deferred_mq_start, que); > TASK_INIT(&que->task, 0, ixlv_handle_que, que); > que->tq = taskqueue_create_fast("ixlv_que", M_NOWAIT, > taskqueue_thread_enqueue, &que->tq); > - taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", > - device_get_nameunit(sc->dev)); > +#ifdef RSS > + taskqueue_start_threads_pinned(&que->tq, 1, PI_NET, > + cpu_id, "%s (bucket %d)", > + device_get_nameunit(dev), cpu_id); > +#else > + taskqueue_start_threads(&que->tq, 1, PI_NET, > + "%s que", device_get_nameunit(dev)); > +#endif > + > } > > return (0); > @@ -2521,16 +2560,18 @@ ixlv_config_rss(struct ixlv_sc *sc) > struct i40e_hw *hw = &sc->hw; > struct ixl_vsi *vsi = &sc->vsi; > u32 lut = 0; > - u64 set_hena, hena; > - int i, j; > - > - /* set up random bits */ > - static const u32 seed[I40E_VFQF_HKEY_MAX_INDEX + 1] = { > - 0x794221b4, 0xbca0c5ab, 0x6cd5ebd9, 0x1ada6127, > - 0x983b3aa1, 0x1c4e71eb, 0x7f6328b2, 0xfcdc0da0, > - 0xc135cafa, 0x7a6f7e2d, 0xe7102d28, 0x163cd12e, > - 0x4954b126 }; > - > + u64 set_hena = 0, hena; > + int i, j, que_id; > +#ifdef RSS > + u32 rss_hash_config; > + u32 rss_seed[IXL_KEYSZ]; > +#else > + u32 rss_seed[IXL_KEYSZ] = {0x41b01687, > + 0x183cfd8c, 0xce880440, 0x580cbc3c, > + 0x35897377, 0x328b25e1, 0x4fa98922, > + 0xb7d90c14, 0xd5bad70d, 0xcd15a2c1}; > +#endif > + > /* Don't set up RSS if using a single queue */ > if (vsi->num_queues == 1) { > wr32(hw, I40E_VFQF_HENA(0), 0); > @@ -2539,11 +2580,32 @@ ixlv_config_rss(struct ixlv_sc *sc) > return; > } > > +#ifdef RSS > + /* Fetch the configured RSS key */ > + rss_getkey((uint8_t *) &rss_seed); > +#endif > /* Fill out hash function seed */ > - for (i = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) > - wr32(hw, I40E_VFQF_HKEY(i), seed[i]); > + for (i = 0; i <= IXL_KEYSZ; i++) > + wr32(hw, I40E_VFQF_HKEY(i), rss_seed[i]); > > /* Enable PCTYPES for RSS: */ > +#ifdef RSS > + rss_hash_config = rss_gethashconfig(); > + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV4) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER); > + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV4) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP); > + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP); > + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER); > + if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6); > + if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_TCP); > + if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) > + set_hena |= ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_UDP); > +#else > set_hena = > ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | > ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | > @@ -2556,7 +2618,7 @@ ixlv_config_rss(struct ixlv_sc *sc) > ((u64)1 << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | > ((u64)1 << I40E_FILTER_PCTYPE_FRAG_IPV6) | > ((u64)1 << I40E_FILTER_PCTYPE_L2_PAYLOAD); > - > +#endif > hena = (u64)rd32(hw, I40E_VFQF_HENA(0)) | > ((u64)rd32(hw, I40E_VFQF_HENA(1)) << 32); > hena |= set_hena; > @@ -2564,16 +2626,26 @@ ixlv_config_rss(struct ixlv_sc *sc) > wr32(hw, I40E_VFQF_HENA(1), (u32)(hena >> 32)); > > /* Populate the LUT with max no. of queues in round robin fashion */ > - for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; j++) { > + for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++, j++) { > if (j == vsi->num_queues) > j = 0; > +#ifdef RSS > + /* > + * Fetch the RSS bucket id for the given indirection entry. > + * Cap it at the number of configured buckets (which is > + * num_queues.) > + */ > + que_id = rss_get_indirection_to_bucket(i); > + que_id = que_id % vsi->num_queues; > +#else > + que_id = j; > +#endif > /* lut = 4-byte sliding window of 4 lut entries */ > - lut = (lut << 8) | (j & 0xF); > + lut = (lut << 8) | (que_id & 0xF); > /* On i = 3, we have 4 entries in lut; write to the register */ > - if ((j & 3) == 3) { > + if ((i & 3) == 3) { > wr32(hw, I40E_VFQF_HLUT(i), lut); > DDPRINTF(sc->dev, "HLUT(%2d): %#010x", i, lut); > - i++; > } > } > ixl_flush(hw); > > Modified: stable/10/sys/dev/ixl/ixl.h > ============================================================================== > --- stable/10/sys/dev/ixl/ixl.h Fri Dec 11 11:08:00 2015 (r292093) > +++ stable/10/sys/dev/ixl/ixl.h Fri Dec 11 12:16:05 2015 (r292094) > @@ -93,7 +93,7 @@ > #include "i40e_type.h" > #include "i40e_prototype.h" > > -#ifdef IXL_DEBUG > +#if defined(IXL_DEBUG) || defined(IXL_DEBUG_SYSCTL) > #include > > #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x" > @@ -101,7 +101,13 @@ > (mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \ > (mac_addr)[4], (mac_addr)[5] > #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off") > +#endif /* IXL_DEBUG || IXL_DEBUG_SYSCTL */ > > +#ifdef IXL_DEBUG > +/* Enable debug sysctls */ > +#ifndef IXL_DEBUG_SYSCTL > +#define IXL_DEBUG_SYSCTL 1 > +#endif > > #define _DBG_PRINTF(S, ...) printf("%s: " S "\n", __func__, ##__VA_ARGS__) > #define _DEV_DBG_PRINTF(dev, S, ...) device_printf(dev, "%s: " S "\n", __func__, ##__VA_ARGS__) > @@ -128,7 +134,7 @@ > > #define HW_DEBUGOUT(...) if (DEBUG_HW) _DBG_PRINTF(__VA_ARGS__) > > -#else > +#else /* no IXL_DEBUG */ > #define DEBUG_INIT 0 > #define DEBUG_IOCTL 0 > #define DEBUG_HW 0 > @@ -144,7 +150,7 @@ > #define IOCTL_DBG_IF2(...) > #define IOCTL_DBG_IF(...) > #define HW_DEBUGOUT(...) > -#endif > +#endif /* IXL_DEBUG */ > > /* Tunables */ > > @@ -214,6 +220,7 @@ > #define IXL_MAX_TSO_SEGS 66 > #define IXL_SPARSE_CHAIN 6 > #define IXL_QUEUE_HUNG 0x80000000 > +#define IXL_KEYSZ 10 > > /* ERJ: hardware can support ~1.5k filters between all functions */ > #define IXL_MAX_FILTERS 256 > > Modified: stable/10/sys/dev/ixl/ixl_txrx.c > ============================================================================== > --- stable/10/sys/dev/ixl/ixl_txrx.c Fri Dec 11 11:08:00 2015 (r292093) > +++ stable/10/sys/dev/ixl/ixl_txrx.c Fri Dec 11 12:16:05 2015 (r292094) > @@ -42,6 +42,10 @@ > #include "opt_inet6.h" > #include "ixl.h" > > +#ifdef RSS > +#include > +#endif > + > /* Local Prototypes */ > static void ixl_rx_checksum(struct mbuf *, u32, u32, u8); > static void ixl_refresh_mbufs(struct ixl_queue *, int); > @@ -65,14 +69,33 @@ ixl_mq_start(struct ifnet *ifp, struct m > struct ixl_queue *que; > struct tx_ring *txr; > int err, i; > +#ifdef RSS > + u32 bucket_id; > +#endif > > - /* check if flowid is set */ > - if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) > - i = m->m_pkthdr.flowid % vsi->num_queues; > - else > + /* > + ** Which queue to use: > + ** > + ** When doing RSS, map it to the same outbound > + ** queue as the incoming flow would be mapped to. > + ** If everything is setup correctly, it should be > + ** the same bucket that the current CPU we're on is. > + */ > + if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { > +#ifdef RSS > + if (rss_hash2bucket(m->m_pkthdr.flowid, > + M_HASHTYPE_GET(m), &bucket_id) == 0) { > + i = bucket_id % vsi->num_queues; > + } else > +#endif > + i = m->m_pkthdr.flowid % vsi->num_queues; > + } else > i = curcpu % vsi->num_queues; > - > - /* Check for a hung queue and pick alternative */ > + /* > + ** This may not be perfect, but until something > + ** better comes along it will keep from scheduling > + ** on stalled queues. > + */ > if (((1 << i) & vsi->active_queues) == 0) > i = ffsl(vsi->active_queues); > > @@ -1089,8 +1112,8 @@ int > ixl_init_rx_ring(struct ixl_queue *que) > { > struct rx_ring *rxr = &que->rxr; > -#if defined(INET6) || defined(INET) > struct ixl_vsi *vsi = que->vsi; > +#if defined(INET6) || defined(INET) > struct ifnet *ifp = vsi->ifp; > struct lro_ctrl *lro = &rxr->lro; > #endif > @@ -1345,6 +1368,63 @@ ixl_rx_discard(struct rx_ring *rxr, int > return; > } > > +#ifdef RSS > +/* > +** ixl_ptype_to_hash: parse the packet type > +** to determine the appropriate hash. > +*/ > +static inline int > +ixl_ptype_to_hash(u8 ptype) > +{ > + struct i40e_rx_ptype_decoded decoded; > + u8 ex = 0; > + > + decoded = decode_rx_desc_ptype(ptype); > + ex = decoded.outer_frag; > + > + if (!decoded.known) > + return M_HASHTYPE_OPAQUE; > + > + if (decoded.outer_ip == I40E_RX_PTYPE_OUTER_L2) > + return M_HASHTYPE_OPAQUE; > + > + /* Note: anything that gets to this point is IP */ > + if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6) { > + switch (decoded.inner_prot) { > + case I40E_RX_PTYPE_INNER_PROT_TCP: > + if (ex) > + return M_HASHTYPE_RSS_TCP_IPV6_EX; > + else > + return M_HASHTYPE_RSS_TCP_IPV6; > + case I40E_RX_PTYPE_INNER_PROT_UDP: > + if (ex) > + return M_HASHTYPE_RSS_UDP_IPV6_EX; > + else > + return M_HASHTYPE_RSS_UDP_IPV6; > + default: > + if (ex) > + return M_HASHTYPE_RSS_IPV6_EX; > + else > + return M_HASHTYPE_RSS_IPV6; > + } > + } > + if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV4) { > + switch (decoded.inner_prot) { > + case I40E_RX_PTYPE_INNER_PROT_TCP: > + return M_HASHTYPE_RSS_TCP_IPV4; > + case I40E_RX_PTYPE_INNER_PROT_UDP: > + if (ex) > + return M_HASHTYPE_RSS_UDP_IPV4_EX; > + else > + return M_HASHTYPE_RSS_UDP_IPV4; > + default: > + return M_HASHTYPE_RSS_IPV4; > + } > + } > + /* We should never get here!! */ > + return M_HASHTYPE_OPAQUE; > +} > +#endif /* RSS */ > > /********************************************************************* > * > @@ -1542,8 +1622,14 @@ ixl_rxeof(struct ixl_queue *que, int cou > rxr->bytes += sendmp->m_pkthdr.len; > if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) > ixl_rx_checksum(sendmp, status, error, ptype); > +#ifdef RSS > + sendmp->m_pkthdr.flowid = > + le32toh(cur->wb.qword0.hi_dword.rss); > + M_HASHTYPE_SET(sendmp, ixl_ptype_to_hash(ptype)); > +#else > sendmp->m_pkthdr.flowid = que->msix; > M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE); > +#endif > } > next_desc: > bus_dmamap_sync(rxr->dma.tag, rxr->dma.map, > From owner-svn-src-stable@freebsd.org Fri Dec 11 12:24:12 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A37269D5C20; Fri, 11 Dec 2015 12:24:12 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70F291AC8; Fri, 11 Dec 2015 12:24:12 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBCOBES047289; Fri, 11 Dec 2015 12:24:11 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBCOBd5047286; Fri, 11 Dec 2015 12:24:11 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111224.tBBCOBd5047286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 12:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292096 - in stable/10/sys/dev: ixl netmap X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 12:24:12 -0000 Author: smh Date: Fri Dec 11 12:24:11 2015 New Revision: 292096 URL: https://svnweb.freebsd.org/changeset/base/292096 Log: MFC r279232: Add native netmap support to ixl Sponsored by: Multiplay Added: stable/10/sys/dev/netmap/if_ixl_netmap.h - copied unchanged from r279232, head/sys/dev/netmap/if_ixl_netmap.h Modified: stable/10/sys/dev/ixl/if_ixl.c stable/10/sys/dev/ixl/ixl_txrx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:20:58 2015 (r292095) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:24:11 2015 (r292096) @@ -212,6 +212,9 @@ DRIVER_MODULE(ixl, pci, ixl_driver, ixl_ MODULE_DEPEND(ixl, pci, 1, 1, 1); MODULE_DEPEND(ixl, ether, 1, 1, 1); +#ifdef DEV_NETMAP +MODULE_DEPEND(ixl, netmap, 1, 1, 1); +#endif /* DEV_NETMAP */ /* ** Global reset mutex @@ -286,6 +289,10 @@ int ixl_atr_rate = 20; TUNABLE_INT("hw.ixl.atr_rate", &ixl_atr_rate); #endif +#ifdef DEV_NETMAP +#define NETMAP_IXL_MAIN /* only bring in one part of the netmap code */ +#include +#endif /* DEV_NETMAP */ static char *ixl_fc_string[6] = { "None", @@ -646,6 +653,9 @@ ixl_attach(device_t dev) ixl_unregister_vlan, vsi, EVENTHANDLER_PRI_FIRST); +#ifdef DEV_NETMAP + ixl_netmap_attach(vsi); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("ixl_attach: end"); return (0); @@ -724,6 +734,9 @@ ixl_detach(device_t dev) EVENTHANDLER_DEREGISTER(vlan_unconfig, vsi->vlan_detach); callout_drain(&pf->timer); +#ifdef DEV_NETMAP + netmap_detach(vsi->ifp); +#endif /* DEV_NETMAP */ ixl_free_pci_resources(pf); @@ -2661,6 +2674,15 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) break; } wr32(vsi->hw, I40E_QRX_TAIL(que->me), 0); +#ifdef DEV_NETMAP + /* preserve queue */ + if (vsi->ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(vsi->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring); + wr32(vsi->hw, I40E_QRX_TAIL(que->me), t); + } else +#endif /* DEV_NETMAP */ wr32(vsi->hw, I40E_QRX_TAIL(que->me), que->num_desc - 1); } return (err); Modified: stable/10/sys/dev/ixl/ixl_txrx.c ============================================================================== --- stable/10/sys/dev/ixl/ixl_txrx.c Fri Dec 11 12:20:58 2015 (r292095) +++ stable/10/sys/dev/ixl/ixl_txrx.c Fri Dec 11 12:24:11 2015 (r292096) @@ -61,6 +61,10 @@ static __inline void ixl_rx_discard(stru static __inline void ixl_rx_input(struct rx_ring *, struct ifnet *, struct mbuf *, u8); +#ifdef DEV_NETMAP +#include +#endif /* DEV_NETMAP */ + /* ** Multiqueue Transmit driver ** @@ -485,9 +489,21 @@ ixl_init_tx_ring(struct ixl_queue *que) { struct tx_ring *txr = &que->txr; struct ixl_tx_buf *buf; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(que->vsi->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old ring contents */ IXL_TX_LOCK(txr); +#ifdef DEV_NETMAP + /* + * (under lock): if in netmap mode, do some consistency + * checks and set slot to entry 0 of the netmap ring. + */ + slot = netmap_reset(na, NR_TX, que->me, 0); +#endif /* DEV_NETMAP */ + bzero((void *)txr->base, (sizeof(struct i40e_tx_desc)) * que->num_desc); @@ -511,6 +527,19 @@ ixl_init_tx_ring(struct ixl_queue *que) m_freem(buf->m_head); buf->m_head = NULL; } +#ifdef DEV_NETMAP + /* + * In netmap mode, set the map for the packet buffer. + * NOTE: Some drivers (not this one) also need to set + * the physical buffer address in the NIC ring. + * netmap_idx_n2k() maps a nic index, i, into the corresponding + * netmap slot index, si + */ + if (slot) { + int si = netmap_idx_n2k(&na->tx_rings[que->me], i); + netmap_load_map(na, buf->tag, buf->map, NMB(na, slot + si)); + } +#endif /* DEV_NETMAP */ /* Clear the EOP index */ buf->eop_index = -1; } @@ -822,6 +851,11 @@ ixl_txeof(struct ixl_queue *que) mtx_assert(&txr->mtx, MA_OWNED); +#ifdef DEV_NETMAP + // XXX todo: implement moderation + if (netmap_tx_irq(que->vsi->ifp, que->me)) + return FALSE; +#endif /* DEF_NETMAP */ /* These are not the descriptors you seek, move along :) */ if (txr->avail == que->num_desc) { @@ -1123,8 +1157,16 @@ ixl_init_rx_ring(struct ixl_queue *que) struct ixl_rx_buf *buf; bus_dma_segment_t pseg[1], hseg[1]; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(que->vsi->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ IXL_RX_LOCK(rxr); +#ifdef DEV_NETMAP + /* same as in ixl_init_tx_ring() */ + slot = netmap_reset(na, NR_RX, que->me, 0); +#endif /* DEV_NETMAP */ /* Clear the ring contents */ rsize = roundup2(que->num_desc * sizeof(union i40e_rx_desc), DBA_ALIGN); @@ -1158,6 +1200,28 @@ ixl_init_rx_ring(struct ixl_queue *que) struct mbuf *mh, *mp; buf = &rxr->buffers[j]; +#ifdef DEV_NETMAP + /* + * In netmap mode, fill the map and set the buffer + * address in the NIC ring, considering the offset + * between the netmap and NIC rings (see comment in + * ixgbe_setup_transmit_ring() ). No need to allocate + * an mbuf, so end the block with a continue; + */ + if (slot) { + int sj = netmap_idx_n2k(&na->rx_rings[que->me], j); + uint64_t paddr; + void *addr; + + addr = PNMB(na, slot + sj, &paddr); + netmap_load_map(na, rxr->dma.tag, buf->pmap, addr); + /* Update descriptor and the cached value */ + rxr->base[j].read.pkt_addr = htole64(paddr); + rxr->base[j].read.hdr_addr = 0; + continue; + } +#endif /* DEV_NETMAP */ + /* ** Don't allocate mbufs if not ** doing header split, its wasteful @@ -1457,6 +1521,12 @@ ixl_rxeof(struct ixl_queue *que, int cou IXL_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (netmap_rx_irq(ifp, que->me, &count)) { + IXL_RX_UNLOCK(rxr); + return (FALSE); + } +#endif /* DEV_NETMAP */ for (i = rxr->next_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; Copied: stable/10/sys/dev/netmap/if_ixl_netmap.h (from r279232, head/sys/dev/netmap/if_ixl_netmap.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/netmap/if_ixl_netmap.h Fri Dec 11 12:24:11 2015 (r292096, copy of r279232, head/sys/dev/netmap/if_ixl_netmap.h) @@ -0,0 +1,422 @@ +/* + * Copyright (C) 2015, Luigi Rizzo. 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$ + * + * netmap support for: ixl + * + * derived from ixgbe + * netmap support for a network driver. + * This file contains code but only static or inline functions used + * by a single driver. To avoid replication of code we just #include + * it near the beginning of the standard driver. + * For ixl the file is imported in two places, hence the conditional at the + * beginning. + */ + +#include +#include + +/* + * Some drivers may need the following headers. Others + * already include them by default + +#include +#include + + */ +#include + +int ixl_netmap_txsync(struct netmap_kring *kring, int flags); +int ixl_netmap_rxsync(struct netmap_kring *kring, int flags); + +extern int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip; + +#ifdef NETMAP_IXL_MAIN +/* + * device-specific sysctl variables: + * + * ixl_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * During regular operations the CRC is stripped, but on some + * hardware reception of frames not multiple of 64 is slower, + * so using crcstrip=0 helps in benchmarks. + * + * ixl_rx_miss, ixl_rx_miss_bufs: + * count packets that might be missed due to lost interrupts. + */ +SYSCTL_DECL(_dev_netmap); +int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip; +SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_crcstrip, + CTLFLAG_RW, &ixl_crcstrip, 0, "strip CRC on rx frames"); +SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss, + CTLFLAG_RW, &ixl_rx_miss, 0, "potentially missed rx intr"); +SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss_bufs, + CTLFLAG_RW, &ixl_rx_miss_bufs, 0, "potentially missed rx intr bufs"); + + +/* + * Register/unregister. We are already under netmap lock. + * Only called on the first register or the last unregister. + */ +static int +ixl_netmap_reg(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct ixl_vsi *vsi = ifp->if_softc; + struct ixl_pf *pf = (struct ixl_pf *)vsi->back; + + IXL_PF_LOCK(pf); + ixl_disable_intr(vsi); + + /* Tell the stack that the interface is no longer active */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + //set_crcstrip(&adapter->hw, onoff); + /* enable or disable flags and callbacks in na and ifp */ + if (onoff) { + nm_set_native_flags(na); + } else { + nm_clear_native_flags(na); + } + ixl_init_locked(pf); /* also enables intr */ + //set_crcstrip(&adapter->hw, onoff); // XXX why twice ? + IXL_PF_UNLOCK(pf); + return (ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1); +} + + +/* + * The attach routine, called near the end of ixl_attach(), + * fills the parameters for netmap_attach() and calls it. + * It cannot fail, in the worst case (such as no memory) + * netmap mode will be disabled and the driver will only + * operate in standard mode. + */ +static void +ixl_netmap_attach(struct ixl_vsi *vsi) +{ + struct netmap_adapter na; + + bzero(&na, sizeof(na)); + + na.ifp = vsi->ifp; + na.na_flags = NAF_BDG_MAYSLEEP; + // XXX check that queues is set. + printf("queues is %p\n", vsi->queues); + if (vsi->queues) { + na.num_tx_desc = vsi->queues[0].num_desc; + na.num_rx_desc = vsi->queues[0].num_desc; + } + na.nm_txsync = ixl_netmap_txsync; + na.nm_rxsync = ixl_netmap_rxsync; + na.nm_register = ixl_netmap_reg; + na.num_tx_rings = na.num_rx_rings = vsi->num_queues; + netmap_attach(&na); +} + + +#else /* !NETMAP_IXL_MAIN, code for ixl_txrx.c */ + +/* + * Reconcile kernel and user view of the transmit ring. + * + * All information is in the kring. + * Userspace wants to send packets up to the one before kring->rhead, + * kernel knows kring->nr_hwcur is the first unsent packet. + * + * Here we push packets out (as many as possible), and possibly + * reclaim buffers from previously completed transmission. + * + * The caller (netmap) guarantees that there is only one instance + * running at any time. Any interference with other driver + * methods should be handled by the individual drivers. + */ +int +ixl_netmap_txsync(struct netmap_kring *kring, int flags) +{ + struct netmap_adapter *na = kring->na; + struct ifnet *ifp = na->ifp; + struct netmap_ring *ring = kring->ring; + u_int nm_i; /* index into the netmap ring */ + u_int nic_i; /* index into the NIC ring */ + u_int n; + u_int const lim = kring->nkr_num_slots - 1; + u_int const head = kring->rhead; + /* + * interrupts on every tx packet are expensive so request + * them every half ring, or where NS_REPORT is set + */ + u_int report_frequency = kring->nkr_num_slots >> 1; + + /* device-specific */ + struct ixl_vsi *vsi = ifp->if_softc; + struct ixl_queue *que = &vsi->queues[kring->ring_id]; + struct tx_ring *txr = &que->txr; + + bus_dmamap_sync(txr->dma.tag, txr->dma.map, + BUS_DMASYNC_POSTREAD); + + /* + * First part: process new packets to send. + * nm_i is the current index in the netmap ring, + * nic_i is the corresponding index in the NIC ring. + * + * If we have packets to send (nm_i != head) + * iterate over the netmap ring, fetch length and update + * the corresponding slot in the NIC ring. Some drivers also + * need to update the buffer's physical address in the NIC slot + * even NS_BUF_CHANGED is not set (PNMB computes the addresses). + * + * The netmap_reload_map() calls is especially expensive, + * even when (as in this case) the tag is 0, so do only + * when the buffer has actually changed. + * + * If possible do not set the report/intr bit on all slots, + * but only a few times per ring or when NS_REPORT is set. + * + * Finally, on 10G and faster drivers, it might be useful + * to prefetch the next slot and txr entry. + */ + + nm_i = kring->nr_hwcur; + if (nm_i != head) { /* we have new packets to send */ + nic_i = netmap_idx_k2n(kring, nm_i); + + __builtin_prefetch(&ring->slot[nm_i]); + __builtin_prefetch(&txr->buffers[nic_i]); + + for (n = 0; nm_i != head; n++) { + struct netmap_slot *slot = &ring->slot[nm_i]; + u_int len = slot->len; + uint64_t paddr; + void *addr = PNMB(na, slot, &paddr); + + /* device-specific */ + struct i40e_tx_desc *curr = &txr->base[nic_i]; + struct ixl_tx_buf *txbuf = &txr->buffers[nic_i]; + u64 flags = (slot->flags & NS_REPORT || + nic_i == 0 || nic_i == report_frequency) ? + ((u64)I40E_TX_DESC_CMD_RS << I40E_TXD_QW1_CMD_SHIFT) : 0; + + /* prefetch for next round */ + __builtin_prefetch(&ring->slot[nm_i + 1]); + __builtin_prefetch(&txr->buffers[nic_i + 1]); + + NM_CHECK_ADDR_LEN(na, addr, len); + + if (slot->flags & NS_BUF_CHANGED) { + /* buffer has changed, reload map */ + netmap_reload_map(na, txr->dma.tag, txbuf->map, addr); + } + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); + + /* Fill the slot in the NIC ring. */ + curr->buffer_addr = htole64(paddr); + curr->cmd_type_offset_bsz = htole64( + ((u64)len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT) | + flags | + ((u64)I40E_TX_DESC_CMD_EOP << I40E_TXD_QW1_CMD_SHIFT) + ); // XXX more ? + + /* make sure changes to the buffer are synced */ + bus_dmamap_sync(txr->dma.tag, txbuf->map, + BUS_DMASYNC_PREWRITE); + + nm_i = nm_next(nm_i, lim); + nic_i = nm_next(nic_i, lim); + } + kring->nr_hwcur = head; + + /* synchronize the NIC ring */ + bus_dmamap_sync(txr->dma.tag, txr->dma.map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + /* (re)start the tx unit up to slot nic_i (excluded) */ + wr32(vsi->hw, txr->tail, nic_i); + } + + /* + * Second part: reclaim buffers for completed transmissions. + */ + nic_i = LE32_TO_CPU(*(volatile __le32 *)&txr->base[que->num_desc]); + if (nic_i != txr->next_to_clean) { + /* some tx completed, increment avail */ + txr->next_to_clean = nic_i; + kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); + } + + nm_txsync_finalize(kring); + + return 0; +} + + +/* + * Reconcile kernel and user view of the receive ring. + * Same as for the txsync, this routine must be efficient. + * The caller guarantees a single invocations, but races against + * the rest of the driver should be handled here. + * + * On call, kring->rhead is the first packet that userspace wants + * to keep, and kring->rcur is the wakeup point. + * The kernel has previously reported packets up to kring->rtail. + * + * If (flags & NAF_FORCE_READ) also check for incoming packets irrespective + * of whether or not we received an interrupt. + */ +int +ixl_netmap_rxsync(struct netmap_kring *kring, int flags) +{ + struct netmap_adapter *na = kring->na; + struct ifnet *ifp = na->ifp; + struct netmap_ring *ring = kring->ring; + u_int nm_i; /* index into the netmap ring */ + u_int nic_i; /* index into the NIC ring */ + u_int n; + u_int const lim = kring->nkr_num_slots - 1; + u_int const head = nm_rxsync_prologue(kring); + int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; + + /* device-specific */ + struct ixl_vsi *vsi = ifp->if_softc; + struct ixl_queue *que = &vsi->queues[kring->ring_id]; + struct rx_ring *rxr = &que->rxr; + + if (head > lim) + return netmap_ring_reinit(kring); + + /* XXX check sync modes */ + bus_dmamap_sync(rxr->dma.tag, rxr->dma.map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + + /* + * First part: import newly received packets. + * + * nm_i is the index of the next free slot in the netmap ring, + * nic_i is the index of the next received packet in the NIC ring, + * and they may differ in case if_init() has been called while + * in netmap mode. For the receive ring we have + * + * nic_i = rxr->next_check; + * nm_i = kring->nr_hwtail (previous) + * and + * nm_i == (nic_i + kring->nkr_hwofs) % ring_size + * + * rxr->next_check is set to 0 on a ring reinit + */ + if (netmap_no_pendintr || force_update) { + int crclen = ixl_crcstrip ? 0 : 4; + uint16_t slot_flags = kring->nkr_slot_flags; + + nic_i = rxr->next_check; // or also k2n(kring->nr_hwtail) + nm_i = netmap_idx_n2k(kring, nic_i); + + for (n = 0; ; n++) { + union i40e_32byte_rx_desc *curr = &rxr->base[nic_i]; + uint64_t qword = le64toh(curr->wb.qword1.status_error_len); + uint32_t staterr = (qword & I40E_RXD_QW1_STATUS_MASK) + >> I40E_RXD_QW1_STATUS_SHIFT; + + if ((staterr & (1<slot[nm_i].len = ((qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) + >> I40E_RXD_QW1_LENGTH_PBUF_SHIFT) - crclen; + ring->slot[nm_i].flags = slot_flags; + bus_dmamap_sync(rxr->ptag, + rxr->buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); + nm_i = nm_next(nm_i, lim); + nic_i = nm_next(nic_i, lim); + } + if (n) { /* update the state variables */ + if (netmap_no_pendintr && !force_update) { + /* diagnostics */ + ixl_rx_miss ++; + ixl_rx_miss_bufs += n; + } + rxr->next_check = nic_i; + kring->nr_hwtail = nm_i; + } + kring->nr_kflags &= ~NKR_PENDINTR; + } + + /* + * Second part: skip past packets that userspace has released. + * (kring->nr_hwcur to head excluded), + * and make the buffers available for reception. + * As usual nm_i is the index in the netmap ring, + * nic_i is the index in the NIC ring, and + * nm_i == (nic_i + kring->nkr_hwofs) % ring_size + */ + nm_i = kring->nr_hwcur; + if (nm_i != head) { + nic_i = netmap_idx_k2n(kring, nm_i); + for (n = 0; nm_i != head; n++) { + struct netmap_slot *slot = &ring->slot[nm_i]; + uint64_t paddr; + void *addr = PNMB(na, slot, &paddr); + + union i40e_32byte_rx_desc *curr = &rxr->base[nic_i]; + struct ixl_rx_buf *rxbuf = &rxr->buffers[nic_i]; + + if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ + goto ring_reset; + + if (slot->flags & NS_BUF_CHANGED) { + /* buffer has changed, reload map */ + netmap_reload_map(na, rxr->ptag, rxbuf->pmap, addr); + slot->flags &= ~NS_BUF_CHANGED; + } + curr->read.pkt_addr = htole64(paddr); + curr->read.hdr_addr = 0; // XXX needed + bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + BUS_DMASYNC_PREREAD); + nm_i = nm_next(nm_i, lim); + nic_i = nm_next(nic_i, lim); + } + kring->nr_hwcur = head; + + bus_dmamap_sync(rxr->dma.tag, rxr->dma.map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* + * IMPORTANT: we must leave one free slot in the ring, + * so move nic_i back by one unit + */ + nic_i = nm_prev(nic_i, lim); + wr32(vsi->hw, rxr->tail, nic_i); + } + + /* tell userspace that there might be new packets */ + nm_rxsync_finalize(kring); + + return 0; + +ring_reset: + return netmap_ring_reinit(kring); +} + +#endif /* !NETMAP_IXL_MAIN */ + +/* end of file */ From owner-svn-src-stable@freebsd.org Fri Dec 11 12:47:51 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 778159D7E0B; Fri, 11 Dec 2015 12:47:51 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17DD118CF; Fri, 11 Dec 2015 12:47:51 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBCloNW053344; Fri, 11 Dec 2015 12:47:50 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBClnLI053338; Fri, 11 Dec 2015 12:47:49 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111247.tBBClnLI053338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 12:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292097 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 12:47:51 -0000 Author: smh Date: Fri Dec 11 12:47:49 2015 New Revision: 292097 URL: https://svnweb.freebsd.org/changeset/base/292097 Log: MFC r279858 & r279860: SRIOV & 20G support Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/i40e_adminq_cmd.h stable/10/sys/dev/ixl/i40e_common.c stable/10/sys/dev/ixl/i40e_prototype.h stable/10/sys/dev/ixl/i40e_type.h stable/10/sys/dev/ixl/if_ixl.c stable/10/sys/dev/ixl/if_ixlv.c stable/10/sys/dev/ixl/ixl.h stable/10/sys/dev/ixl/ixl_pf.h stable/10/sys/dev/ixl/ixl_txrx.c stable/10/sys/dev/ixl/ixlv.h stable/10/sys/dev/ixl/ixlvc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/i40e_adminq_cmd.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq_cmd.h Fri Dec 11 12:24:11 2015 (r292096) +++ stable/10/sys/dev/ixl/i40e_adminq_cmd.h Fri Dec 11 12:47:49 2015 (r292097) @@ -42,7 +42,7 @@ */ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR 0x0004 +#define I40E_FW_API_VERSION_MINOR 0x0002 struct i40e_aq_desc { __le16 flags; @@ -140,7 +140,12 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_list_func_capabilities = 0x000A, i40e_aqc_opc_list_dev_capabilities = 0x000B, + i40e_aqc_opc_set_cppm_configuration = 0x0103, + i40e_aqc_opc_set_arp_proxy_entry = 0x0104, + i40e_aqc_opc_set_ns_proxy_entry = 0x0105, + /* LAA */ + i40e_aqc_opc_mng_laa = 0x0106, /* AQ obsolete */ i40e_aqc_opc_mac_address_read = 0x0107, i40e_aqc_opc_mac_address_write = 0x0108, @@ -265,6 +270,7 @@ enum i40e_admin_queue_opc { /* Tunnel commands */ i40e_aqc_opc_add_udp_tunnel = 0x0B00, i40e_aqc_opc_del_udp_tunnel = 0x0B01, + i40e_aqc_opc_tunnel_key_structure = 0x0B10, /* Async Events */ i40e_aqc_opc_event_lan_overflow = 0x1001, @@ -276,6 +282,8 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_oem_ocbb_initialize = 0xFE03, /* debug commands */ + i40e_aqc_opc_debug_get_deviceid = 0xFF00, + i40e_aqc_opc_debug_set_mode = 0xFF01, i40e_aqc_opc_debug_read_reg = 0xFF03, i40e_aqc_opc_debug_write_reg = 0xFF04, i40e_aqc_opc_debug_modify_reg = 0xFF07, @@ -509,8 +517,7 @@ struct i40e_aqc_mac_address_read { #define I40E_AQC_SAN_ADDR_VALID 0x20 #define I40E_AQC_PORT_ADDR_VALID 0x40 #define I40E_AQC_WOL_ADDR_VALID 0x80 -#define I40E_AQC_MC_MAG_EN_VALID 0x100 -#define I40E_AQC_ADDR_VALID_MASK 0x1F0 +#define I40E_AQC_ADDR_VALID_MASK 0xf0 u8 reserved[6]; __le32 addr_high; __le32 addr_low; @@ -533,9 +540,7 @@ struct i40e_aqc_mac_address_write { #define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x0000 #define I40E_AQC_WRITE_TYPE_LAA_WOL 0x4000 #define I40E_AQC_WRITE_TYPE_PORT 0x8000 -#define I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG 0xC000 -#define I40E_AQC_WRITE_TYPE_MASK 0xC000 - +#define I40E_AQC_WRITE_TYPE_MASK 0xc000 __le16 mac_sah; __le32 mac_sal; u8 reserved[8]; @@ -1071,7 +1076,6 @@ struct i40e_aqc_set_vsi_promiscuous_mode __le16 seid; #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF __le16 vlan_tag; -#define I40E_AQC_SET_VSI_VLAN_MASK 0x0FFF #define I40E_AQC_SET_VSI_VLAN_VALID 0x8000 u8 reserved[8]; }; @@ -2066,12 +2070,6 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_star #define I40E_AQC_CEE_PFC_STATUS_MASK (0x7 << I40E_AQC_CEE_PFC_STATUS_SHIFT) #define I40E_AQC_CEE_APP_STATUS_SHIFT 0x8 #define I40E_AQC_CEE_APP_STATUS_MASK (0x7 << I40E_AQC_CEE_APP_STATUS_SHIFT) -#define I40E_AQC_CEE_FCOE_STATUS_SHIFT 0x8 -#define I40E_AQC_CEE_FCOE_STATUS_MASK (0x7 << I40E_AQC_CEE_FCOE_STATUS_SHIFT) -#define I40E_AQC_CEE_ISCSI_STATUS_SHIFT 0xA -#define I40E_AQC_CEE_ISCSI_STATUS_MASK (0x7 << I40E_AQC_CEE_ISCSI_STATUS_SHIFT) -#define I40E_AQC_CEE_FIP_STATUS_SHIFT 0x10 -#define I40E_AQC_CEE_FIP_STATUS_MASK (0x7 << I40E_AQC_CEE_FIP_STATUS_SHIFT) struct i40e_aqc_get_cee_dcb_cfg_v1_resp { u8 reserved1; u8 oper_num_tc; Modified: stable/10/sys/dev/ixl/i40e_common.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_common.c Fri Dec 11 12:24:11 2015 (r292096) +++ stable/10/sys/dev/ixl/i40e_common.c Fri Dec 11 12:47:49 2015 (r292097) @@ -866,7 +866,7 @@ static enum i40e_media_type i40e_get_med return media; } -#define I40E_PF_RESET_WAIT_COUNT 110 +#define I40E_PF_RESET_WAIT_COUNT 200 /** * i40e_pf_reset - Reset the PF * @hw: pointer to the hardware structure @@ -1108,11 +1108,9 @@ u32 i40e_led_get(struct i40e_hw *hw) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); + /* ignore gpio LED src mode entries related to the activity LEDs */ + current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> + I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); switch (current_mode) { case I40E_COMBINED_ACTIVITY: case I40E_FILTER_ACTIVITY: @@ -1156,11 +1154,9 @@ void i40e_led_set(struct i40e_hw *hw, u3 if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); + /* ignore gpio LED src mode entries related to the activity LEDs */ + current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> + I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); switch (current_mode) { case I40E_COMBINED_ACTIVITY: case I40E_FILTER_ACTIVITY: @@ -1529,6 +1525,7 @@ aq_get_link_info_exit: return status; } + /** * i40e_aq_set_phy_int_mask * @hw: pointer to the hw struct @@ -2816,13 +2813,12 @@ i40e_aq_erase_nvm_exit: #define I40E_DEV_FUNC_CAP_MSIX_VF 0x44 #define I40E_DEV_FUNC_CAP_FLOW_DIRECTOR 0x45 #define I40E_DEV_FUNC_CAP_IEEE_1588 0x46 -#define I40E_DEV_FUNC_CAP_FLEX10 0xF1 +#define I40E_DEV_FUNC_CAP_MFP_MODE_1 0xF1 #define I40E_DEV_FUNC_CAP_CEM 0xF2 #define I40E_DEV_FUNC_CAP_IWARP 0x51 #define I40E_DEV_FUNC_CAP_LED 0x61 #define I40E_DEV_FUNC_CAP_SDP 0x62 #define I40E_DEV_FUNC_CAP_MDIO 0x63 -#define I40E_DEV_FUNC_CAP_WR_CSR_PROT 0x64 /** * i40e_parse_discover_capabilities @@ -2840,7 +2836,6 @@ static void i40e_parse_discover_capabili struct i40e_aqc_list_capabilities_element_resp *cap; u32 valid_functions, num_functions; u32 number, logical_id, phys_id; - u8 major_rev; struct i40e_hw_capabilities *p; u32 i = 0; u16 id; @@ -2859,7 +2854,6 @@ static void i40e_parse_discover_capabili number = LE32_TO_CPU(cap->number); logical_id = LE32_TO_CPU(cap->logical_id); phys_id = LE32_TO_CPU(cap->phys_id); - major_rev = cap->major_rev; switch (id) { case I40E_DEV_FUNC_CAP_SWITCH_MODE: @@ -2934,21 +2928,9 @@ static void i40e_parse_discover_capabili case I40E_DEV_FUNC_CAP_MSIX_VF: p->num_msix_vectors_vf = number; break; - case I40E_DEV_FUNC_CAP_FLEX10: - if (major_rev == 1) { - if (number == 1) { - p->flex10_enable = TRUE; - p->flex10_capable = TRUE; - } - } else { - /* Capability revision >= 2 */ - if (number & 1) - p->flex10_enable = TRUE; - if (number & 2) - p->flex10_capable = TRUE; - } - p->flex10_mode = logical_id; - p->flex10_status = phys_id; + case I40E_DEV_FUNC_CAP_MFP_MODE_1: + if (number == 1) + p->mfp_mode_1 = TRUE; break; case I40E_DEV_FUNC_CAP_CEM: if (number == 1) @@ -2981,18 +2963,11 @@ static void i40e_parse_discover_capabili p->fd_filters_guaranteed = number; p->fd_filters_best_effort = logical_id; break; - case I40E_DEV_FUNC_CAP_WR_CSR_PROT: - p->wr_csr_prot = (u64)number; - p->wr_csr_prot |= (u64)logical_id << 32; - break; default: break; } } - if (p->fcoe) - i40e_debug(hw, I40E_DEBUG_ALL, "device is FCoE capable\n"); - /* Always disable FCoE if compiled without the I40E_FCOE_ENA flag */ p->fcoe = FALSE; @@ -4948,63 +4923,6 @@ void i40e_set_pci_config_data(struct i40 } /** - * i40e_aq_debug_dump - * @hw: pointer to the hardware structure - * @cluster_id: specific cluster to dump - * @table_id: table id within cluster - * @start_index: index of line in the block to read - * @buff_size: dump buffer size - * @buff: dump buffer - * @ret_buff_size: actual buffer size returned - * @ret_next_table: next block to read - * @ret_next_index: next index to read - * - * Dump internal FW/HW data for debug purposes. - * - **/ -enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id, - u8 table_id, u32 start_index, u16 buff_size, - void *buff, u16 *ret_buff_size, - u8 *ret_next_table, u32 *ret_next_index, - struct i40e_asq_cmd_details *cmd_details) -{ - struct i40e_aq_desc desc; - struct i40e_aqc_debug_dump_internals *cmd = - (struct i40e_aqc_debug_dump_internals *)&desc.params.raw; - struct i40e_aqc_debug_dump_internals *resp = - (struct i40e_aqc_debug_dump_internals *)&desc.params.raw; - enum i40e_status_code status; - - if (buff_size == 0 || !buff) - return I40E_ERR_PARAM; - - i40e_fill_default_direct_cmd_desc(&desc, - i40e_aqc_opc_debug_dump_internals); - /* Indirect Command */ - desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); - if (buff_size > I40E_AQ_LARGE_BUF) - desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB); - - cmd->cluster_id = cluster_id; - cmd->table_id = table_id; - cmd->idx = CPU_TO_LE32(start_index); - - desc.datalen = CPU_TO_LE16(buff_size); - - status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details); - if (!status) { - if (ret_buff_size != NULL) - *ret_buff_size = LE16_TO_CPU(desc.datalen); - if (ret_next_table != NULL) - *ret_next_table = resp->table_id; - if (ret_next_index != NULL) - *ret_next_index = LE32_TO_CPU(resp->idx); - } - - return status; -} - -/** * i40e_read_bw_from_alt_ram * @hw: pointer to the hardware structure * @max_bw: pointer for max_bw read Modified: stable/10/sys/dev/ixl/i40e_prototype.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_prototype.h Fri Dec 11 12:24:11 2015 (r292096) +++ stable/10/sys/dev/ixl/i40e_prototype.h Fri Dec 11 12:47:49 2015 (r292097) @@ -445,9 +445,4 @@ enum i40e_status_code i40e_aq_add_rem_co u16 vsi_seid, u16 queue, bool is_add, struct i40e_control_filter_stats *stats, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id, - u8 table_id, u32 start_index, u16 buff_size, - void *buff, u16 *ret_buff_size, - u8 *ret_next_table, u32 *ret_next_index, - struct i40e_asq_cmd_details *cmd_details); #endif /* _I40E_PROTOTYPE_H_ */ Modified: stable/10/sys/dev/ixl/i40e_type.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_type.h Fri Dec 11 12:24:11 2015 (r292096) +++ stable/10/sys/dev/ixl/i40e_type.h Fri Dec 11 12:47:49 2015 (r292097) @@ -287,17 +287,7 @@ struct i40e_hw_capabilities { bool dcb; bool fcoe; bool iscsi; /* Indicates iSCSI enabled */ - bool flex10_enable; - bool flex10_capable; - u32 flex10_mode; -#define I40E_FLEX10_MODE_UNKNOWN 0x0 -#define I40E_FLEX10_MODE_DCC 0x1 -#define I40E_FLEX10_MODE_DCI 0x2 - - u32 flex10_status; -#define I40E_FLEX10_STATUS_DCC_ERROR 0x1 -#define I40E_FLEX10_STATUS_VC_MODE 0x2 - + bool mfp_mode_1; bool mgmt_cem; bool ieee_1588; bool iwarp; @@ -326,7 +316,6 @@ struct i40e_hw_capabilities { u8 rx_buf_chain_len; u32 enabled_tcmap; u32 maxtc; - u64 wr_csr_prot; }; struct i40e_mac_info { @@ -573,7 +562,7 @@ struct i40e_hw { u32 debug_mask; }; -static INLINE bool i40e_is_vf(struct i40e_hw *hw) +static inline bool i40e_is_vf(struct i40e_hw *hw) { return hw->mac.type == I40E_MAC_VF; } @@ -1274,9 +1263,6 @@ struct i40e_hw_port_stats { /* flow director stats */ u64 fd_atr_match; u64 fd_sb_match; - u64 fd_atr_tunnel_match; - u32 fd_atr_status; - u32 fd_sb_status; /* EEE LPI */ u32 tx_lpi_status; u32 rx_lpi_status; Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:24:11 2015 (r292096) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:47:49 2015 (r292097) @@ -47,7 +47,7 @@ /********************************************************************* * Driver version *********************************************************************/ -char ixl_driver_version[] = "1.3.6"; +char ixl_driver_version[] = "1.4.1"; /********************************************************************* * PCI Device ID Table @@ -69,6 +69,7 @@ static ixl_vendor_info_t ixl_vendor_info {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QSFP_B, 0, 0, 0}, {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QSFP_C, 0, 0, 0}, {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T, 0, 0, 0}, + {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_20G_KR2, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -112,16 +113,17 @@ static void ixl_configure_legacy(struct static void ixl_free_pci_resources(struct ixl_pf *); static void ixl_local_timer(void *); static int ixl_setup_interface(device_t, struct ixl_vsi *); -static bool ixl_config_link(struct i40e_hw *); +static void ixl_link_event(struct ixl_pf *, struct i40e_arq_event_info *); static void ixl_config_rss(struct ixl_vsi *); static void ixl_set_queue_rx_itr(struct ixl_queue *); static void ixl_set_queue_tx_itr(struct ixl_queue *); static int ixl_set_advertised_speeds(struct ixl_pf *, int); -static void ixl_enable_rings(struct ixl_vsi *); -static void ixl_disable_rings(struct ixl_vsi *); -static void ixl_enable_intr(struct ixl_vsi *); -static void ixl_disable_intr(struct ixl_vsi *); +static int ixl_enable_rings(struct ixl_vsi *); +static int ixl_disable_rings(struct ixl_vsi *); +static void ixl_enable_intr(struct ixl_vsi *); +static void ixl_disable_intr(struct ixl_vsi *); +static void ixl_disable_rings_intr(struct ixl_vsi *); static void ixl_enable_adminq(struct i40e_hw *); static void ixl_disable_adminq(struct i40e_hw *); @@ -138,6 +140,7 @@ static void ixl_unregister_vlan(void *, static void ixl_setup_vlan_filters(struct ixl_vsi *); static void ixl_init_filters(struct ixl_vsi *); +static void ixl_reconfigure_filters(struct ixl_vsi *vsi); static void ixl_add_filter(struct ixl_vsi *, u8 *, s16 vlan); static void ixl_del_filter(struct ixl_vsi *, u8 *, s16 vlan); static void ixl_add_hw_filters(struct ixl_vsi *, int, int); @@ -145,6 +148,8 @@ static void ixl_del_hw_filters(struct ix static struct ixl_mac_filter * ixl_find_filter(struct ixl_vsi *, u8 *, s16); static void ixl_add_mc_filter(struct ixl_vsi *, u8 *); +static void ixl_free_mac_filters(struct ixl_vsi *vsi); + /* Sysctl debug interface */ static int ixl_debug_info(SYSCTL_HANDLER_ARGS); @@ -174,6 +179,7 @@ static void ixl_add_sysctls_eth_stats(st struct i40e_eth_stats *); static void ixl_update_stats_counters(struct ixl_pf *); static void ixl_update_eth_stats(struct ixl_vsi *); +static void ixl_update_vsi_stats(struct ixl_vsi *); static void ixl_pf_reset_stats(struct ixl_pf *); static void ixl_vsi_reset_stats(struct ixl_vsi *); static void ixl_stat_update48(struct i40e_hw *, u32, u32, bool, @@ -187,7 +193,21 @@ static int ixl_sysctl_phy_abilities(SYSC static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); -static int ixl_sysctl_dump_txd(SYSCTL_HANDLER_ARGS); +#endif + +#ifdef PCI_IOV +static int ixl_adminq_err_to_errno(enum i40e_admin_queue_err err); + +static int ixl_init_iov(device_t dev, uint16_t num_vfs, const nvlist_t*); +static void ixl_uninit_iov(device_t dev); +static int ixl_add_vf(device_t dev, uint16_t vfnum, const nvlist_t*); + +static void ixl_handle_vf_msg(struct ixl_pf *, + struct i40e_arq_event_info *); +static void ixl_handle_vflr(void *arg, int pending); + +static void ixl_reset_vf(struct ixl_pf *pf, struct ixl_vf *vf); +static void ixl_reinit_vf(struct ixl_pf *pf, struct ixl_vf *vf); #endif /********************************************************************* @@ -200,6 +220,11 @@ static device_method_t ixl_methods[] = { DEVMETHOD(device_attach, ixl_attach), DEVMETHOD(device_detach, ixl_detach), DEVMETHOD(device_shutdown, ixl_shutdown), +#ifdef PCI_IOV + DEVMETHOD(pci_init_iov, ixl_init_iov), + DEVMETHOD(pci_uninit_iov, ixl_uninit_iov), + DEVMETHOD(pci_add_vf, ixl_add_vf), +#endif {0, 0} }; @@ -212,10 +237,12 @@ DRIVER_MODULE(ixl, pci, ixl_driver, ixl_ MODULE_DEPEND(ixl, pci, 1, 1, 1); MODULE_DEPEND(ixl, ether, 1, 1, 1); + #ifdef DEV_NETMAP MODULE_DEPEND(ixl, netmap, 1, 1, 1); #endif /* DEV_NETMAP */ + /* ** Global reset mutex */ @@ -303,6 +330,10 @@ static char *ixl_fc_string[6] = { "Default" }; +static MALLOC_DEFINE(M_IXL, "ixl", "ixl driver allocations"); + +static uint8_t ixl_bcast_addr[ETHER_ADDR_LEN] = + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /********************************************************************* * Device identification routine @@ -379,6 +410,10 @@ ixl_attach(device_t dev) struct ixl_vsi *vsi; u16 bus; int error = 0; +#ifdef PCI_IOV + nvlist_t *pf_schema, *vf_schema; + int iov_error; +#endif INIT_DEBUGOUT("ixl_attach: begin"); @@ -466,11 +501,6 @@ ixl_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "switch_config", CTLTYPE_STRING | CTLFLAG_RD, pf, 0, ixl_sysctl_switch_config, "A", "HW Switch Configuration"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "dump_desc", CTLTYPE_INT | CTLFLAG_WR, - pf, 0, ixl_sysctl_dump_txd, "I", "Desc dump"); #endif /* Save off the PCI information */ @@ -485,6 +515,8 @@ ixl_attach(device_t dev) hw->bus.device = pci_get_slot(dev); hw->bus.func = pci_get_function(dev); + pf->vc_debug_lvl = 1; + /* Do PCI setup - map BAR0, etc */ if (ixl_allocate_pci_resources(pf)) { device_printf(dev, "Allocation of PCI resources failed\n"); @@ -555,7 +587,8 @@ ixl_attach(device_t dev) } /* Set up host memory cache */ - error = i40e_init_lan_hmc(hw, vsi->num_queues, vsi->num_queues, 0, 0); + error = i40e_init_lan_hmc(hw, hw->func_caps.num_tx_qp, + hw->func_caps.num_rx_qp, 0, 0); if (error) { device_printf(dev, "init_lan_hmc failed: %d\n", error); goto err_get_cap; @@ -607,16 +640,8 @@ ixl_attach(device_t dev) } /* Determine link state */ - vsi->link_up = ixl_config_link(hw); - - /* Report if Unqualified modules are found */ - if ((vsi->link_up == FALSE) && - (pf->hw.phy.link_info.link_info & - I40E_AQ_MEDIA_AVAILABLE) && - (!(pf->hw.phy.link_info.an_info & - I40E_AQ_QUALIFIED_MODULE))) - device_printf(dev, "Link failed because " - "an unqualified module was detected\n"); + i40e_aq_get_link_info(hw, TRUE, NULL, NULL); + pf->link_up = i40e_get_link_status(hw); /* Setup OS specific network interface */ if (ixl_setup_interface(dev, vsi) != 0) { @@ -652,10 +677,31 @@ ixl_attach(device_t dev) vsi->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, ixl_unregister_vlan, vsi, EVENTHANDLER_PRI_FIRST); +#ifdef PCI_IOV + /* SR-IOV is only supported when MSI-X is in use. */ + if (pf->msix > 1) { + pf_schema = pci_iov_schema_alloc_node(); + vf_schema = pci_iov_schema_alloc_node(); + pci_iov_schema_add_unicast_mac(vf_schema, "mac-addr", 0, NULL); + pci_iov_schema_add_bool(vf_schema, "mac-anti-spoof", + IOV_SCHEMA_HASDEFAULT, TRUE); + pci_iov_schema_add_bool(vf_schema, "allow-set-mac", + IOV_SCHEMA_HASDEFAULT, FALSE); + pci_iov_schema_add_bool(vf_schema, "allow-promisc", + IOV_SCHEMA_HASDEFAULT, FALSE); + + iov_error = pci_iov_attach(dev, pf_schema, vf_schema); + if (iov_error != 0) + device_printf(dev, + "Failed to initialize SR-IOV (error=%d)\n", + iov_error); + } +#endif #ifdef DEV_NETMAP ixl_netmap_attach(vsi); #endif /* DEV_NETMAP */ + INIT_DEBUGOUT("ixl_attach: end"); return (0); @@ -691,6 +737,9 @@ ixl_detach(device_t dev) struct ixl_vsi *vsi = &pf->vsi; struct ixl_queue *que = vsi->queues; i40e_status status; +#ifdef PCI_IOV + int error; +#endif INIT_DEBUGOUT("ixl_detach: begin"); @@ -700,6 +749,14 @@ ixl_detach(device_t dev) return (EBUSY); } +#ifdef PCI_IOV + error = pci_iov_detach(dev); + if (error != 0) { + device_printf(dev, "SR-IOV in use; detach first.\n"); + return (error); + } +#endif + ether_ifdetach(vsi->ifp); if (vsi->ifp->if_drv_flags & IFF_DRV_RUNNING) { IXL_PF_LOCK(pf); @@ -737,8 +794,6 @@ ixl_detach(device_t dev) #ifdef DEV_NETMAP netmap_detach(vsi->ifp); #endif /* DEV_NETMAP */ - - ixl_free_pci_resources(pf); bus_generic_detach(dev); if_free(vsi->ifp); @@ -907,7 +962,7 @@ static int ixl_ioctl(struct ifnet * ifp, u_long command, caddr_t data) { struct ixl_vsi *vsi = ifp->if_softc; - struct ixl_pf *pf = (struct ixl_pf *)vsi->back; + struct ixl_pf *pf = vsi->back; struct ifreq *ifr = (struct ifreq *) data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; @@ -1132,6 +1187,8 @@ ixl_init_locked(struct ixl_pf *pf) i40e_aq_set_default_vsi(hw, vsi->seid, NULL); + ixl_reconfigure_filters(vsi); + /* Set MTU in hardware*/ int aq_error = i40e_aq_set_mac_config(hw, vsi->max_frame_size, TRUE, 0, NULL); @@ -1226,6 +1283,11 @@ ixl_intr(void *arg) mask = rd32(hw, I40E_PFINT_ICR0_ENA); +#ifdef PCI_IOV + if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) + taskqueue_enqueue(pf->tq, &pf->vflr_task); +#endif + if (icr0 & I40E_PFINT_ICR0_ADMINQ_MASK) { taskqueue_enqueue(pf->tq, &pf->adminq); return; @@ -1329,8 +1391,12 @@ ixl_msix_adminq(void *arg) mask &= ~I40E_PFINT_ICR0_ENA_MAL_DETECT_MASK; } - if (reg & I40E_PFINT_ICR0_VFLR_MASK) +#ifdef PCI_IOV + if (reg & I40E_PFINT_ICR0_VFLR_MASK) { mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; + taskqueue_enqueue(pf->tq, &pf->vflr_task); + } +#endif reg = rd32(hw, I40E_PFINT_DYN_CTL0); reg = reg | I40E_PFINT_DYN_CTL0_CLEARPBA_MASK; @@ -1352,18 +1418,20 @@ static void ixl_media_status(struct ifnet * ifp, struct ifmediareq * ifmr) { struct ixl_vsi *vsi = ifp->if_softc; - struct ixl_pf *pf = (struct ixl_pf *)vsi->back; + struct ixl_pf *pf = vsi->back; struct i40e_hw *hw = &pf->hw; INIT_DEBUGOUT("ixl_media_status: begin"); IXL_PF_LOCK(pf); + hw->phy.get_link_info = TRUE; + pf->link_up = i40e_get_link_status(hw); ixl_update_link_status(pf); ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (!vsi->link_up) { + if (!pf->link_up) { IXL_PF_UNLOCK(pf); return; } @@ -1753,15 +1821,14 @@ ixl_update_link_status(struct ixl_pf *pf struct ifnet *ifp = vsi->ifp; device_t dev = pf->dev; - - if (vsi->link_up){ + if (pf->link_up){ if (vsi->link_active == FALSE) { - i40e_aq_get_link_info(hw, TRUE, NULL, NULL); pf->fc = hw->fc.current_mode; if (bootverbose) { device_printf(dev,"Link is up %d Gbps %s," " Flow Control: %s\n", - ((vsi->link_speed == I40E_LINK_SPEED_40GB)? 40:10), + ((pf->link_speed == + I40E_LINK_SPEED_40GB)? 40:10), "Full Duplex", ixl_fc_string[pf->fc]); } vsi->link_active = TRUE; @@ -1770,10 +1837,12 @@ ixl_update_link_status(struct ixl_pf *pf ** partition is not at least 10GB */ if (hw->func_caps.npar_enable && - (hw->phy.link_info.link_speed == I40E_LINK_SPEED_1GB || - hw->phy.link_info.link_speed == I40E_LINK_SPEED_100MB)) - device_printf(dev, "The partition detected link" - "speed that is less than 10Gbps\n"); + (hw->phy.link_info.link_speed == + I40E_LINK_SPEED_1GB || + hw->phy.link_info.link_speed == + I40E_LINK_SPEED_100MB)) + device_printf(dev, "The partition detected" + "link speed that is less than 10Gbps\n"); if_link_state_change(ifp, LINK_STATE_UP); } } else { /* Link down */ @@ -1804,7 +1873,10 @@ ixl_stop(struct ixl_pf *pf) mtx_assert(&pf->pf_mtx, MA_OWNED); INIT_DEBUGOUT("ixl_stop: begin\n"); - ixl_disable_intr(vsi); + if (pf->num_vfs == 0) + ixl_disable_intr(vsi); + else + ixl_disable_rings_intr(vsi); ixl_disable_rings(vsi); /* Tell the stack that the interface is no longer active */ @@ -1857,6 +1929,11 @@ ixl_assign_vsi_legacy(struct ixl_pf *pf) taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", device_get_nameunit(dev)); TASK_INIT(&pf->adminq, 0, ixl_do_adminq, pf); + +#ifdef PCI_IOV + TASK_INIT(&pf->vflr_task, 0, ixl_handle_vflr, pf); +#endif + pf->tq = taskqueue_create_fast("ixl_adm", M_NOWAIT, taskqueue_thread_enqueue, &pf->tq); taskqueue_start_threads(&pf->tq, 1, PI_NET, "%s adminq", @@ -1902,6 +1979,11 @@ ixl_assign_vsi_msix(struct ixl_pf *pf) pf->admvec = vector; /* Tasklet for Admin Queue */ TASK_INIT(&pf->adminq, 0, ixl_do_adminq, pf); + +#ifdef PCI_IOV + TASK_INIT(&pf->vflr_task, 0, ixl_handle_vflr, pf); +#endif + pf->tq = taskqueue_create_fast("ixl_adm", M_NOWAIT, taskqueue_thread_enqueue, &pf->tq); taskqueue_start_threads(&pf->tq, 1, PI_NET, "%s adminq", @@ -2325,6 +2407,10 @@ ixl_add_ifmedia(struct ixl_vsi *vsi, u32 if (phy_type & (1 << I40E_PHY_TYPE_1000BASE_T)) ifmedia_add(&vsi->media, IFM_ETHER | IFM_1000_T, 0, NULL); + if (phy_type & (1 << I40E_PHY_TYPE_1000BASE_SX)) + ifmedia_add(&vsi->media, IFM_ETHER | IFM_1000_SX, 0, NULL); + if (phy_type & (1 << I40E_PHY_TYPE_1000BASE_LX)) + ifmedia_add(&vsi->media, IFM_ETHER | IFM_1000_LX, 0, NULL); if (phy_type & (1 << I40E_PHY_TYPE_10GBASE_CR1_CU) || phy_type & (1 << I40E_PHY_TYPE_10GBASE_KX4) || @@ -2465,17 +2551,32 @@ ixl_setup_interface(device_t dev, struct return (0); } -static bool -ixl_config_link(struct i40e_hw *hw) +/* +** Run when the Admin Queue gets a +** link transition interrupt. +*/ +static void +ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) { + struct i40e_hw *hw = &pf->hw; + struct i40e_aqc_get_link_status *status = + (struct i40e_aqc_get_link_status *)&e->desc.params.raw; bool check; - i40e_aq_get_link_info(hw, TRUE, NULL, NULL); + hw->phy.get_link_info = TRUE; check = i40e_get_link_status(hw); + pf->link_up = check; #ifdef IXL_DEBUG printf("Link is %s\n", check ? "up":"down"); #endif - return (check); + /* Report if Unqualified modules are found */ + if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && + (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && + (!(status->link_info & I40E_AQ_LINK_UP))) + device_printf(pf->dev, "Link failed because " + "an unqualified module was detected\n"); + + return; } /********************************************************************* @@ -2493,7 +2594,7 @@ ixl_switch_config(struct ixl_pf *pf) device_t dev = vsi->dev; struct i40e_aqc_get_switch_config_resp *sw_config; u8 aq_buf[I40E_AQ_LARGE_BUF]; - int ret = I40E_SUCCESS; + int ret; u16 next = 0; memset(&aq_buf, 0, sizeof(aq_buf)); @@ -2501,19 +2602,26 @@ ixl_switch_config(struct ixl_pf *pf) ret = i40e_aq_get_switch_config(hw, sw_config, sizeof(aq_buf), &next, NULL); if (ret) { - device_printf(dev,"aq_get_switch_config failed!!\n"); + device_printf(dev,"aq_get_switch_config failed (ret=%d)!!\n", + ret); return (ret); } #ifdef IXL_DEBUG - printf("Switch config: header reported: %d in structure, %d total\n", + device_printf(dev, + "Switch config: header reported: %d in structure, %d total\n", sw_config->header.num_reported, sw_config->header.num_total); - printf("type=%d seid=%d uplink=%d downlink=%d\n", - sw_config->element[0].element_type, - sw_config->element[0].seid, - sw_config->element[0].uplink_seid, - sw_config->element[0].downlink_seid); + for (int i = 0; i < sw_config->header.num_reported; i++) { + device_printf(dev, + "%d: type=%d seid=%d uplink=%d downlink=%d\n", i, + sw_config->element[i].element_type, + sw_config->element[i].seid, + sw_config->element[i].uplink_seid, + sw_config->element[i].downlink_seid); + } #endif /* Simplified due to a single VSI at the moment */ + vsi->uplink_seid = sw_config->element[0].uplink_seid; + vsi->downlink_seid = sw_config->element[0].downlink_seid; vsi->seid = sw_config->element[0].seid; return (ret); } @@ -2528,6 +2636,7 @@ ixl_switch_config(struct ixl_pf *pf) static int ixl_initialize_vsi(struct ixl_vsi *vsi) { + struct ixl_pf *pf = vsi->back; struct ixl_queue *que = vsi->queues; device_t dev = vsi->dev; struct i40e_hw *hw = vsi->hw; @@ -2536,6 +2645,8 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) memset(&ctxt, 0, sizeof(ctxt)); ctxt.seid = vsi->seid; + if (pf->veb_seid != 0) + ctxt.uplink_seid = pf->veb_seid; ctxt.pf_num = hw->pf_id; err = i40e_aq_get_vsi_params(hw, &ctxt, NULL); if (err) { @@ -2577,6 +2688,8 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) vsi->hw_filters_add = 0; vsi->hw_filters_del = 0; + ctxt.flags = htole16(I40E_AQ_VSI_TYPE_PF); + err = i40e_aq_update_vsi_params(hw, &ctxt, NULL); if (err) { device_printf(dev,"update vsi params failed %x!!\n", @@ -2597,7 +2710,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) size = que->num_desc * sizeof(struct i40e_tx_desc); memset(&tctx, 0, sizeof(struct i40e_hmc_obj_txq)); tctx.new_context = 1; - tctx.base = (txr->dma.pa/128); + tctx.base = (txr->dma.pa/IXL_TX_CTX_BASE_UNITS); tctx.qlen = que->num_desc; tctx.fc_ena = 0; tctx.rdylist = vsi->info.qs_handle[0]; /* index is TC */ @@ -2627,7 +2740,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) ixl_init_tx_ring(que); /* Next setup the HMC RX Context */ - if (vsi->max_frame_size <= 2048) + if (vsi->max_frame_size <= MCLBYTES) rxr->mbuf_sz = MCLBYTES; else rxr->mbuf_sz = MJUMPAGESIZE; @@ -2644,7 +2757,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) rctx.dtype = 0; rctx.dsize = 1; /* do 32byte descriptors */ rctx.hsplit_0 = 0; /* no HDR split initially */ - rctx.base = (rxr->dma.pa/128); + rctx.base = (rxr->dma.pa/IXL_RX_CTX_BASE_UNITS); rctx.qlen = que->num_desc; rctx.tphrdesc_ena = 1; rctx.tphwdesc_ena = 1; @@ -2699,7 +2812,6 @@ ixl_free_vsi(struct ixl_vsi *vsi) { struct ixl_pf *pf = (struct ixl_pf *)vsi->back; struct ixl_queue *que = vsi->queues; - struct ixl_mac_filter *f; /* Free station queues */ for (int i = 0; i < vsi->num_queues; i++, que++) { @@ -2728,6 +2840,14 @@ ixl_free_vsi(struct ixl_vsi *vsi) free(vsi->queues, M_DEVBUF); /* Free VSI filter list */ + ixl_free_mac_filters(vsi); +} + +static void +ixl_free_mac_filters(struct ixl_vsi *vsi) +{ + struct ixl_mac_filter *f; + while (!SLIST_EMPTY(&vsi->ftl)) { f = SLIST_FIRST(&vsi->ftl); SLIST_REMOVE_HEAD(&vsi->ftl, next); @@ -2759,6 +2879,7 @@ ixl_setup_stations(struct ixl_pf *pf) vsi->hw = &pf->hw; vsi->id = 0; vsi->num_vlans = 0; + vsi->back = pf; /* Get memory for the station queues */ if (!(vsi->queues = @@ -3011,6 +3132,24 @@ ixl_set_queue_tx_itr(struct ixl_queue *q return; } +#define QUEUE_NAME_LEN 32 + +static void +ixl_add_vsi_sysctls(struct ixl_pf *pf, struct ixl_vsi *vsi, + struct sysctl_ctx_list *ctx, const char *sysctl_name) +{ + struct sysctl_oid *tree; + struct sysctl_oid_list *child; + struct sysctl_oid_list *vsi_list; + + tree = device_get_sysctl_tree(pf->dev); + child = SYSCTL_CHILDREN(tree); + vsi->vsi_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, sysctl_name, + CTLFLAG_RD, NULL, "VSI Number"); + vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); + + ixl_add_sysctls_eth_stats(ctx, vsi_list, &vsi->eth_stats); +} static void ixl_add_hw_stats(struct ixl_pf *pf) @@ -3018,18 +3157,19 @@ ixl_add_hw_stats(struct ixl_pf *pf) device_t dev = pf->dev; struct ixl_vsi *vsi = &pf->vsi; struct ixl_queue *queues = vsi->queues; - struct i40e_eth_stats *vsi_stats = &vsi->eth_stats; struct i40e_hw_port_stats *pf_stats = &pf->stats; struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); struct sysctl_oid *tree = device_get_sysctl_tree(dev); struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct sysctl_oid_list *vsi_list; - struct sysctl_oid *vsi_node, *queue_node; - struct sysctl_oid_list *vsi_list, *queue_list; + struct sysctl_oid *queue_node; + struct sysctl_oid_list *queue_list; struct tx_ring *txr; struct rx_ring *rxr; + char queue_namebuf[QUEUE_NAME_LEN]; /* Driver statistics */ SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events", @@ -3039,23 +3179,18 @@ ixl_add_hw_stats(struct ixl_pf *pf) CTLFLAG_RD, &pf->admin_irq, "Admin Queue IRQ Handled"); - /* VSI statistics */ -#define QUEUE_NAME_LEN 32 - char queue_namebuf[QUEUE_NAME_LEN]; - - // ERJ: Only one vsi now, re-do when >1 VSI enabled - // snprintf(vsi_namebuf, QUEUE_NAME_LEN, "vsi%d", vsi->info.stat_counter_idx); - vsi_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "vsi", - CTLFLAG_RD, NULL, "VSI-specific stats"); - vsi_list = SYSCTL_CHILDREN(vsi_node); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "vc_debug_level", + CTLFLAG_RW, &pf->vc_debug_lvl, 0, + "PF/VF Virtual Channel debug logging level"); - ixl_add_sysctls_eth_stats(ctx, vsi_list, vsi_stats); + ixl_add_vsi_sysctls(pf, &pf->vsi, ctx, "pf"); + vsi_list = SYSCTL_CHILDREN(pf->vsi.vsi_node); /* Queue statistics */ for (int q = 0; q < vsi->num_queues; q++) { snprintf(queue_namebuf, QUEUE_NAME_LEN, "que%d", q); - queue_node = SYSCTL_ADD_NODE(ctx, vsi_list, OID_AUTO, queue_namebuf, - CTLFLAG_RD, NULL, "Queue #"); + queue_node = SYSCTL_ADD_NODE(ctx, vsi_list, + OID_AUTO, queue_namebuf, CTLFLAG_RD, NULL, "Queue #"); queue_list = SYSCTL_CHILDREN(queue_node); txr = &(queues[q].txr); @@ -3378,8 +3513,7 @@ static void ixl_init_filters(struct ixl_vsi *vsi) { /* Add broadcast address */ - u8 bc[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - ixl_add_filter(vsi, bc, IXL_VLAN_ANY); + ixl_add_filter(vsi, ixl_bcast_addr, IXL_VLAN_ANY); } /* @@ -3408,6 +3542,13 @@ ixl_add_mc_filter(struct ixl_vsi *vsi, u return; } +static void +ixl_reconfigure_filters(struct ixl_vsi *vsi) +{ + + ixl_add_hw_filters(vsi, IXL_FILTER_USED, vsi->num_macs); +} + /* ** This routine adds macvlan filters *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Dec 11 12:58:21 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C07F9D85EA; Fri, 11 Dec 2015 12:58:21 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F17C61F5A; Fri, 11 Dec 2015 12:58:20 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBCwKL9056418; Fri, 11 Dec 2015 12:58:20 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBCwKWv056417; Fri, 11 Dec 2015 12:58:20 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111258.tBBCwKWv056417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 12:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292098 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 12:58:21 -0000 Author: smh Date: Fri Dec 11 12:58:19 2015 New Revision: 292098 URL: https://svnweb.freebsd.org/changeset/base/292098 Log: MFC r280043: Remove redundant sysctl_handle_string Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/if_ixl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:47:49 2015 (r292097) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 12:58:19 2015 (r292098) @@ -4989,7 +4989,7 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A u8 num_entries; struct i40e_aqc_switch_resource_alloc_element_resp resp[IXL_SW_RES_SIZE]; - buf = sbuf_new_for_sysctl(NULL, NULL, 0, req); + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); if (!buf) { device_printf(dev, "Could not allocate sbuf for output.\n"); return (ENOMEM); @@ -5031,6 +5031,9 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A } error = sbuf_finish(buf); + if (error) { + device_printf(dev, "Error finishing sbuf: %d\n", error); + } sbuf_delete(buf); return (error); @@ -5089,7 +5092,7 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ struct i40e_aqc_get_switch_config_resp *sw_config; sw_config = (struct i40e_aqc_get_switch_config_resp *)aq_buf; - buf = sbuf_new_for_sysctl(NULL, NULL, 0, req); + buf = sbuf_new_for_sysctl(NULL, NULL, 128, req); if (!buf) { device_printf(dev, "Could not allocate sbuf for sysctl output.\n"); return (ENOMEM); @@ -5108,6 +5111,7 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ nmbuf = sbuf_new_auto(); if (!nmbuf) { device_printf(dev, "Could not allocate sbuf for name output.\n"); + sbuf_delete(buf); return (ENOMEM); } @@ -5140,6 +5144,9 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ sbuf_delete(nmbuf); error = sbuf_finish(buf); + if (error) { + device_printf(dev, "Error finishing sbuf: %d\n", error); + } sbuf_delete(buf); return (error); From owner-svn-src-stable@freebsd.org Fri Dec 11 13:05:20 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D4F19D8BDF; Fri, 11 Dec 2015 13:05:20 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D22DA177A; Fri, 11 Dec 2015 13:05:19 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBD5I7q059337; Fri, 11 Dec 2015 13:05:18 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBD5IDI059336; Fri, 11 Dec 2015 13:05:18 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111305.tBBD5IDI059336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 13:05:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292099 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:05:20 -0000 Author: smh Date: Fri Dec 11 13:05:18 2015 New Revision: 292099 URL: https://svnweb.freebsd.org/changeset/base/292099 Log: MFC r283119: Remove executable property from ixl Sponsored by: Multiplay Modified: Directory Properties: stable/10/ (props changed) stable/10/sys/dev/ixl/i40e_adminq.c (props changed) stable/10/sys/dev/ixl/i40e_adminq.h (props changed) stable/10/sys/dev/ixl/i40e_adminq_cmd.h (props changed) stable/10/sys/dev/ixl/i40e_alloc.h (props changed) stable/10/sys/dev/ixl/i40e_common.c (props changed) stable/10/sys/dev/ixl/i40e_hmc.c (props changed) stable/10/sys/dev/ixl/i40e_hmc.h (props changed) stable/10/sys/dev/ixl/i40e_lan_hmc.c (props changed) stable/10/sys/dev/ixl/i40e_lan_hmc.h (props changed) stable/10/sys/dev/ixl/i40e_nvm.c (props changed) stable/10/sys/dev/ixl/i40e_osdep.c (props changed) stable/10/sys/dev/ixl/i40e_osdep.h (props changed) stable/10/sys/dev/ixl/i40e_prototype.h (props changed) stable/10/sys/dev/ixl/i40e_register.h (props changed) stable/10/sys/dev/ixl/i40e_status.h (props changed) stable/10/sys/dev/ixl/i40e_type.h (props changed) stable/10/sys/dev/ixl/i40e_virtchnl.h (props changed) stable/10/sys/dev/ixl/if_ixl.c (props changed) stable/10/sys/dev/ixl/ixl_txrx.c (props changed) From owner-svn-src-stable@freebsd.org Fri Dec 11 13:08:40 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 001589D8E53; Fri, 11 Dec 2015 13:08:39 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9286619FF; Fri, 11 Dec 2015 13:08:39 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBD8cKv059515; Fri, 11 Dec 2015 13:08:38 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBD8cYb059510; Fri, 11 Dec 2015 13:08:38 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111308.tBBD8cYb059510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 13:08:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292100 - in stable/10/sys: dev/ixl modules/ixl modules/ixlv X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:08:40 -0000 Author: smh Date: Fri Dec 11 13:08:38 2015 New Revision: 292100 URL: https://svnweb.freebsd.org/changeset/base/292100 Log: MFC r284049: Update SW4 to the Intel ixl/ixlv Sponsored by: Multiplay Added: stable/10/sys/dev/ixl/i40e_devids.h - copied unchanged from r284049, head/sys/dev/ixl/i40e_devids.h Modified: stable/10/sys/dev/ixl/i40e_adminq.c stable/10/sys/dev/ixl/i40e_adminq.h stable/10/sys/dev/ixl/i40e_adminq_cmd.h stable/10/sys/dev/ixl/i40e_common.c stable/10/sys/dev/ixl/i40e_hmc.c stable/10/sys/dev/ixl/i40e_hmc.h stable/10/sys/dev/ixl/i40e_lan_hmc.c stable/10/sys/dev/ixl/i40e_nvm.c stable/10/sys/dev/ixl/i40e_osdep.h stable/10/sys/dev/ixl/i40e_prototype.h stable/10/sys/dev/ixl/i40e_register.h stable/10/sys/dev/ixl/i40e_type.h stable/10/sys/dev/ixl/i40e_virtchnl.h stable/10/sys/dev/ixl/if_ixl.c stable/10/sys/dev/ixl/if_ixlv.c stable/10/sys/dev/ixl/ixlv.h stable/10/sys/dev/ixl/ixlvc.c stable/10/sys/modules/ixl/Makefile stable/10/sys/modules/ixlv/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/i40e_adminq.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq.c Fri Dec 11 13:05:18 2015 (r292099) +++ stable/10/sys/dev/ixl/i40e_adminq.c Fri Dec 11 13:08:38 2015 (r292100) @@ -315,8 +315,12 @@ static enum i40e_status_code i40e_config wr32(hw, hw->aq.asq.tail, 0); /* set starting point */ - wr32(hw, hw->aq.asq.len, (hw->aq.num_asq_entries | - I40E_PF_ATQLEN_ATQENABLE_MASK)); + if (!i40e_is_vf(hw)) + wr32(hw, hw->aq.asq.len, (hw->aq.num_asq_entries | + I40E_PF_ATQLEN_ATQENABLE_MASK)); + if (i40e_is_vf(hw)) + wr32(hw, hw->aq.asq.len, (hw->aq.num_asq_entries | + I40E_VF_ATQLEN1_ATQENABLE_MASK)); wr32(hw, hw->aq.asq.bal, I40E_LO_DWORD(hw->aq.asq.desc_buf.pa)); wr32(hw, hw->aq.asq.bah, I40E_HI_DWORD(hw->aq.asq.desc_buf.pa)); @@ -344,8 +348,12 @@ static enum i40e_status_code i40e_config wr32(hw, hw->aq.arq.tail, 0); /* set starting point */ - wr32(hw, hw->aq.arq.len, (hw->aq.num_arq_entries | - I40E_PF_ARQLEN_ARQENABLE_MASK)); + if (!i40e_is_vf(hw)) + wr32(hw, hw->aq.arq.len, (hw->aq.num_arq_entries | + I40E_PF_ARQLEN_ARQENABLE_MASK)); + if (i40e_is_vf(hw)) + wr32(hw, hw->aq.arq.len, (hw->aq.num_arq_entries | + I40E_VF_ARQLEN1_ARQENABLE_MASK)); wr32(hw, hw->aq.arq.bal, I40E_LO_DWORD(hw->aq.arq.desc_buf.pa)); wr32(hw, hw->aq.arq.bah, I40E_HI_DWORD(hw->aq.arq.desc_buf.pa)); @@ -559,6 +567,7 @@ enum i40e_status_code i40e_init_adminq(s { enum i40e_status_code ret_code; u16 eetrack_lo, eetrack_hi; + u16 cfg_ptr, oem_hi, oem_lo; int retry = 0; /* verify input for valid configuration */ if ((hw->aq.num_arq_entries == 0) || @@ -619,6 +628,12 @@ enum i40e_status_code i40e_init_adminq(s i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_LO, &eetrack_lo); i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_HI, &eetrack_hi); hw->nvm.eetrack = (eetrack_hi << 16) | eetrack_lo; + i40e_read_nvm_word(hw, I40E_SR_BOOT_CONFIG_PTR, &cfg_ptr); + i40e_read_nvm_word(hw, (cfg_ptr + I40E_NVM_OEM_VER_OFF), + &oem_hi); + i40e_read_nvm_word(hw, (cfg_ptr + (I40E_NVM_OEM_VER_OFF + 1)), + &oem_lo); + hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo; if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { ret_code = I40E_ERR_FIRMWARE_API_VERSION; @@ -669,6 +684,9 @@ enum i40e_status_code i40e_shutdown_admi i40e_destroy_spinlock(&hw->aq.asq_spinlock); i40e_destroy_spinlock(&hw->aq.arq_spinlock); + if (hw->nvm_buff.va) + i40e_free_virt_mem(hw, &hw->nvm_buff); + return ret_code; } @@ -688,16 +706,16 @@ u16 i40e_clean_asq(struct i40e_hw *hw) desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); + while (rd32(hw, hw->aq.asq.head) != ntc) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, - "%s: ntc %d head %d.\n", __FUNCTION__, ntc, - rd32(hw, hw->aq.asq.head)); + "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head)); if (details->callback) { I40E_ADMINQ_CALLBACK cb_func = (I40E_ADMINQ_CALLBACK)details->callback; - i40e_memcpy(&desc_cb, desc, - sizeof(struct i40e_aq_desc), I40E_DMA_TO_DMA); + i40e_memcpy(&desc_cb, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_DMA); cb_func(hw, &desc_cb); } i40e_memset(desc, 0, sizeof(*desc), I40E_DMA_MEM); @@ -755,6 +773,8 @@ enum i40e_status_code i40e_asq_send_comm u16 retval = 0; u32 val = 0; + hw->aq.asq_last_status = I40E_AQ_RC_OK; + val = rd32(hw, hw->aq.asq.head); if (val >= hw->aq.num_asq_entries) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, @@ -912,6 +932,11 @@ enum i40e_status_code i40e_asq_send_comm "AQTX: desc and buffer writeback:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size); + /* save writeback aq if requested */ + if (details->wb_desc) + i40e_memcpy(details->wb_desc, desc_on_ring, + sizeof(struct i40e_aq_desc), I40E_DMA_TO_NONDMA); + /* update the error if time out occurred */ if ((!cmd_completed) && (!details->async && !details->postpone)) { @@ -971,7 +996,10 @@ enum i40e_status_code i40e_clean_arq_ele i40e_acquire_spinlock(&hw->aq.arq_spinlock); /* set next_to_use to head */ - ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK); + if (!i40e_is_vf(hw)) + ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK); + if (i40e_is_vf(hw)) + ntu = (rd32(hw, hw->aq.arq.head) & I40E_VF_ARQH1_ARQH_MASK); if (ntu == ntc) { /* nothing to do - shouldn't need to update ring's values */ ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK; @@ -1040,6 +1068,19 @@ clean_arq_element_out: i40e_release_nvm(hw); hw->aq.nvm_release_on_done = FALSE; } + + switch (hw->nvmupd_state) { + case I40E_NVMUPD_STATE_INIT_WAIT: + hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; + break; + + case I40E_NVMUPD_STATE_WRITE_WAIT: + hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING; + break; + + default: + break; + } } return ret_code; @@ -1051,9 +1092,6 @@ void i40e_resume_aq(struct i40e_hw *hw) hw->aq.asq.next_to_use = 0; hw->aq.asq.next_to_clean = 0; -#if (I40E_VF_ATQLEN_ATQENABLE_MASK != I40E_PF_ATQLEN_ATQENABLE_MASK) -#error I40E_VF_ATQLEN_ATQENABLE_MASK != I40E_PF_ATQLEN_ATQENABLE_MASK -#endif i40e_config_asq_regs(hw); hw->aq.arq.next_to_use = 0; Modified: stable/10/sys/dev/ixl/i40e_adminq.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq.h Fri Dec 11 13:05:18 2015 (r292099) +++ stable/10/sys/dev/ixl/i40e_adminq.h Fri Dec 11 13:08:38 2015 (r292100) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2013-2014, Intel Corporation + Copyright (c) 2013-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ struct i40e_asq_cmd_details { u16 flags_dis; bool async; bool postpone; + struct i40e_aq_desc *wb_desc; }; #define I40E_ADMINQ_DETAILS(R, i) \ Modified: stable/10/sys/dev/ixl/i40e_adminq_cmd.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq_cmd.h Fri Dec 11 13:05:18 2015 (r292099) +++ stable/10/sys/dev/ixl/i40e_adminq_cmd.h Fri Dec 11 13:08:38 2015 (r292100) @@ -42,7 +42,11 @@ */ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR 0x0002 +#ifdef X722_SUPPORT +#define I40E_FW_API_VERSION_MINOR 0x0003 +#else +#define I40E_FW_API_VERSION_MINOR 0x0004 +#endif struct i40e_aq_desc { __le16 flags; @@ -140,12 +144,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_list_func_capabilities = 0x000A, i40e_aqc_opc_list_dev_capabilities = 0x000B, - i40e_aqc_opc_set_cppm_configuration = 0x0103, - i40e_aqc_opc_set_arp_proxy_entry = 0x0104, - i40e_aqc_opc_set_ns_proxy_entry = 0x0105, - /* LAA */ - i40e_aqc_opc_mng_laa = 0x0106, /* AQ obsolete */ i40e_aqc_opc_mac_address_read = 0x0107, i40e_aqc_opc_mac_address_write = 0x0108, @@ -240,6 +239,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_nvm_update = 0x0703, i40e_aqc_opc_nvm_config_read = 0x0704, i40e_aqc_opc_nvm_config_write = 0x0705, + i40e_aqc_opc_oem_post_update = 0x0720, /* virtualization commands */ i40e_aqc_opc_send_msg_to_pf = 0x0801, @@ -270,7 +270,12 @@ enum i40e_admin_queue_opc { /* Tunnel commands */ i40e_aqc_opc_add_udp_tunnel = 0x0B00, i40e_aqc_opc_del_udp_tunnel = 0x0B01, - i40e_aqc_opc_tunnel_key_structure = 0x0B10, +#ifdef X722_SUPPORT + i40e_aqc_opc_set_rss_key = 0x0B02, + i40e_aqc_opc_set_rss_lut = 0x0B03, + i40e_aqc_opc_get_rss_key = 0x0B04, + i40e_aqc_opc_get_rss_lut = 0x0B05, +#endif /* Async Events */ i40e_aqc_opc_event_lan_overflow = 0x1001, @@ -282,8 +287,6 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_oem_ocbb_initialize = 0xFE03, /* debug commands */ - i40e_aqc_opc_debug_get_deviceid = 0xFF00, - i40e_aqc_opc_debug_set_mode = 0xFF01, i40e_aqc_opc_debug_read_reg = 0xFF03, i40e_aqc_opc_debug_write_reg = 0xFF04, i40e_aqc_opc_debug_modify_reg = 0xFF07, @@ -517,7 +520,8 @@ struct i40e_aqc_mac_address_read { #define I40E_AQC_SAN_ADDR_VALID 0x20 #define I40E_AQC_PORT_ADDR_VALID 0x40 #define I40E_AQC_WOL_ADDR_VALID 0x80 -#define I40E_AQC_ADDR_VALID_MASK 0xf0 +#define I40E_AQC_MC_MAG_EN_VALID 0x100 +#define I40E_AQC_ADDR_VALID_MASK 0x1F0 u8 reserved[6]; __le32 addr_high; __le32 addr_low; @@ -540,7 +544,9 @@ struct i40e_aqc_mac_address_write { #define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x0000 #define I40E_AQC_WRITE_TYPE_LAA_WOL 0x4000 #define I40E_AQC_WRITE_TYPE_PORT 0x8000 -#define I40E_AQC_WRITE_TYPE_MASK 0xc000 +#define I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG 0xC000 +#define I40E_AQC_WRITE_TYPE_MASK 0xC000 + __le16 mac_sah; __le32 mac_sal; u8 reserved[8]; @@ -834,8 +840,16 @@ struct i40e_aqc_vsi_properties_data { I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT) /* queueing option section */ u8 queueing_opt_flags; +#ifdef X722_SUPPORT +#define I40E_AQ_VSI_QUE_OPT_MULTICAST_UDP_ENA 0x04 +#define I40E_AQ_VSI_QUE_OPT_UNICAST_UDP_ENA 0x08 +#endif #define I40E_AQ_VSI_QUE_OPT_TCP_ENA 0x10 #define I40E_AQ_VSI_QUE_OPT_FCOE_ENA 0x20 +#ifdef X722_SUPPORT +#define I40E_AQ_VSI_QUE_OPT_RSS_LUT_PF 0x00 +#define I40E_AQ_VSI_QUE_OPT_RSS_LUT_VSI 0x40 +#endif u8 queueing_opt_reserved[3]; /* scheduler section */ u8 up_enable_bits; @@ -1076,6 +1090,7 @@ struct i40e_aqc_set_vsi_promiscuous_mode __le16 seid; #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF __le16 vlan_tag; +#define I40E_AQC_SET_VSI_VLAN_MASK 0x0FFF #define I40E_AQC_SET_VSI_VLAN_VALID 0x8000 u8 reserved[8]; }; @@ -1725,11 +1740,13 @@ struct i40e_aqc_get_link_status { u8 phy_type; /* i40e_aq_phy_type */ u8 link_speed; /* i40e_aq_link_speed */ u8 link_info; -#define I40E_AQ_LINK_UP 0x01 +#define I40E_AQ_LINK_UP 0x01 /* obsolete */ +#define I40E_AQ_LINK_UP_FUNCTION 0x01 #define I40E_AQ_LINK_FAULT 0x02 #define I40E_AQ_LINK_FAULT_TX 0x04 #define I40E_AQ_LINK_FAULT_RX 0x08 #define I40E_AQ_LINK_FAULT_REMOTE 0x10 +#define I40E_AQ_LINK_UP_PORT 0x20 #define I40E_AQ_MEDIA_AVAILABLE 0x40 #define I40E_AQ_SIGNAL_DETECT 0x80 u8 an_info; @@ -1891,6 +1908,26 @@ struct i40e_aqc_nvm_config_data_immediat I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field); +/* OEM Post Update (indirect 0x0720) + * no command data struct used + */ + struct i40e_aqc_nvm_oem_post_update { +#define I40E_AQ_NVM_OEM_POST_UPDATE_EXTERNAL_DATA 0x01 + u8 sel_data; + u8 reserved[7]; +}; + +I40E_CHECK_STRUCT_LEN(0x8, i40e_aqc_nvm_oem_post_update); + +struct i40e_aqc_nvm_oem_post_update_buffer { + u8 str_len; + u8 dev_addr; + __le16 eeprom_addr; + u8 data[36]; +}; + +I40E_CHECK_STRUCT_LEN(0x28, i40e_aqc_nvm_oem_post_update_buffer); + /* Send to PF command (indirect 0x0801) id is only used by PF * Send to VF command (indirect 0x0802) id is only used by PF * Send to Peer PF command (indirect 0x0803) @@ -2064,12 +2101,28 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_star #define I40E_AQC_CEE_APP_ISCSI_MASK (0x7 << I40E_AQC_CEE_APP_ISCSI_SHIFT) #define I40E_AQC_CEE_APP_FIP_SHIFT 0x8 #define I40E_AQC_CEE_APP_FIP_MASK (0x7 << I40E_AQC_CEE_APP_FIP_SHIFT) + #define I40E_AQC_CEE_PG_STATUS_SHIFT 0x0 #define I40E_AQC_CEE_PG_STATUS_MASK (0x7 << I40E_AQC_CEE_PG_STATUS_SHIFT) #define I40E_AQC_CEE_PFC_STATUS_SHIFT 0x3 #define I40E_AQC_CEE_PFC_STATUS_MASK (0x7 << I40E_AQC_CEE_PFC_STATUS_SHIFT) #define I40E_AQC_CEE_APP_STATUS_SHIFT 0x8 #define I40E_AQC_CEE_APP_STATUS_MASK (0x7 << I40E_AQC_CEE_APP_STATUS_SHIFT) +#define I40E_AQC_CEE_FCOE_STATUS_SHIFT 0x8 +#define I40E_AQC_CEE_FCOE_STATUS_MASK (0x7 << I40E_AQC_CEE_FCOE_STATUS_SHIFT) +#define I40E_AQC_CEE_ISCSI_STATUS_SHIFT 0xB +#define I40E_AQC_CEE_ISCSI_STATUS_MASK (0x7 << I40E_AQC_CEE_ISCSI_STATUS_SHIFT) +#define I40E_AQC_CEE_FIP_STATUS_SHIFT 0x10 +#define I40E_AQC_CEE_FIP_STATUS_MASK (0x7 << I40E_AQC_CEE_FIP_STATUS_SHIFT) + +/* struct i40e_aqc_get_cee_dcb_cfg_v1_resp was originally defined with + * word boundary layout issues, which the Linux compilers silently deal + * with by adding padding, making the actual struct larger than designed. + * However, the FW compiler for the NIC is less lenient and complains + * about the struct. Hence, the struct defined here has an extra byte in + * fields reserved3 and reserved4 to directly acknowledge that padding, + * and the new length is used in the length check macro. + */ struct i40e_aqc_get_cee_dcb_cfg_v1_resp { u8 reserved1; u8 oper_num_tc; @@ -2077,9 +2130,9 @@ struct i40e_aqc_get_cee_dcb_cfg_v1_resp u8 reserved2; u8 oper_tc_bw[8]; u8 oper_pfc_en; - u8 reserved3; + u8 reserved3[2]; __le16 oper_app_prio; - u8 reserved4; + u8 reserved4[2]; __le16 tlv_status; }; @@ -2168,6 +2221,48 @@ struct i40e_aqc_del_udp_tunnel_completio }; I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion); +#ifdef X722_SUPPORT + +struct i40e_aqc_get_set_rss_key { +#define I40E_AQC_SET_RSS_KEY_VSI_VALID (0x1 << 15) +#define I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT 0 +#define I40E_AQC_SET_RSS_KEY_VSI_ID_MASK (0x3FF << \ + I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT) + __le16 vsi_id; + u8 reserved[6]; + __le32 addr_high; + __le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_get_set_rss_key); + +struct i40e_aqc_get_set_rss_key_data { + u8 standard_rss_key[0x28]; + u8 extended_hash_key[0xc]; +}; + +I40E_CHECK_STRUCT_LEN(0x34, i40e_aqc_get_set_rss_key_data); + +struct i40e_aqc_get_set_rss_lut { +#define I40E_AQC_SET_RSS_LUT_VSI_VALID (0x1 << 15) +#define I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT 0 +#define I40E_AQC_SET_RSS_LUT_VSI_ID_MASK (0x3FF << \ + I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT) + __le16 vsi_id; +#define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT 0 +#define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK (0x1 << \ + I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) + +#define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_VSI 0 +#define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_PF 1 + __le16 flags; + u8 reserved[4]; + __le32 addr_high; + __le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_get_set_rss_lut); +#endif /* tunnel key structure 0x0B10 */ Modified: stable/10/sys/dev/ixl/i40e_common.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_common.c Fri Dec 11 13:05:18 2015 (r292099) +++ stable/10/sys/dev/ixl/i40e_common.c Fri Dec 11 13:08:38 2015 (r292100) @@ -62,9 +62,24 @@ enum i40e_status_code i40e_set_mac_type( case I40E_DEV_ID_QSFP_B: case I40E_DEV_ID_QSFP_C: case I40E_DEV_ID_10G_BASE_T: + case I40E_DEV_ID_10G_BASE_T4: case I40E_DEV_ID_20G_KR2: + case I40E_DEV_ID_20G_KR2_A: hw->mac.type = I40E_MAC_XL710; break; +#ifdef X722_SUPPORT + case I40E_DEV_ID_SFP_X722: + case I40E_DEV_ID_1G_BASE_T_X722: + case I40E_DEV_ID_10G_BASE_T_X722: + hw->mac.type = I40E_MAC_X722; + break; +#endif +#ifdef X722_SUPPORT + case I40E_DEV_ID_X722_VF: + case I40E_DEV_ID_X722_VF_HV: + hw->mac.type = I40E_MAC_X722_VF; + break; +#endif case I40E_DEV_ID_VF: case I40E_DEV_ID_VF_HV: hw->mac.type = I40E_MAC_VF; @@ -83,6 +98,212 @@ enum i40e_status_code i40e_set_mac_type( } /** + * i40e_aq_str - convert AQ err code to a string + * @hw: pointer to the HW structure + * @aq_err: the AQ error code to convert + **/ +char *i40e_aq_str(struct i40e_hw *hw, enum i40e_admin_queue_err aq_err) +{ + switch (aq_err) { + case I40E_AQ_RC_OK: + return "OK"; + case I40E_AQ_RC_EPERM: + return "I40E_AQ_RC_EPERM"; + case I40E_AQ_RC_ENOENT: + return "I40E_AQ_RC_ENOENT"; + case I40E_AQ_RC_ESRCH: + return "I40E_AQ_RC_ESRCH"; + case I40E_AQ_RC_EINTR: + return "I40E_AQ_RC_EINTR"; + case I40E_AQ_RC_EIO: + return "I40E_AQ_RC_EIO"; + case I40E_AQ_RC_ENXIO: + return "I40E_AQ_RC_ENXIO"; + case I40E_AQ_RC_E2BIG: + return "I40E_AQ_RC_E2BIG"; + case I40E_AQ_RC_EAGAIN: + return "I40E_AQ_RC_EAGAIN"; + case I40E_AQ_RC_ENOMEM: + return "I40E_AQ_RC_ENOMEM"; + case I40E_AQ_RC_EACCES: + return "I40E_AQ_RC_EACCES"; + case I40E_AQ_RC_EFAULT: + return "I40E_AQ_RC_EFAULT"; + case I40E_AQ_RC_EBUSY: + return "I40E_AQ_RC_EBUSY"; + case I40E_AQ_RC_EEXIST: + return "I40E_AQ_RC_EEXIST"; + case I40E_AQ_RC_EINVAL: + return "I40E_AQ_RC_EINVAL"; + case I40E_AQ_RC_ENOTTY: + return "I40E_AQ_RC_ENOTTY"; + case I40E_AQ_RC_ENOSPC: + return "I40E_AQ_RC_ENOSPC"; + case I40E_AQ_RC_ENOSYS: + return "I40E_AQ_RC_ENOSYS"; + case I40E_AQ_RC_ERANGE: + return "I40E_AQ_RC_ERANGE"; + case I40E_AQ_RC_EFLUSHED: + return "I40E_AQ_RC_EFLUSHED"; + case I40E_AQ_RC_BAD_ADDR: + return "I40E_AQ_RC_BAD_ADDR"; + case I40E_AQ_RC_EMODE: + return "I40E_AQ_RC_EMODE"; + case I40E_AQ_RC_EFBIG: + return "I40E_AQ_RC_EFBIG"; + } + + snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err); + return hw->err_str; +} + +/** + * i40e_stat_str - convert status err code to a string + * @hw: pointer to the HW structure + * @stat_err: the status error code to convert + **/ +char *i40e_stat_str(struct i40e_hw *hw, enum i40e_status_code stat_err) +{ + switch (stat_err) { + case I40E_SUCCESS: + return "OK"; + case I40E_ERR_NVM: + return "I40E_ERR_NVM"; + case I40E_ERR_NVM_CHECKSUM: + return "I40E_ERR_NVM_CHECKSUM"; + case I40E_ERR_PHY: + return "I40E_ERR_PHY"; + case I40E_ERR_CONFIG: + return "I40E_ERR_CONFIG"; + case I40E_ERR_PARAM: + return "I40E_ERR_PARAM"; + case I40E_ERR_MAC_TYPE: + return "I40E_ERR_MAC_TYPE"; + case I40E_ERR_UNKNOWN_PHY: + return "I40E_ERR_UNKNOWN_PHY"; + case I40E_ERR_LINK_SETUP: + return "I40E_ERR_LINK_SETUP"; + case I40E_ERR_ADAPTER_STOPPED: + return "I40E_ERR_ADAPTER_STOPPED"; + case I40E_ERR_INVALID_MAC_ADDR: + return "I40E_ERR_INVALID_MAC_ADDR"; + case I40E_ERR_DEVICE_NOT_SUPPORTED: + return "I40E_ERR_DEVICE_NOT_SUPPORTED"; + case I40E_ERR_MASTER_REQUESTS_PENDING: + return "I40E_ERR_MASTER_REQUESTS_PENDING"; + case I40E_ERR_INVALID_LINK_SETTINGS: + return "I40E_ERR_INVALID_LINK_SETTINGS"; + case I40E_ERR_AUTONEG_NOT_COMPLETE: + return "I40E_ERR_AUTONEG_NOT_COMPLETE"; + case I40E_ERR_RESET_FAILED: + return "I40E_ERR_RESET_FAILED"; + case I40E_ERR_SWFW_SYNC: + return "I40E_ERR_SWFW_SYNC"; + case I40E_ERR_NO_AVAILABLE_VSI: + return "I40E_ERR_NO_AVAILABLE_VSI"; + case I40E_ERR_NO_MEMORY: + return "I40E_ERR_NO_MEMORY"; + case I40E_ERR_BAD_PTR: + return "I40E_ERR_BAD_PTR"; + case I40E_ERR_RING_FULL: + return "I40E_ERR_RING_FULL"; + case I40E_ERR_INVALID_PD_ID: + return "I40E_ERR_INVALID_PD_ID"; + case I40E_ERR_INVALID_QP_ID: + return "I40E_ERR_INVALID_QP_ID"; + case I40E_ERR_INVALID_CQ_ID: + return "I40E_ERR_INVALID_CQ_ID"; + case I40E_ERR_INVALID_CEQ_ID: + return "I40E_ERR_INVALID_CEQ_ID"; + case I40E_ERR_INVALID_AEQ_ID: + return "I40E_ERR_INVALID_AEQ_ID"; + case I40E_ERR_INVALID_SIZE: + return "I40E_ERR_INVALID_SIZE"; + case I40E_ERR_INVALID_ARP_INDEX: + return "I40E_ERR_INVALID_ARP_INDEX"; + case I40E_ERR_INVALID_FPM_FUNC_ID: + return "I40E_ERR_INVALID_FPM_FUNC_ID"; + case I40E_ERR_QP_INVALID_MSG_SIZE: + return "I40E_ERR_QP_INVALID_MSG_SIZE"; + case I40E_ERR_QP_TOOMANY_WRS_POSTED: + return "I40E_ERR_QP_TOOMANY_WRS_POSTED"; + case I40E_ERR_INVALID_FRAG_COUNT: + return "I40E_ERR_INVALID_FRAG_COUNT"; + case I40E_ERR_QUEUE_EMPTY: + return "I40E_ERR_QUEUE_EMPTY"; + case I40E_ERR_INVALID_ALIGNMENT: + return "I40E_ERR_INVALID_ALIGNMENT"; + case I40E_ERR_FLUSHED_QUEUE: + return "I40E_ERR_FLUSHED_QUEUE"; + case I40E_ERR_INVALID_PUSH_PAGE_INDEX: + return "I40E_ERR_INVALID_PUSH_PAGE_INDEX"; + case I40E_ERR_INVALID_IMM_DATA_SIZE: + return "I40E_ERR_INVALID_IMM_DATA_SIZE"; + case I40E_ERR_TIMEOUT: + return "I40E_ERR_TIMEOUT"; + case I40E_ERR_OPCODE_MISMATCH: + return "I40E_ERR_OPCODE_MISMATCH"; + case I40E_ERR_CQP_COMPL_ERROR: + return "I40E_ERR_CQP_COMPL_ERROR"; + case I40E_ERR_INVALID_VF_ID: + return "I40E_ERR_INVALID_VF_ID"; + case I40E_ERR_INVALID_HMCFN_ID: + return "I40E_ERR_INVALID_HMCFN_ID"; + case I40E_ERR_BACKING_PAGE_ERROR: + return "I40E_ERR_BACKING_PAGE_ERROR"; + case I40E_ERR_NO_PBLCHUNKS_AVAILABLE: + return "I40E_ERR_NO_PBLCHUNKS_AVAILABLE"; + case I40E_ERR_INVALID_PBLE_INDEX: + return "I40E_ERR_INVALID_PBLE_INDEX"; + case I40E_ERR_INVALID_SD_INDEX: + return "I40E_ERR_INVALID_SD_INDEX"; + case I40E_ERR_INVALID_PAGE_DESC_INDEX: + return "I40E_ERR_INVALID_PAGE_DESC_INDEX"; + case I40E_ERR_INVALID_SD_TYPE: + return "I40E_ERR_INVALID_SD_TYPE"; + case I40E_ERR_MEMCPY_FAILED: + return "I40E_ERR_MEMCPY_FAILED"; + case I40E_ERR_INVALID_HMC_OBJ_INDEX: + return "I40E_ERR_INVALID_HMC_OBJ_INDEX"; + case I40E_ERR_INVALID_HMC_OBJ_COUNT: + return "I40E_ERR_INVALID_HMC_OBJ_COUNT"; + case I40E_ERR_INVALID_SRQ_ARM_LIMIT: + return "I40E_ERR_INVALID_SRQ_ARM_LIMIT"; + case I40E_ERR_SRQ_ENABLED: + return "I40E_ERR_SRQ_ENABLED"; + case I40E_ERR_ADMIN_QUEUE_ERROR: + return "I40E_ERR_ADMIN_QUEUE_ERROR"; + case I40E_ERR_ADMIN_QUEUE_TIMEOUT: + return "I40E_ERR_ADMIN_QUEUE_TIMEOUT"; + case I40E_ERR_BUF_TOO_SHORT: + return "I40E_ERR_BUF_TOO_SHORT"; + case I40E_ERR_ADMIN_QUEUE_FULL: + return "I40E_ERR_ADMIN_QUEUE_FULL"; + case I40E_ERR_ADMIN_QUEUE_NO_WORK: + return "I40E_ERR_ADMIN_QUEUE_NO_WORK"; + case I40E_ERR_BAD_IWARP_CQE: + return "I40E_ERR_BAD_IWARP_CQE"; + case I40E_ERR_NVM_BLANK_MODE: + return "I40E_ERR_NVM_BLANK_MODE"; + case I40E_ERR_NOT_IMPLEMENTED: + return "I40E_ERR_NOT_IMPLEMENTED"; + case I40E_ERR_PE_DOORBELL_NOT_ENABLED: + return "I40E_ERR_PE_DOORBELL_NOT_ENABLED"; + case I40E_ERR_DIAG_TEST_FAILED: + return "I40E_ERR_DIAG_TEST_FAILED"; + case I40E_ERR_NOT_READY: + return "I40E_ERR_NOT_READY"; + case I40E_NOT_SUPPORTED: + return "I40E_NOT_SUPPORTED"; + case I40E_ERR_FIRMWARE_API_VERSION: + return "I40E_ERR_FIRMWARE_API_VERSION"; + } + + snprintf(hw->err_str, sizeof(hw->err_str), "%d", stat_err); + return hw->err_str; +} + +/** * i40e_debug_aq * @hw: debug mask related to admin queue * @mask: debug mask @@ -154,9 +375,13 @@ void i40e_debug_aq(struct i40e_hw *hw, e bool i40e_check_asq_alive(struct i40e_hw *hw) { if (hw->aq.asq.len) - return !!(rd32(hw, hw->aq.asq.len) & I40E_PF_ATQLEN_ATQENABLE_MASK); - else - return FALSE; + if (!i40e_is_vf(hw)) + return !!(rd32(hw, hw->aq.asq.len) & + I40E_PF_ATQLEN_ATQENABLE_MASK); + if (i40e_is_vf(hw)) + return !!(rd32(hw, hw->aq.asq.len) & + I40E_VF_ATQLEN1_ATQENABLE_MASK); + return FALSE; } /** @@ -184,6 +409,171 @@ enum i40e_status_code i40e_aq_queue_shut return status; } +#ifdef X722_SUPPORT + +/** + * i40e_aq_get_set_rss_lut + * @hw: pointer to the hardware structure + * @vsi_id: vsi fw index + * @pf_lut: for PF table set TRUE, for VSI table set FALSE + * @lut: pointer to the lut buffer provided by the caller + * @lut_size: size of the lut buffer + * @set: set TRUE to set the table, FALSE to get the table + * + * Internal function to get or set RSS look up table + **/ +static enum i40e_status_code i40e_aq_get_set_rss_lut(struct i40e_hw *hw, + u16 vsi_id, bool pf_lut, + u8 *lut, u16 lut_size, + bool set) +{ + enum i40e_status_code status; + struct i40e_aq_desc desc; + struct i40e_aqc_get_set_rss_lut *cmd_resp = + (struct i40e_aqc_get_set_rss_lut *)&desc.params.raw; + + if (set) + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_set_rss_lut); + else + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_get_rss_lut); + + /* Indirect command */ + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); + + cmd_resp->vsi_id = + CPU_TO_LE16((u16)((vsi_id << + I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT) & + I40E_AQC_SET_RSS_LUT_VSI_ID_MASK)); + cmd_resp->vsi_id |= CPU_TO_LE16((u16)I40E_AQC_SET_RSS_LUT_VSI_VALID); + + if (pf_lut) + cmd_resp->flags |= CPU_TO_LE16((u16) + ((I40E_AQC_SET_RSS_LUT_TABLE_TYPE_PF << + I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) & + I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK)); + else + cmd_resp->flags |= CPU_TO_LE16((u16) + ((I40E_AQC_SET_RSS_LUT_TABLE_TYPE_VSI << + I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) & + I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK)); + + cmd_resp->addr_high = CPU_TO_LE32(I40E_HI_WORD((u64)lut)); + cmd_resp->addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)lut)); + + status = i40e_asq_send_command(hw, &desc, lut, lut_size, NULL); + + return status; +} + +/** + * i40e_aq_get_rss_lut + * @hw: pointer to the hardware structure + * @vsi_id: vsi fw index + * @pf_lut: for PF table set TRUE, for VSI table set FALSE + * @lut: pointer to the lut buffer provided by the caller + * @lut_size: size of the lut buffer + * + * get the RSS lookup table, PF or VSI type + **/ +enum i40e_status_code i40e_aq_get_rss_lut(struct i40e_hw *hw, u16 vsi_id, + bool pf_lut, u8 *lut, u16 lut_size) +{ + return i40e_aq_get_set_rss_lut(hw, vsi_id, pf_lut, lut, lut_size, + FALSE); +} + +/** + * i40e_aq_set_rss_lut + * @hw: pointer to the hardware structure + * @vsi_id: vsi fw index + * @pf_lut: for PF table set TRUE, for VSI table set FALSE + * @lut: pointer to the lut buffer provided by the caller + * @lut_size: size of the lut buffer + * + * set the RSS lookup table, PF or VSI type + **/ +enum i40e_status_code i40e_aq_set_rss_lut(struct i40e_hw *hw, u16 vsi_id, + bool pf_lut, u8 *lut, u16 lut_size) +{ + return i40e_aq_get_set_rss_lut(hw, vsi_id, pf_lut, lut, lut_size, TRUE); +} + +/** + * i40e_aq_get_set_rss_key + * @hw: pointer to the hw struct + * @vsi_id: vsi fw index + * @key: pointer to key info struct + * @set: set TRUE to set the key, FALSE to get the key + * + * get the RSS key per VSI + **/ +static enum i40e_status_code i40e_aq_get_set_rss_key(struct i40e_hw *hw, + u16 vsi_id, + struct i40e_aqc_get_set_rss_key_data *key, + bool set) +{ + enum i40e_status_code status; + struct i40e_aq_desc desc; + struct i40e_aqc_get_set_rss_key *cmd_resp = + (struct i40e_aqc_get_set_rss_key *)&desc.params.raw; + u16 key_size = sizeof(struct i40e_aqc_get_set_rss_key_data); + + if (set) + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_set_rss_key); + else + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_get_rss_key); + + /* Indirect command */ + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); + + cmd_resp->vsi_id = + CPU_TO_LE16((u16)((vsi_id << + I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT) & + I40E_AQC_SET_RSS_KEY_VSI_ID_MASK)); + cmd_resp->vsi_id |= CPU_TO_LE16((u16)I40E_AQC_SET_RSS_KEY_VSI_VALID); + cmd_resp->addr_high = CPU_TO_LE32(I40E_HI_WORD((u64)key)); + cmd_resp->addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)key)); + + status = i40e_asq_send_command(hw, &desc, key, key_size, NULL); + + return status; +} + +/** + * i40e_aq_get_rss_key + * @hw: pointer to the hw struct + * @vsi_id: vsi fw index + * @key: pointer to key info struct + * + **/ +enum i40e_status_code i40e_aq_get_rss_key(struct i40e_hw *hw, + u16 vsi_id, + struct i40e_aqc_get_set_rss_key_data *key) +{ + return i40e_aq_get_set_rss_key(hw, vsi_id, key, FALSE); +} + +/** + * i40e_aq_set_rss_key + * @hw: pointer to the hw struct + * @vsi_id: vsi fw index + * @key: pointer to key info struct + * + * set the RSS key per VSI + **/ +enum i40e_status_code i40e_aq_set_rss_key(struct i40e_hw *hw, + u16 vsi_id, + struct i40e_aqc_get_set_rss_key_data *key) +{ + return i40e_aq_get_set_rss_key(hw, vsi_id, key, TRUE); +} +#endif /* X722_SUPPORT */ /* The i40e_ptype_lookup table is used to convert from the 8-bit ptype in the * hardware to a bit-field that can be used by SW to more easily determine the @@ -598,6 +988,9 @@ enum i40e_status_code i40e_init_shared_c switch (hw->mac.type) { case I40E_MAC_XL710: +#ifdef X722_SUPPORT + case I40E_MAC_X722: +#endif break; default: return I40E_ERR_DEVICE_NOT_SUPPORTED; @@ -888,7 +1281,7 @@ enum i40e_status_code i40e_pf_reset(stru grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; - for (cnt = 0; cnt < grst_del + 2; cnt++) { + for (cnt = 0; cnt < grst_del + 10; cnt++) { reg = rd32(hw, I40E_GLGEN_RSTAT); if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) break; @@ -1108,9 +1501,11 @@ u32 i40e_led_get(struct i40e_hw *hw) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity LEDs */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> - I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); + /* ignore gpio LED src mode entries related to the activity + * LEDs + */ + current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) + >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); switch (current_mode) { case I40E_COMBINED_ACTIVITY: case I40E_FILTER_ACTIVITY: @@ -1154,9 +1549,11 @@ void i40e_led_set(struct i40e_hw *hw, u3 if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity LEDs */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> - I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); + /* ignore gpio LED src mode entries related to the activity + * LEDs + */ + current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) + >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); switch (current_mode) { case I40E_COMBINED_ACTIVITY: case I40E_FILTER_ACTIVITY: @@ -1175,9 +1572,9 @@ void i40e_led_set(struct i40e_hw *hw, u3 blink = FALSE; if (blink) - gpio_val |= (1 << I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT); + gpio_val |= BIT(I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT); else - gpio_val &= ~(1 << I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT); + gpio_val &= ~BIT(I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT); wr32(hw, I40E_GLGEN_GPIO_CTL(i), gpio_val); break; @@ -1329,14 +1726,14 @@ enum i40e_status_code i40e_set_fc(struct *aq_failures |= I40E_SET_FC_AQ_FAIL_SET; } /* Update the link info */ - status = i40e_aq_get_link_info(hw, TRUE, NULL, NULL); + status = i40e_update_link_info(hw); if (status) { /* Wait a little bit (on 40G cards it sometimes takes a really * long time for link to come back from the atomic reset) * and try once more */ i40e_msec_delay(1000); - status = i40e_aq_get_link_info(hw, TRUE, NULL, NULL); + status = i40e_update_link_info(hw); } if (status) *aq_failures |= I40E_SET_FC_AQ_FAIL_UPDATE; @@ -1525,7 +1922,6 @@ aq_get_link_info_exit: return status; } - /** * i40e_aq_set_phy_int_mask * @hw: pointer to the hw struct @@ -1837,6 +2233,74 @@ enum i40e_status_code i40e_aq_set_vsi_mu } /** + * i40e_aq_set_vsi_mc_promisc_on_vlan + * @hw: pointer to the hw struct + * @seid: vsi number + * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN + * @vid: The VLAN tag filter - capture any multicast packet with this VLAN tag + * @cmd_details: pointer to command details structure or NULL + **/ +enum i40e_status_code i40e_aq_set_vsi_mc_promisc_on_vlan(struct i40e_hw *hw, + u16 seid, bool enable, u16 vid, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_set_vsi_promiscuous_modes *cmd = + (struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw; + enum i40e_status_code status; + u16 flags = 0; + + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_set_vsi_promiscuous_modes); + + if (enable) + flags |= I40E_AQC_SET_VSI_PROMISC_MULTICAST; + + cmd->promiscuous_flags = CPU_TO_LE16(flags); + cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_MULTICAST); + cmd->seid = CPU_TO_LE16(seid); + cmd->vlan_tag = CPU_TO_LE16(vid | I40E_AQC_SET_VSI_VLAN_VALID); + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + +/** + * i40e_aq_set_vsi_uc_promisc_on_vlan + * @hw: pointer to the hw struct + * @seid: vsi number + * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN + * @vid: The VLAN tag filter - capture any unicast packet with this VLAN tag + * @cmd_details: pointer to command details structure or NULL + **/ +enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw, + u16 seid, bool enable, u16 vid, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_set_vsi_promiscuous_modes *cmd = + (struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw; + enum i40e_status_code status; + u16 flags = 0; + + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_set_vsi_promiscuous_modes); + + if (enable) + flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; + + cmd->promiscuous_flags = CPU_TO_LE16(flags); + cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); + cmd->seid = CPU_TO_LE16(seid); + cmd->vlan_tag = CPU_TO_LE16(vid | I40E_AQC_SET_VSI_VLAN_VALID); + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + +/** * i40e_aq_set_vsi_broadcast * @hw: pointer to the hw struct * @seid: vsi number @@ -2067,30 +2531,56 @@ enum i40e_status_code i40e_aq_send_drive /** * i40e_get_link_status - get status of the HW network link * @hw: pointer to the hw struct + * @link_up: pointer to bool (TRUE/FALSE = linkup/linkdown) * - * Returns TRUE if link is up, FALSE if link is down. + * Variable link_up TRUE if link is up, FALSE if link is down. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Dec 11 13:12:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D1719D728F; Fri, 11 Dec 2015 13:12:53 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E08B1E8B; Fri, 11 Dec 2015 13:12:53 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBDCqqb062183; Fri, 11 Dec 2015 13:12:52 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBDCqEo062182; Fri, 11 Dec 2015 13:12:52 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111312.tBBDCqEo062182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 13:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292101 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:12:53 -0000 Author: smh Date: Fri Dec 11 13:12:52 2015 New Revision: 292101 URL: https://svnweb.freebsd.org/changeset/base/292101 Log: MFC r285768: LAA MAC/VLAN filter + success check Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/if_ixl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 13:08:38 2015 (r292100) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 13:12:52 2015 (r292101) @@ -1140,7 +1140,8 @@ ixl_init_locked(struct ixl_pf *pf) bcopy(IF_LLADDR(vsi->ifp), tmpaddr, I40E_ETH_LENGTH_OF_ADDRESS); if (!cmp_etheraddr(hw->mac.addr, tmpaddr) && - i40e_validate_mac_addr(tmpaddr)) { + (i40e_validate_mac_addr(tmpaddr) == I40E_SUCCESS)) { + ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); bcopy(tmpaddr, hw->mac.addr, I40E_ETH_LENGTH_OF_ADDRESS); ret = i40e_aq_mac_address_write(hw, @@ -1150,6 +1151,8 @@ ixl_init_locked(struct ixl_pf *pf) device_printf(dev, "LLA address" "change failed!!\n"); return; + } else { + ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); } } From owner-svn-src-stable@freebsd.org Fri Dec 11 13:15:23 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 935469D74A8; Fri, 11 Dec 2015 13:15:23 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FDEC10A3; Fri, 11 Dec 2015 13:15:23 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBDFMIF062329; Fri, 11 Dec 2015 13:15:22 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBDFMrL062328; Fri, 11 Dec 2015 13:15:22 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201512111315.tBBDFMrL062328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 11 Dec 2015 13:15:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292102 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:15:23 -0000 Author: smh Date: Fri Dec 11 13:15:22 2015 New Revision: 292102 URL: https://svnweb.freebsd.org/changeset/base/292102 Log: MFC r289231: Fix used function warnings in ixl(4) Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/if_ixl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 13:12:52 2015 (r292101) +++ stable/10/sys/dev/ixl/if_ixl.c Fri Dec 11 13:15:22 2015 (r292102) @@ -159,8 +159,10 @@ static void ixl_free_mac_filters(struct /* Sysctl debug interface */ +#ifdef IXL_DEBUG_SYSCTL static int ixl_debug_info(SYSCTL_HANDLER_ARGS); static void ixl_print_debug_info(struct ixl_pf *); +#endif /* The MSI/X Interrupt handlers */ static void ixl_intr(void *); @@ -4368,6 +4370,7 @@ ixl_do_adminq(void *context, int pending IXL_PF_UNLOCK(pf); } +#ifdef IXL_DEBUG_SYSCTL static int ixl_debug_info(SYSCTL_HANDLER_ARGS) { @@ -4432,6 +4435,7 @@ ixl_print_debug_info(struct ixl_pf *pf) reg = rd32(hw, I40E_GLPRT_MLFC(hw->port)); printf("mac local fault = %x\n", reg); } +#endif /** * Update VSI-specific ethernet statistics counters. From owner-svn-src-stable@freebsd.org Fri Dec 11 13:19:34 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FDE99D7752; Fri, 11 Dec 2015 13:19:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D5831352; Fri, 11 Dec 2015 13:19:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBDJXoC062552; Fri, 11 Dec 2015 13:19:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBDJXxF062551; Fri, 11 Dec 2015 13:19:33 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111319.tBBDJXxF062551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 13:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292103 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:19:34 -0000 Author: hselasky Date: Fri Dec 11 13:19:33 2015 New Revision: 292103 URL: https://svnweb.freebsd.org/changeset/base/292103 Log: MFC r291690: Remove incorrect defines. The proper version of these macros is defined in linux/etherdevice.h. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/compat.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/compat.h ============================================================================== --- stable/10/sys/ofed/include/linux/compat.h Fri Dec 11 13:15:22 2015 (r292102) +++ stable/10/sys/ofed/include/linux/compat.h Fri Dec 11 13:19:33 2015 (r292103) @@ -30,8 +30,4 @@ #ifndef _LINUX_COMPAT_H_ #define _LINUX_COMPAT_H_ -#define is_multicast_ether_addr(x) 0 -#define is_broadcast_ether_addr(x) 0 - - #endif /* _LINUX_COMPAT_H_ */ From owner-svn-src-stable@freebsd.org Fri Dec 11 13:20:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EB6F9D79BB; Fri, 11 Dec 2015 13:20:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F403C177F; Fri, 11 Dec 2015 13:20:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBDKq0k062848; Fri, 11 Dec 2015 13:20:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBDKq2x062847; Fri, 11 Dec 2015 13:20:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512111320.tBBDKq2x062847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Dec 2015 13:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292104 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:20:53 -0000 Author: kib Date: Fri Dec 11 13:20:51 2015 New Revision: 292104 URL: https://svnweb.freebsd.org/changeset/base/292104 Log: MFC r291408: In vm_pageout_grow_cache(), do not re-try the inactive queue when active queue scan initiated write, to avoid infinite loop. Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Fri Dec 11 13:19:33 2015 (r292103) +++ stable/10/sys/vm/vm_pageout.c Fri Dec 11 13:20:51 2015 (r292104) @@ -728,32 +728,33 @@ vm_pageout_grow_cache(int tries, vm_padd * the specified address range, as indicated by segments * constituting the domain. */ -again: +again_inact: if (inactl < inactmax) { if (vm_phys_domain_intersects(vm_dom[dom].vmd_segs, low, high) && vm_pageout_launder(&vm_dom[dom].vmd_pagequeues[PQ_INACTIVE], tries, low, high)) { inactl++; - goto again; + goto again_inact; } if (++dom == vm_ndomains) dom = 0; if (dom != initial_dom) - goto again; + goto again_inact; } +again_act: if (actl < actmax) { if (vm_phys_domain_intersects(vm_dom[dom].vmd_segs, low, high) && vm_pageout_launder(&vm_dom[dom].vmd_pagequeues[PQ_ACTIVE], tries, low, high)) { actl++; - goto again; + goto again_act; } if (++dom == vm_ndomains) dom = 0; if (dom != initial_dom) - goto again; + goto again_act; } } From owner-svn-src-stable@freebsd.org Fri Dec 11 13:30:50 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 924389D8276; Fri, 11 Dec 2015 13:30:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65C241068; Fri, 11 Dec 2015 13:30:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBDUnF2065983; Fri, 11 Dec 2015 13:30:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBDUnpf065982; Fri, 11 Dec 2015 13:30:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111330.tBBDUnpf065982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 13:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292105 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 13:30:50 -0000 Author: hselasky Date: Fri Dec 11 13:30:49 2015 New Revision: 292105 URL: https://svnweb.freebsd.org/changeset/base/292105 Log: MFC r291693: Add some structures and defines which will be used when decoding small form factor, SFF, standards compliant ethernet EEPROMs. Obtained from: Linux Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/etherdevice.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/etherdevice.h ============================================================================== --- stable/10/sys/ofed/include/linux/etherdevice.h Fri Dec 11 13:20:51 2015 (r292104) +++ stable/10/sys/ofed/include/linux/etherdevice.h Fri Dec 11 13:30:49 2015 (r292105) @@ -37,6 +37,25 @@ #include +#define ETH_MODULE_SFF_8079 1 +#define ETH_MODULE_SFF_8079_LEN 256 +#define ETH_MODULE_SFF_8472 2 +#define ETH_MODULE_SFF_8472_LEN 512 +#define ETH_MODULE_SFF_8636 3 +#define ETH_MODULE_SFF_8636_LEN 256 +#define ETH_MODULE_SFF_8436 4 +#define ETH_MODULE_SFF_8436_LEN 256 + +struct ethtool_eeprom { + u32 offset; + u32 len; +}; + +struct ethtool_modinfo { + u32 type; + u32 eeprom_len; +}; + /** * is_zero_ether_addr - Determine if give Ethernet address is all zeros. * @addr: Pointer to a six-byte array containing the Ethernet address From owner-svn-src-stable@freebsd.org Fri Dec 11 14:21:59 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F04D69D8725; Fri, 11 Dec 2015 14:21:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94496177C; Fri, 11 Dec 2015 14:21:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBELwTn085723; Fri, 11 Dec 2015 14:21:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBELwVD085718; Fri, 11 Dec 2015 14:21:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111421.tBBELwVD085718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 14:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292107 - in stable/10/sys: modules/mlxen ofed/drivers/net/mlx4 ofed/include/linux/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 14:22:00 -0000 Author: hselasky Date: Fri Dec 11 14:21:58 2015 New Revision: 292107 URL: https://svnweb.freebsd.org/changeset/base/292107 Log: MFC r290710, r291694, r291699 and r291793: - Fix print formatting compile warnings for Sparc64 and PowerPC platforms. - Updated the mlx4 and mlxen drivers to the latest version, v2.1.6: - Added support for dumping the SFP EEPROM content to dmesg. - Fixed handling of network interface capability IOCTLs. - Fixed race when loading and unloading the mlxen driver by applying appropriate locking. - Removed two unused C-files. - Convert the mlxen driver to use the BUSDMA(9) APIs instead of vtophys() when loading mbufs for transmission and reception. While at it all pointer arithmetic and cast qualifier issues were fixed, mostly related to transmission and reception. - Fix i386 build WITH_OFED=YES. Remove some redundant KASSERTs. Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4283 Differential Revision: https://reviews.freebsd.org/D4284 Deleted: stable/10/sys/ofed/drivers/net/mlx4/en_ethtool.c stable/10/sys/ofed/drivers/net/mlx4/en_selftest.c Modified: stable/10/sys/modules/mlxen/Makefile stable/10/sys/ofed/drivers/net/mlx4/en_main.c stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c stable/10/sys/ofed/drivers/net/mlx4/en_port.c stable/10/sys/ofed/drivers/net/mlx4/en_rx.c stable/10/sys/ofed/drivers/net/mlx4/en_tx.c stable/10/sys/ofed/drivers/net/mlx4/main.c stable/10/sys/ofed/drivers/net/mlx4/mlx4.h stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h stable/10/sys/ofed/drivers/net/mlx4/port.c stable/10/sys/ofed/include/linux/mlx4/cq.h stable/10/sys/ofed/include/linux/mlx4/device.h stable/10/sys/ofed/include/linux/mlx4/doorbell.h stable/10/sys/ofed/include/linux/mlx4/qp.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/modules/mlxen/Makefile ============================================================================== --- stable/10/sys/modules/mlxen/Makefile Fri Dec 11 13:55:31 2015 (r292106) +++ stable/10/sys/modules/mlxen/Makefile Fri Dec 11 14:21:58 2015 (r292107) @@ -26,4 +26,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= ${GCC_MS_EXTENSIONS} Modified: stable/10/sys/ofed/drivers/net/mlx4/en_main.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_main.c Fri Dec 11 13:55:31 2015 (r292106) +++ stable/10/sys/ofed/drivers/net/mlx4/en_main.c Fri Dec 11 14:21:58 2015 (r292107) @@ -42,14 +42,7 @@ #include "mlx4_en.h" -MODULE_AUTHOR("Liran Liss, Yevgeny Petrilin"); -MODULE_DESCRIPTION("Mellanox ConnectX HCA Ethernet driver"); -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_VERSION(DRV_VERSION " ("DRV_RELDATE")"); - -static const char mlx4_en_version[] = - DRV_NAME ": Mellanox ConnectX HCA Ethernet driver v" - DRV_VERSION " (" DRV_RELDATE ")\n"; +/* Mellanox ConnectX HCA Ethernet driver */ #define MLX4_EN_PARM_INT(X, def_val, desc) \ static unsigned int X = def_val;\ @@ -174,8 +167,6 @@ static void *mlx4_en_add(struct mlx4_dev int i; int err; - printk_once(KERN_INFO "%s", mlx4_en_version); - mdev = kzalloc(sizeof *mdev, GFP_KERNEL); if (!mdev) { dev_err(&dev->pdev->dev, "Device struct alloc failed, " Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 13:55:31 2015 (r292106) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 14:21:58 2015 (r292107) @@ -659,8 +659,10 @@ static void mlx4_en_cache_mclist(struct continue; /* Make sure the list didn't grow. */ tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC); - if (tmp == NULL) + if (tmp == NULL) { + en_err(priv, "Failed to allocate multicast list\n"); break; + } memcpy(tmp->addr, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), ETH_ALEN); list_add_tail(&tmp->list, &priv->mc_list); @@ -971,12 +973,12 @@ static void mlx4_en_do_set_rx_mode(struc if (!mlx4_en_QUERY_PORT(mdev, priv->port)) { if (priv->port_state.link_state) { priv->last_link_state = MLX4_DEV_EVENT_PORT_UP; - /* Important note: the following call for if_link_state_change - * is needed for interface up scenario (start port, link state - * change) */ /* update netif baudrate */ priv->dev->if_baudrate = IF_Mbps(priv->port_state.link_speed); + /* Important note: the following call for if_link_state_change + * is needed for interface up scenario (start port, link state + * change) */ if_link_state_change(priv->dev, LINK_STATE_UP); en_dbg(HW, priv, "Link Up\n"); } @@ -1196,8 +1198,8 @@ static void mlx4_en_linkstate(struct wor /* update netif baudrate */ priv->dev->if_baudrate = 0; - /* make sure the port is up before notifying the OS. - * This is tricky since we get here on INIT_PORT and + /* make sure the port is up before notifying the OS. + * This is tricky since we get here on INIT_PORT and * in such case we can't tell the OS the port is up. * To solve this there is a call to if_link_state_change * in set_rx_mode. @@ -1246,7 +1248,6 @@ int mlx4_en_start_port(struct net_device PAGE_SIZE); priv->rx_alloc_order = get_order(priv->rx_alloc_size); priv->rx_buf_size = roundup_pow_of_two(priv->rx_mb_size); - priv->log_rx_info = ROUNDUP_LOG2(sizeof(struct mlx4_en_rx_buf)); en_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_mb_size); /* Configure rx cq's and rings */ @@ -1575,6 +1576,7 @@ static void mlx4_en_clear_stats(struct n priv->tx_ring[i]->bytes = 0; priv->tx_ring[i]->packets = 0; priv->tx_ring[i]->tx_csum = 0; + priv->tx_ring[i]->oversized_packets = 0; } for (i = 0; i < priv->rx_ring_num; i++) { priv->rx_ring[i]->bytes = 0; @@ -1644,8 +1646,6 @@ void mlx4_en_free_resources(struct mlx4_ if (priv->sysctl) sysctl_ctx_free(&priv->stat_ctx); - - } int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) @@ -1730,8 +1730,11 @@ void mlx4_en_destroy_netdev(struct net_d EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach); /* Unregister device - this will close the port if it was up */ - if (priv->registered) + if (priv->registered) { + mutex_lock(&mdev->state_lock); ether_ifdetach(dev); + mutex_unlock(&mdev->state_lock); + } if (priv->allocated) mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE); @@ -1809,13 +1812,6 @@ static int mlx4_en_calc_media(struct mlx active = IFM_ETHER; if (priv->last_link_state == MLX4_DEV_EVENT_PORT_DOWN) return (active); - /* - * [ShaharK] mlx4_en_QUERY_PORT sleeps and cannot be called under a - * non-sleepable lock. - * I moved it to the periodic mlx4_en_do_get_stats. - if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) - return (active); - */ active |= IFM_FDX; trans_type = priv->port_state.transciver; /* XXX I don't know all of the transceiver values. */ @@ -1948,12 +1944,55 @@ static int mlx4_en_ioctl(struct ifnet *d case SIOCSIFCAP: mutex_lock(&mdev->state_lock); mask = ifr->ifr_reqcap ^ dev->if_capenable; - if (mask & IFCAP_HWCSUM) - dev->if_capenable ^= IFCAP_HWCSUM; - if (mask & IFCAP_TSO4) + if (mask & IFCAP_TXCSUM) { + dev->if_capenable ^= IFCAP_TXCSUM; + dev->if_hwassist ^= (CSUM_TCP | CSUM_UDP | CSUM_IP); + + if (IFCAP_TSO4 & dev->if_capenable && + !(IFCAP_TXCSUM & dev->if_capenable)) { + dev->if_capenable &= ~IFCAP_TSO4; + dev->if_hwassist &= ~CSUM_IP_TSO; + if_printf(dev, + "tso4 disabled due to -txcsum.\n"); + } + } + if (mask & IFCAP_TXCSUM_IPV6) { + dev->if_capenable ^= IFCAP_TXCSUM_IPV6; + dev->if_hwassist ^= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + + if (IFCAP_TSO6 & dev->if_capenable && + !(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) { + dev->if_capenable &= ~IFCAP_TSO6; + dev->if_hwassist &= ~CSUM_IP6_TSO; + if_printf(dev, + "tso6 disabled due to -txcsum6.\n"); + } + } + if (mask & IFCAP_RXCSUM) + dev->if_capenable ^= IFCAP_RXCSUM; + if (mask & IFCAP_RXCSUM_IPV6) + dev->if_capenable ^= IFCAP_RXCSUM_IPV6; + + if (mask & IFCAP_TSO4) { + if (!(IFCAP_TSO4 & dev->if_capenable) && + !(IFCAP_TXCSUM & dev->if_capenable)) { + if_printf(dev, "enable txcsum first.\n"); + error = EAGAIN; + goto out; + } dev->if_capenable ^= IFCAP_TSO4; - if (mask & IFCAP_TSO6) + dev->if_hwassist ^= CSUM_IP_TSO; + } + if (mask & IFCAP_TSO6) { + if (!(IFCAP_TSO6 & dev->if_capenable) && + !(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) { + if_printf(dev, "enable txcsum6 first.\n"); + error = EAGAIN; + goto out; + } dev->if_capenable ^= IFCAP_TSO6; + dev->if_hwassist ^= CSUM_IP6_TSO; + } if (mask & IFCAP_LRO) dev->if_capenable ^= IFCAP_LRO; if (mask & IFCAP_VLAN_HWTAGGING) @@ -1964,9 +2003,11 @@ static int mlx4_en_ioctl(struct ifnet *d dev->if_capenable ^= IFCAP_WOL_MAGIC; if (dev->if_drv_flags & IFF_DRV_RUNNING) mlx4_en_start_port(dev); +out: mutex_unlock(&mdev->state_lock); VLAN_CAPABILITIES(dev); break; +#if __FreeBSD_version >= 1100036 case SIOCGI2C: { struct ifi2creq i2c; @@ -1990,6 +2031,7 @@ static int mlx4_en_ioctl(struct ifnet *d error = copyout(&i2c, ifr->ifr_data, sizeof(i2c)); break; } +#endif default: error = ether_ioctl(dev, command, data); break; @@ -2049,8 +2091,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d priv->port = port; priv->port_up = false; priv->flags = prof->flags; - priv->ctrl_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE | - MLX4_WQE_CTRL_SOLICITED); priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; priv->tx_ring_num = prof->tx_ring_num; @@ -2066,7 +2106,7 @@ int mlx4_en_init_netdev(struct mlx4_en_d err = -ENOMEM; goto out; } - + priv->rx_ring_num = prof->rx_ring_num; priv->cqe_factor = (mdev->dev->caps.cqe_size == 64) ? 1 : 0; priv->mac_index = -1; @@ -2089,7 +2129,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) INIT_HLIST_HEAD(&priv->mac_hash[i]); - /* Query for default mac and max mtu */ priv->max_mtu = mdev->dev->caps.eth_mtu_cap[priv->port]; priv->mac = mdev->dev->caps.def_mac[priv->port]; @@ -2105,8 +2144,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d goto out; } - - priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + DS_SIZE); @@ -2128,7 +2165,7 @@ int mlx4_en_init_netdev(struct mlx4_en_d /* * Set driver features */ - dev->if_capabilities |= IFCAP_RXCSUM | IFCAP_TXCSUM; + dev->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6; dev->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; dev->if_capabilities |= IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER; dev->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU; @@ -2137,10 +2174,12 @@ int mlx4_en_init_netdev(struct mlx4_en_d if (mdev->LSO_support) dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO; +#if __FreeBSD_version >= 1100000 /* set TSO limits so that we don't have to drop TX packets */ - dev->if_hw_tsomax = 65536 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); - dev->if_hw_tsomaxsegcount = 16; - dev->if_hw_tsomaxsegsize = 65536; /* XXX can do up to 4GByte */ + dev->if_hw_tsomax = MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */; + dev->if_hw_tsomaxsegcount = MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */; + dev->if_hw_tsomaxsegsize = MLX4_EN_TX_MAX_MBUF_SIZE; +#endif dev->if_capenable = dev->if_capabilities; @@ -2149,6 +2188,8 @@ int mlx4_en_init_netdev(struct mlx4_en_d dev->if_hwassist |= CSUM_TSO; if (dev->if_capenable & IFCAP_TXCSUM) dev->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); + if (dev->if_capenable & IFCAP_TXCSUM_IPV6) + dev->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); /* Register for VLAN events */ @@ -2211,8 +2252,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) queue_delayed_work(mdev->workqueue, &priv->service_task, SERVICE_TASK_DELAY); - - return 0; out: @@ -2294,6 +2333,162 @@ static int mlx4_en_set_tx_ring_size(SYSC return (error); } +static int mlx4_en_get_module_info(struct net_device *dev, + struct ethtool_modinfo *modinfo) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + int ret; + u8 data[4]; + + /* Read first 2 bytes to get Module & REV ID */ + ret = mlx4_get_module_info(mdev->dev, priv->port, + 0/*offset*/, 2/*size*/, data); + + if (ret < 2) { + en_err(priv, "Failed to read eeprom module first two bytes, error: 0x%x\n", -ret); + return -EIO; + } + + switch (data[0] /* identifier */) { + case MLX4_MODULE_ID_QSFP: + modinfo->type = ETH_MODULE_SFF_8436; + modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; + break; + case MLX4_MODULE_ID_QSFP_PLUS: + if (data[1] >= 0x3) { /* revision id */ + modinfo->type = ETH_MODULE_SFF_8636; + modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; + } else { + modinfo->type = ETH_MODULE_SFF_8436; + modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; + } + break; + case MLX4_MODULE_ID_QSFP28: + modinfo->type = ETH_MODULE_SFF_8636; + modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; + break; + case MLX4_MODULE_ID_SFP: + modinfo->type = ETH_MODULE_SFF_8472; + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; + break; + default: + en_err(priv, "mlx4_en_get_module_info : Not recognized cable type\n"); + return -EINVAL; + } + + return 0; +} + +static int mlx4_en_get_module_eeprom(struct net_device *dev, + struct ethtool_eeprom *ee, + u8 *data) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + int offset = ee->offset; + int i = 0, ret; + + if (ee->len == 0) + return -EINVAL; + + memset(data, 0, ee->len); + + while (i < ee->len) { + en_dbg(DRV, priv, + "mlx4_get_module_info i(%d) offset(%d) len(%d)\n", + i, offset, ee->len - i); + + ret = mlx4_get_module_info(mdev->dev, priv->port, + offset, ee->len - i, data + i); + + if (!ret) /* Done reading */ + return 0; + + if (ret < 0) { + en_err(priv, + "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n", + i, offset, ee->len - i, ret); + return -1; + } + + i += ret; + offset += ret; + } + return 0; +} + +static void mlx4_en_print_eeprom(u8 *data, __u32 len) +{ + int i; + int j = 0; + int row = 0; + const int NUM_OF_BYTES = 16; + + printf("\nOffset\t\tValues\n"); + printf("------\t\t------\n"); + while(row < len){ + printf("0x%04x\t\t",row); + for(i=0; i < NUM_OF_BYTES; i++){ + printf("%02x ", data[j]); + row++; + j++; + } + printf("\n"); + } +} + +/* Read cable EEPROM module information by first inspecting the first + * two bytes to get the length and then read the rest of the information. + * The information is printed to dmesg. */ +static int mlx4_en_read_eeprom(SYSCTL_HANDLER_ARGS) +{ + + u8* data; + int error; + int result = 0; + struct mlx4_en_priv *priv; + struct net_device *dev; + struct ethtool_modinfo modinfo; + struct ethtool_eeprom ee; + + error = sysctl_handle_int(oidp, &result, 0, req); + if (error || !req->newptr) + return (error); + + if (result == 1) { + priv = arg1; + dev = priv->dev; + data = kmalloc(PAGE_SIZE, GFP_KERNEL); + + error = mlx4_en_get_module_info(dev, &modinfo); + if (error) { + en_err(priv, + "mlx4_en_get_module_info returned with error - FAILED (0x%x)\n", + -error); + goto out; + } + + ee.len = modinfo.eeprom_len; + ee.offset = 0; + + error = mlx4_en_get_module_eeprom(dev, &ee, data); + if (error) { + en_err(priv, + "mlx4_en_get_module_eeprom returned with error - FAILED (0x%x)\n", + -error); + /* Continue printing partial information in case of an error */ + } + + /* EEPROM information will be printed in dmesg */ + mlx4_en_print_eeprom(data, ee.len); +out: + kfree(data); + } + /* Return zero to prevent sysctl failure. */ + return (0); +} + static int mlx4_en_set_tx_ppp(SYSCTL_HANDLER_ARGS) { struct mlx4_en_priv *priv; @@ -2419,7 +2614,7 @@ static void mlx4_en_sysctl_conf(struct m /* Add coalescer configuration. */ coal = SYSCTL_ADD_NODE(ctx, node_list, OID_AUTO, "coalesce", CTLFLAG_RD, NULL, "Interrupt coalesce configuration"); - coal_list = SYSCTL_CHILDREN(node); + coal_list = SYSCTL_CHILDREN(coal); SYSCTL_ADD_UINT(ctx, coal_list, OID_AUTO, "pkt_rate_low", CTLFLAG_RW, &priv->pkt_rate_low, 0, "Packets per-second for minimum delay"); @@ -2438,11 +2633,14 @@ static void mlx4_en_sysctl_conf(struct m SYSCTL_ADD_UINT(ctx, coal_list, OID_AUTO, "adaptive_rx_coal", CTLFLAG_RW, &priv->adaptive_rx_coal, 0, "Enable adaptive rx coalescing"); + /* EEPROM support */ + SYSCTL_ADD_PROC(ctx, node_list, OID_AUTO, "eeprom_info", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, + mlx4_en_read_eeprom, "I", "EEPROM information"); } static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv) { - struct net_device *dev; struct sysctl_ctx_list *ctx; struct sysctl_oid *node; struct sysctl_oid_list *node_list; @@ -2453,8 +2651,6 @@ static void mlx4_en_sysctl_stat(struct m char namebuf[128]; int i; - dev = priv->dev; - ctx = &priv->stat_ctx; sysctl_ctx_init(ctx); node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(priv->sysctl), OID_AUTO, @@ -2482,6 +2678,8 @@ static void mlx4_en_sysctl_stat(struct m &priv->port_stats.wake_queue, "Queue resumed after full"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_timeout", CTLFLAG_RD, &priv->port_stats.tx_timeout, "Transmit timeouts"); + SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_oversized_packets", CTLFLAG_RD, + &priv->port_stats.oversized_packets, "TX oversized packets, m_defrag failed"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_alloc_failed", CTLFLAG_RD, &priv->port_stats.rx_alloc_failed, "RX failed to allocate mbuf"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_chksum_good", CTLFLAG_RD, @@ -2565,7 +2763,7 @@ struct mlx4_en_pkt_stats { SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_packets", CTLFLAG_RD, &priv->pkstats.tx_packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_bytes", CTLFLAG_RD, - &priv->pkstats.tx_packets, "TX Bytes"); + &priv->pkstats.tx_bytes, "TX Bytes"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_multicast_packets", CTLFLAG_RD, &priv->pkstats.tx_multicast_packets, "TX Multicast Packets"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_broadcast_packets", CTLFLAG_RD, @@ -2606,8 +2804,8 @@ struct mlx4_en_pkt_stats { CTLFLAG_RD, &tx_ring->packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes", CTLFLAG_RD, &tx_ring->bytes, "TX bytes"); - } + for (i = 0; i < priv->rx_ring_num; i++) { rx_ring = priv->rx_ring[i]; snprintf(namebuf, sizeof(namebuf), "rx_ring%d", i); Modified: stable/10/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_port.c Fri Dec 11 13:55:31 2015 (r292106) +++ stable/10/sys/ofed/drivers/net/mlx4/en_port.c Fri Dec 11 14:21:58 2015 (r292107) @@ -194,6 +194,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_e priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped; priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue; + priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets; } /* RX Statistics */ priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) + Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Fri Dec 11 13:55:31 2015 (r292106) +++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Fri Dec 11 14:21:58 2015 (r292107) @@ -49,106 +49,135 @@ static void mlx4_en_init_rx_desc(struct struct mlx4_en_rx_ring *ring, int index) { - struct mlx4_en_rx_desc *rx_desc = ring->buf + ring->stride * index; + struct mlx4_en_rx_desc *rx_desc = (struct mlx4_en_rx_desc *) + (ring->buf + (ring->stride * index)); int possible_frags; int i; - /* Set size and memtype fields */ - for (i = 0; i < priv->num_frags; i++) { - rx_desc->data[i].byte_count = - cpu_to_be32(priv->frag_info[i].frag_size); - rx_desc->data[i].lkey = cpu_to_be32(priv->mdev->mr.key); - } + rx_desc->data[0].byte_count = cpu_to_be32(priv->rx_mb_size); + rx_desc->data[0].lkey = cpu_to_be32(priv->mdev->mr.key); - /* If the number of used fragments does not fill up the ring stride, - * * remaining (unused) fragments must be padded with null address/size - * * and a special memory key */ + /* + * If the number of used fragments does not fill up the ring + * stride, remaining (unused) fragments must be padded with + * null address/size and a special memory key: + */ possible_frags = (ring->stride - sizeof(struct mlx4_en_rx_desc)) / DS_SIZE; - for (i = priv->num_frags; i < possible_frags; i++) { + for (i = 1; i < possible_frags; i++) { rx_desc->data[i].byte_count = 0; rx_desc->data[i].lkey = cpu_to_be32(MLX4_EN_MEMTYPE_PAD); rx_desc->data[i].addr = 0; } - } -static int mlx4_en_alloc_buf(struct mlx4_en_priv *priv, - struct mlx4_en_rx_desc *rx_desc, - struct mbuf **mb_list, - int i) +static int +mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, + __be64 *pdma, struct mlx4_en_rx_mbuf *mb_list) { - struct mlx4_en_dev *mdev = priv->mdev; - struct mlx4_en_frag_info *frag_info = &priv->frag_info[i]; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; struct mbuf *mb; - dma_addr_t dma; + int nsegs; + int err; - if (i == 0) - mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, frag_info->frag_size); - else - mb = m_getjcl(M_NOWAIT, MT_DATA, 0, frag_info->frag_size); - if (mb == NULL) { - priv->port_stats.rx_alloc_failed++; - return -ENOMEM; + /* try to allocate a new spare mbuf */ + if (unlikely(ring->spare.mbuf == NULL)) { + mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + if (unlikely(mb == NULL)) + return (-ENOMEM); + /* setup correct length */ + mb->m_len = ring->rx_mb_size; + + /* load spare mbuf into BUSDMA */ + err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, ring->spare.dma_map, + mb, segs, &nsegs, BUS_DMA_NOWAIT); + if (unlikely(err != 0)) { + m_freem(mb); + return (err); + } + + /* store spare info */ + ring->spare.mbuf = mb; + ring->spare.paddr_be = cpu_to_be64(segs[0].ds_addr); + + bus_dmamap_sync(ring->dma_tag, ring->spare.dma_map, + BUS_DMASYNC_PREREAD); } - dma = pci_map_single(mdev->pdev, mb->m_data, frag_info->frag_size, - PCI_DMA_FROMDEVICE); - rx_desc->data[i].addr = cpu_to_be64(dma); - mb_list[i] = mb; - return 0; -} + /* synchronize and unload the current mbuf, if any */ + if (likely(mb_list->mbuf != NULL)) { + bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->dma_tag, mb_list->dma_map); + } -static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, - struct mlx4_en_rx_ring *ring, int index) -{ - struct mlx4_en_rx_desc *rx_desc = ring->buf + (index * ring->stride); - struct mbuf **mb_list = ring->rx_info + (index << priv->log_rx_info); - int i; + mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + if (unlikely(mb == NULL)) + goto use_spare; + + /* setup correct length */ + mb->m_len = ring->rx_mb_size; + + err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, mb_list->dma_map, + mb, segs, &nsegs, BUS_DMA_NOWAIT); + if (unlikely(err != 0)) { + m_freem(mb); + goto use_spare; + } + + *pdma = cpu_to_be64(segs[0].ds_addr); + mb_list->mbuf = mb; + + bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, BUS_DMASYNC_PREREAD); + return (0); - for (i = 0; i < priv->num_frags; i++) - if (mlx4_en_alloc_buf(priv, rx_desc, mb_list, i)) - goto err; +use_spare: + /* swap DMA maps */ + map = mb_list->dma_map; + mb_list->dma_map = ring->spare.dma_map; + ring->spare.dma_map = map; - return 0; + /* swap MBUFs */ + mb_list->mbuf = ring->spare.mbuf; + ring->spare.mbuf = NULL; -err: - while (i--) - m_free(mb_list[i]); - return -ENOMEM; + /* store physical address */ + *pdma = ring->spare.paddr_be; + return (0); } -static inline void mlx4_en_update_rx_prod_db(struct mlx4_en_rx_ring *ring) +static void +mlx4_en_free_buf(struct mlx4_en_rx_ring *ring, struct mlx4_en_rx_mbuf *mb_list) { - *ring->wqres.db.db = cpu_to_be32(ring->prod & 0xffff); + bus_dmamap_t map = mb_list->dma_map; + bus_dmamap_sync(ring->dma_tag, map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->dma_tag, map); + m_freem(mb_list->mbuf); + mb_list->mbuf = NULL; /* safety clearing */ } -static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv, - struct mlx4_en_rx_ring *ring, - int index) +static int +mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, + struct mlx4_en_rx_ring *ring, int index) { - struct mlx4_en_frag_info *frag_info; - struct mlx4_en_dev *mdev = priv->mdev; - struct mbuf **mb_list; - struct mlx4_en_rx_desc *rx_desc = ring->buf + (index << ring->log_stride); - dma_addr_t dma; - int nr; - - mb_list = ring->rx_info + (index << priv->log_rx_info); - for (nr = 0; nr < priv->num_frags; nr++) { - en_dbg(DRV, priv, "Freeing fragment:%d\n", nr); - frag_info = &priv->frag_info[nr]; - dma = be64_to_cpu(rx_desc->data[nr].addr); - -#if BITS_PER_LONG == 64 - en_dbg(DRV, priv, "Unmaping buffer at dma:0x%lx\n", (u64) dma); -#elif BITS_PER_LONG == 32 - en_dbg(DRV, priv, "Unmaping buffer at dma:0x%llx\n", (u64) dma); -#endif - pci_unmap_single(mdev->pdev, dma, frag_info->frag_size, - PCI_DMA_FROMDEVICE); - m_free(mb_list[nr]); + struct mlx4_en_rx_desc *rx_desc = (struct mlx4_en_rx_desc *) + (ring->buf + (index * ring->stride)); + struct mlx4_en_rx_mbuf *mb_list = ring->mbuf + index; + + mb_list->mbuf = NULL; + + if (mlx4_en_alloc_buf(ring, &rx_desc->data[0].addr, mb_list)) { + priv->port_stats.rx_alloc_failed++; + return (-ENOMEM); } + return (0); +} + +static inline void +mlx4_en_update_rx_prod_db(struct mlx4_en_rx_ring *ring) +{ + *ring->wqres.db.db = cpu_to_be32(ring->prod & 0xffff); } static int mlx4_en_fill_rx_buffers(struct mlx4_en_priv *priv) @@ -191,7 +220,8 @@ reduce_rings: while (ring->actual_size > new_size) { ring->actual_size--; ring->prod--; - mlx4_en_free_rx_desc(priv, ring, ring->actual_size); + mlx4_en_free_buf(ring, + ring->mbuf + ring->actual_size); } } @@ -211,100 +241,106 @@ static void mlx4_en_free_rx_buf(struct m while (ring->cons != ring->prod) { index = ring->cons & ring->size_mask; en_dbg(DRV, priv, "Processing descriptor:%d\n", index); - mlx4_en_free_rx_desc(priv, ring, index); + mlx4_en_free_buf(ring, ring->mbuf + index); ++ring->cons; } } -#if MLX4_EN_MAX_RX_FRAGS == 3 -static int frag_sizes[] = { - FRAG_SZ0, - FRAG_SZ1, - FRAG_SZ2, -}; -#elif MLX4_EN_MAX_RX_FRAGS == 2 -static int frag_sizes[] = { - FRAG_SZ0, - FRAG_SZ1, -}; -#else -#error "Unknown MAX_RX_FRAGS" -#endif - void mlx4_en_calc_rx_buf(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; - int buf_size = 0; - int i, frag; - for (i = 0, frag = 0; buf_size < eff_mtu; frag++, i++) { - /* - * Allocate small to large but only as much as is needed for - * the tail. - */ - while (i > 0 && eff_mtu - buf_size <= frag_sizes[i - 1]) - i--; - priv->frag_info[frag].frag_size = frag_sizes[i]; - priv->frag_info[frag].frag_prefix_size = buf_size; - buf_size += priv->frag_info[frag].frag_size; - } + if (eff_mtu > MJUM16BYTES) { + en_err(priv, "MTU(%d) is too big\n", (int)dev->if_mtu); + eff_mtu = MJUM16BYTES; + } else if (eff_mtu > MJUM9BYTES) { + eff_mtu = MJUM16BYTES; + } else if (eff_mtu > MJUMPAGESIZE) { + eff_mtu = MJUM9BYTES; + } else if (eff_mtu > MCLBYTES) { + eff_mtu = MJUMPAGESIZE; + } else { + eff_mtu = MCLBYTES; + } - priv->num_frags = frag; priv->rx_mb_size = eff_mtu; - priv->log_rx_info = - ROUNDUP_LOG2(priv->num_frags * sizeof(struct mbuf *)); - en_dbg(DRV, priv, "Rx buffer scatter-list (effective-mtu:%d " - "num_frags:%d):\n", eff_mtu, priv->num_frags); - for (i = 0; i < priv->num_frags; i++) { - en_dbg(DRV, priv, " frag:%d - size:%d prefix:%d\n", i, - priv->frag_info[i].frag_size, - priv->frag_info[i].frag_prefix_size); - } + en_dbg(DRV, priv, "Effective RX MTU: %d bytes\n", eff_mtu); } - int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, u32 size, int node) { struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_rx_ring *ring; - int err = -ENOMEM; + int err; int tmp; + uint32_t x; ring = kzalloc(sizeof(struct mlx4_en_rx_ring), GFP_KERNEL); if (!ring) { en_err(priv, "Failed to allocate RX ring structure\n"); return -ENOMEM; } - + + /* Create DMA descriptor TAG */ + if ((err = -bus_dma_tag_create( + bus_get_dma_tag(mdev->pdev->dev.bsddev), + 1, /* any alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MJUM16BYTES, /* maxsize */ + 1, /* nsegments */ + MJUM16BYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &ring->dma_tag))) { + en_err(priv, "Failed to create DMA tag\n"); + goto err_ring; + } + ring->prod = 0; ring->cons = 0; ring->size = size; ring->size_mask = size - 1; - ring->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + - DS_SIZE * MLX4_EN_MAX_RX_FRAGS); + ring->stride = roundup_pow_of_two( + sizeof(struct mlx4_en_rx_desc) + DS_SIZE); ring->log_stride = ffs(ring->stride) - 1; ring->buf_size = ring->size * ring->stride + TXBB_SIZE; - tmp = size * roundup_pow_of_two(MLX4_EN_MAX_RX_FRAGS * - sizeof(struct mbuf *)); + tmp = size * sizeof(struct mlx4_en_rx_mbuf); - ring->rx_info = kmalloc(tmp, GFP_KERNEL); - if (!ring->rx_info) { + ring->mbuf = kzalloc(tmp, GFP_KERNEL); + if (ring->mbuf == NULL) { err = -ENOMEM; - goto err_ring; + goto err_dma_tag; } - en_dbg(DRV, priv, "Allocated rx_info ring at addr:%p size:%d\n", - ring->rx_info, tmp); + err = -bus_dmamap_create(ring->dma_tag, 0, &ring->spare.dma_map); + if (err != 0) + goto err_info; + + for (x = 0; x != size; x++) { + err = -bus_dmamap_create(ring->dma_tag, 0, + &ring->mbuf[x].dma_map); + if (err != 0) { + while (x--) + bus_dmamap_destroy(ring->dma_tag, + ring->mbuf[x].dma_map); + goto err_info; + } + } + en_dbg(DRV, priv, "Allocated MBUF ring at addr:%p size:%d\n", + ring->mbuf, tmp); err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres, ring->buf_size, 2 * PAGE_SIZE); if (err) - goto err_info; + goto err_dma_map; err = mlx4_en_map_buffer(&ring->wqres.buf); if (err) { @@ -317,23 +353,29 @@ int mlx4_en_create_rx_ring(struct mlx4_e err_hwq: mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); +err_dma_map: + for (x = 0; x != size; x++) { + bus_dmamap_destroy(ring->dma_tag, + ring->mbuf[x].dma_map); + } + bus_dmamap_destroy(ring->dma_tag, ring->spare.dma_map); err_info: - vfree(ring->rx_info); + vfree(ring->mbuf); +err_dma_tag: + bus_dma_tag_destroy(ring->dma_tag); err_ring: kfree(ring); - - return err; + return (err); } - int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) { struct mlx4_en_rx_ring *ring; int i; int ring_ind; int err; - int stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + - DS_SIZE * priv->num_frags); + int stride = roundup_pow_of_two( + sizeof(struct mlx4_en_rx_desc) + DS_SIZE); for (ring_ind = 0; ring_ind < priv->rx_ring_num; ring_ind++) { ring = priv->rx_ring[ring_ind]; @@ -409,10 +451,22 @@ void mlx4_en_destroy_rx_ring(struct mlx4 { struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_rx_ring *ring = *pring; + uint32_t x; mlx4_en_unmap_buffer(&ring->wqres.buf); mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE); - vfree(ring->rx_info); + for (x = 0; x != size; x++) + bus_dmamap_destroy(ring->dma_tag, ring->mbuf[x].dma_map); + /* free spare mbuf, if any */ + if (ring->spare.mbuf != NULL) { + bus_dmamap_sync(ring->dma_tag, ring->spare.dma_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->dma_tag, ring->spare.dma_map); + m_freem(ring->spare.mbuf); + } + bus_dmamap_destroy(ring->dma_tag, ring->spare.dma_map); + vfree(ring->mbuf); + bus_dma_tag_destroy(ring->dma_tag); kfree(ring); *pring = NULL; #ifdef CONFIG_RFS_ACCEL @@ -420,7 +474,6 @@ void mlx4_en_destroy_rx_ring(struct mlx4 #endif } - void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring) { @@ -469,69 +522,27 @@ static inline int invalid_cqe(struct mlx return 0; } - -/* Unmap a completed descriptor and free unused pages */ -static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, - struct mlx4_en_rx_desc *rx_desc, - struct mbuf **mb_list, - int length) +static struct mbuf * +mlx4_en_rx_mb(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring, + struct mlx4_en_rx_desc *rx_desc, struct mlx4_en_rx_mbuf *mb_list, + int length) { - struct mlx4_en_dev *mdev = priv->mdev; - struct mlx4_en_frag_info *frag_info; - dma_addr_t dma; struct mbuf *mb; - int nr; - mb = mb_list[0]; - mb->m_pkthdr.len = length; - /* Collect used fragments while replacing them in the HW descirptors */ - for (nr = 0; nr < priv->num_frags; nr++) { - frag_info = &priv->frag_info[nr]; - if (length <= frag_info->frag_prefix_size) - break; - if (nr) - mb->m_next = mb_list[nr]; - mb = mb_list[nr]; - mb->m_len = frag_info->frag_size; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Dec 11 14:53:41 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8CAD9D7C91; Fri, 11 Dec 2015 14:53:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC642107D; Fri, 11 Dec 2015 14:53:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBErewD094871; Fri, 11 Dec 2015 14:53:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBEreg2094870; Fri, 11 Dec 2015 14:53:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111453.tBBEreg2094870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 14:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r292108 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 14:53:42 -0000 Author: hselasky Date: Fri Dec 11 14:53:40 2015 New Revision: 292108 URL: https://svnweb.freebsd.org/changeset/base/292108 Log: MFC r291690: Remove incorrect defines. The proper version of these macros is defined in linux/etherdevice.h. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/compat.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/compat.h ============================================================================== --- stable/9/sys/ofed/include/linux/compat.h Fri Dec 11 14:21:58 2015 (r292107) +++ stable/9/sys/ofed/include/linux/compat.h Fri Dec 11 14:53:40 2015 (r292108) @@ -30,8 +30,4 @@ #ifndef _LINUX_COMPAT_H_ #define _LINUX_COMPAT_H_ -#define is_multicast_ether_addr(x) 0 -#define is_broadcast_ether_addr(x) 0 - - #endif /* _LINUX_COMPAT_H_ */ From owner-svn-src-stable@freebsd.org Fri Dec 11 14:56:20 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C928B9D7F6A; Fri, 11 Dec 2015 14:56:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96DA014A4; Fri, 11 Dec 2015 14:56:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBEuJW3095022; Fri, 11 Dec 2015 14:56:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBEuJ8C095021; Fri, 11 Dec 2015 14:56:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111456.tBBEuJ8C095021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 14:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r292109 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 14:56:20 -0000 Author: hselasky Date: Fri Dec 11 14:56:19 2015 New Revision: 292109 URL: https://svnweb.freebsd.org/changeset/base/292109 Log: MFC r291693: Add some structures and defines which will be used when decoding small form factor, SFF, standards compliant ethernet EEPROMs. Obtained from: Linux Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/etherdevice.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/etherdevice.h ============================================================================== --- stable/9/sys/ofed/include/linux/etherdevice.h Fri Dec 11 14:53:40 2015 (r292108) +++ stable/9/sys/ofed/include/linux/etherdevice.h Fri Dec 11 14:56:19 2015 (r292109) @@ -37,6 +37,25 @@ #include +#define ETH_MODULE_SFF_8079 1 +#define ETH_MODULE_SFF_8079_LEN 256 +#define ETH_MODULE_SFF_8472 2 +#define ETH_MODULE_SFF_8472_LEN 512 +#define ETH_MODULE_SFF_8636 3 +#define ETH_MODULE_SFF_8636_LEN 256 +#define ETH_MODULE_SFF_8436 4 +#define ETH_MODULE_SFF_8436_LEN 256 + +struct ethtool_eeprom { + u32 offset; + u32 len; +}; + +struct ethtool_modinfo { + u32 type; + u32 eeprom_len; +}; + /** * is_zero_ether_addr - Determine if give Ethernet address is all zeros. * @addr: Pointer to a six-byte array containing the Ethernet address From owner-svn-src-stable@freebsd.org Fri Dec 11 15:35:48 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F24A9D7DFD; Fri, 11 Dec 2015 15:35:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 202FF1F49; Fri, 11 Dec 2015 15:35:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBFZlsV006993; Fri, 11 Dec 2015 15:35:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBFZlc6006992; Fri, 11 Dec 2015 15:35:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111535.tBBFZlc6006992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 15:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292113 - stable/10/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 15:35:48 -0000 Author: hselasky Date: Fri Dec 11 15:35:47 2015 New Revision: 292113 URL: https://svnweb.freebsd.org/changeset/base/292113 Log: Enable the mlx4en TSO limits. This is a direct commit to stable/10. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 15:25:47 2015 (r292112) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 15:35:47 2015 (r292113) @@ -2174,12 +2174,10 @@ int mlx4_en_init_netdev(struct mlx4_en_d if (mdev->LSO_support) dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO; -#if __FreeBSD_version >= 1100000 /* set TSO limits so that we don't have to drop TX packets */ dev->if_hw_tsomax = MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */; dev->if_hw_tsomaxsegcount = MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */; dev->if_hw_tsomaxsegsize = MLX4_EN_TX_MAX_MBUF_SIZE; -#endif dev->if_capenable = dev->if_capabilities; From owner-svn-src-stable@freebsd.org Fri Dec 11 18:28:21 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C500CA049D7; Fri, 11 Dec 2015 18:28:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8CAD51528; Fri, 11 Dec 2015 18:28:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBBISK1T057210; Fri, 11 Dec 2015 18:28:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBBISKXJ057205; Fri, 11 Dec 2015 18:28:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201512111828.tBBISKXJ057205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Dec 2015 18:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r292115 - in stable/9/sys: modules/mlxen ofed/drivers/net/mlx4 ofed/include/linux/mlx4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 18:28:21 -0000 Author: hselasky Date: Fri Dec 11 18:28:20 2015 New Revision: 292115 URL: https://svnweb.freebsd.org/changeset/base/292115 Log: MFC r283612, r290710, r291694, r291699 and r291793: - Add SIOCGI2C ioctl support to the driver. Would work only on ConnectX-3 with fresh firmware. The low level code is based on code provided by Mellanox. - Fix print formatting compile warnings for Sparc64 and PowerPC platforms. - Updated the mlx4 and mlxen drivers to the latest version, v2.1.6: - Added support for dumping the SFP EEPROM content to dmesg. - Fixed handling of network interface capability IOCTLs. - Fixed race when loading and unloading the mlxen driver by applying appropriate locking. - Removed two unused C-files. - Convert the mlxen driver to use the BUSDMA(9) APIs instead of vtophys() when loading mbufs for transmission and reception. While at it all pointer arithmetic and cast qualifier issues were fixed, mostly related to transmission and reception. - Fix i386 build WITH_OFED=YES. Remove some redundant KASSERTs. Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4283 Differential Revision: https://reviews.freebsd.org/D4284 Deleted: stable/9/sys/ofed/drivers/net/mlx4/en_ethtool.c stable/9/sys/ofed/drivers/net/mlx4/en_selftest.c Modified: stable/9/sys/modules/mlxen/Makefile stable/9/sys/ofed/drivers/net/mlx4/en_main.c stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c stable/9/sys/ofed/drivers/net/mlx4/en_port.c stable/9/sys/ofed/drivers/net/mlx4/en_rx.c stable/9/sys/ofed/drivers/net/mlx4/en_tx.c stable/9/sys/ofed/drivers/net/mlx4/main.c stable/9/sys/ofed/drivers/net/mlx4/mlx4.h stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h stable/9/sys/ofed/drivers/net/mlx4/port.c stable/9/sys/ofed/include/linux/mlx4/cq.h stable/9/sys/ofed/include/linux/mlx4/device.h stable/9/sys/ofed/include/linux/mlx4/doorbell.h stable/9/sys/ofed/include/linux/mlx4/qp.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/modules/mlxen/Makefile ============================================================================== --- stable/9/sys/modules/mlxen/Makefile Fri Dec 11 16:51:04 2015 (r292114) +++ stable/9/sys/modules/mlxen/Makefile Fri Dec 11 18:28:20 2015 (r292115) @@ -26,4 +26,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= ${GCC_MS_EXTENSIONS} Modified: stable/9/sys/ofed/drivers/net/mlx4/en_main.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_main.c Fri Dec 11 16:51:04 2015 (r292114) +++ stable/9/sys/ofed/drivers/net/mlx4/en_main.c Fri Dec 11 18:28:20 2015 (r292115) @@ -42,14 +42,7 @@ #include "mlx4_en.h" -MODULE_AUTHOR("Liran Liss, Yevgeny Petrilin"); -MODULE_DESCRIPTION("Mellanox ConnectX HCA Ethernet driver"); -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_VERSION(DRV_VERSION " ("DRV_RELDATE")"); - -static const char mlx4_en_version[] = - DRV_NAME ": Mellanox ConnectX HCA Ethernet driver v" - DRV_VERSION " (" DRV_RELDATE ")\n"; +/* Mellanox ConnectX HCA Ethernet driver */ #define MLX4_EN_PARM_INT(X, def_val, desc) \ static unsigned int X = def_val;\ @@ -174,8 +167,6 @@ static void *mlx4_en_add(struct mlx4_dev int i; int err; - printk_once(KERN_INFO "%s", mlx4_en_version); - mdev = kzalloc(sizeof *mdev, GFP_KERNEL); if (!mdev) { dev_err(&dev->pdev->dev, "Device struct alloc failed, " Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 16:51:04 2015 (r292114) +++ stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 18:28:20 2015 (r292115) @@ -659,8 +659,10 @@ static void mlx4_en_cache_mclist(struct continue; /* Make sure the list didn't grow. */ tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC); - if (tmp == NULL) + if (tmp == NULL) { + en_err(priv, "Failed to allocate multicast list\n"); break; + } memcpy(tmp->addr, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), ETH_ALEN); list_add_tail(&tmp->list, &priv->mc_list); @@ -971,12 +973,12 @@ static void mlx4_en_do_set_rx_mode(struc if (!mlx4_en_QUERY_PORT(mdev, priv->port)) { if (priv->port_state.link_state) { priv->last_link_state = MLX4_DEV_EVENT_PORT_UP; - /* Important note: the following call for if_link_state_change - * is needed for interface up scenario (start port, link state - * change) */ /* update netif baudrate */ priv->dev->if_baudrate = IF_Mbps(priv->port_state.link_speed); + /* Important note: the following call for if_link_state_change + * is needed for interface up scenario (start port, link state + * change) */ if_link_state_change(priv->dev, LINK_STATE_UP); en_dbg(HW, priv, "Link Up\n"); } @@ -1196,8 +1198,8 @@ static void mlx4_en_linkstate(struct wor /* update netif baudrate */ priv->dev->if_baudrate = 0; - /* make sure the port is up before notifying the OS. - * This is tricky since we get here on INIT_PORT and + /* make sure the port is up before notifying the OS. + * This is tricky since we get here on INIT_PORT and * in such case we can't tell the OS the port is up. * To solve this there is a call to if_link_state_change * in set_rx_mode. @@ -1246,7 +1248,6 @@ int mlx4_en_start_port(struct net_device PAGE_SIZE); priv->rx_alloc_order = get_order(priv->rx_alloc_size); priv->rx_buf_size = roundup_pow_of_two(priv->rx_mb_size); - priv->log_rx_info = ROUNDUP_LOG2(sizeof(struct mlx4_en_rx_buf)); en_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_mb_size); /* Configure rx cq's and rings */ @@ -1575,6 +1576,7 @@ static void mlx4_en_clear_stats(struct n priv->tx_ring[i]->bytes = 0; priv->tx_ring[i]->packets = 0; priv->tx_ring[i]->tx_csum = 0; + priv->tx_ring[i]->oversized_packets = 0; } for (i = 0; i < priv->rx_ring_num; i++) { priv->rx_ring[i]->bytes = 0; @@ -1644,8 +1646,6 @@ void mlx4_en_free_resources(struct mlx4_ if (priv->sysctl) sysctl_ctx_free(&priv->stat_ctx); - - } int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) @@ -1730,8 +1730,11 @@ void mlx4_en_destroy_netdev(struct net_d EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach); /* Unregister device - this will close the port if it was up */ - if (priv->registered) + if (priv->registered) { + mutex_lock(&mdev->state_lock); ether_ifdetach(dev); + mutex_unlock(&mdev->state_lock); + } if (priv->allocated) mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE); @@ -1809,13 +1812,6 @@ static int mlx4_en_calc_media(struct mlx active = IFM_ETHER; if (priv->last_link_state == MLX4_DEV_EVENT_PORT_DOWN) return (active); - /* - * [ShaharK] mlx4_en_QUERY_PORT sleeps and cannot be called under a - * non-sleepable lock. - * I moved it to the periodic mlx4_en_do_get_stats. - if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) - return (active); - */ active |= IFM_FDX; trans_type = priv->port_state.transciver; /* XXX I don't know all of the transceiver values. */ @@ -1948,12 +1944,57 @@ static int mlx4_en_ioctl(struct ifnet *d case SIOCSIFCAP: mutex_lock(&mdev->state_lock); mask = ifr->ifr_reqcap ^ dev->if_capenable; - if (mask & IFCAP_HWCSUM) - dev->if_capenable ^= IFCAP_HWCSUM; - if (mask & IFCAP_TSO4) + if (mask & IFCAP_TXCSUM) { + dev->if_capenable ^= IFCAP_TXCSUM; + dev->if_hwassist ^= (CSUM_TCP | CSUM_UDP | CSUM_IP); + + if (IFCAP_TSO4 & dev->if_capenable && + !(IFCAP_TXCSUM & dev->if_capenable)) { + dev->if_capenable &= ~IFCAP_TSO4; + dev->if_hwassist &= ~CSUM_TSO; + if_printf(dev, + "tso4 disabled due to -txcsum.\n"); + } + } + if (mask & IFCAP_TXCSUM_IPV6) { + dev->if_capenable ^= IFCAP_TXCSUM_IPV6; + dev->if_hwassist ^= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + + if (IFCAP_TSO6 & dev->if_capenable && + !(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) { + dev->if_capenable &= ~IFCAP_TSO6; + dev->if_hwassist &= ~CSUM_TSO; + if_printf(dev, + "tso6 disabled due to -txcsum6.\n"); + } + } + if (mask & IFCAP_RXCSUM) + dev->if_capenable ^= IFCAP_RXCSUM; + if (mask & IFCAP_RXCSUM_IPV6) + dev->if_capenable ^= IFCAP_RXCSUM_IPV6; + + if (mask & IFCAP_TSO4) { + if (!(IFCAP_TSO4 & dev->if_capenable) && + !(IFCAP_TXCSUM & dev->if_capenable)) { + if_printf(dev, "enable txcsum first.\n"); + error = EAGAIN; + goto out; + } dev->if_capenable ^= IFCAP_TSO4; - if (mask & IFCAP_TSO6) + } + if (mask & IFCAP_TSO6) { + if (!(IFCAP_TSO6 & dev->if_capenable) && + !(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) { + if_printf(dev, "enable txcsum6 first.\n"); + error = EAGAIN; + goto out; + } dev->if_capenable ^= IFCAP_TSO6; + } + if (dev->if_capenable & (IFCAP_TSO4 | IFCAP_TSO6)) + dev->if_hwassist |= CSUM_TSO; + else + dev->if_hwassist &= ~CSUM_TSO; if (mask & IFCAP_LRO) dev->if_capenable ^= IFCAP_LRO; if (mask & IFCAP_VLAN_HWTAGGING) @@ -1964,9 +2005,35 @@ static int mlx4_en_ioctl(struct ifnet *d dev->if_capenable ^= IFCAP_WOL_MAGIC; if (dev->if_drv_flags & IFF_DRV_RUNNING) mlx4_en_start_port(dev); +out: mutex_unlock(&mdev->state_lock); VLAN_CAPABILITIES(dev); break; +#if __FreeBSD_version >= 1100036 + case SIOCGI2C: { + struct ifi2creq i2c; + + error = copyin(ifr->ifr_data, &i2c, sizeof(i2c)); + if (error) + break; + if (i2c.len > sizeof(i2c.data)) { + error = EINVAL; + break; + } + /* + * Note that we ignore i2c.addr here. The driver hardcodes + * the address to 0x50, while standard expects it to be 0xA0. + */ + error = mlx4_get_module_info(mdev->dev, priv->port, + i2c.offset, i2c.len, i2c.data); + if (error < 0) { + error = -error; + break; + } + error = copyout(&i2c, ifr->ifr_data, sizeof(i2c)); + break; + } +#endif default: error = ether_ioctl(dev, command, data); break; @@ -2026,8 +2093,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d priv->port = port; priv->port_up = false; priv->flags = prof->flags; - priv->ctrl_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE | - MLX4_WQE_CTRL_SOLICITED); priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; priv->tx_ring_num = prof->tx_ring_num; @@ -2043,7 +2108,7 @@ int mlx4_en_init_netdev(struct mlx4_en_d err = -ENOMEM; goto out; } - + priv->rx_ring_num = prof->rx_ring_num; priv->cqe_factor = (mdev->dev->caps.cqe_size == 64) ? 1 : 0; priv->mac_index = -1; @@ -2066,7 +2131,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) INIT_HLIST_HEAD(&priv->mac_hash[i]); - /* Query for default mac and max mtu */ priv->max_mtu = mdev->dev->caps.eth_mtu_cap[priv->port]; priv->mac = mdev->dev->caps.def_mac[priv->port]; @@ -2082,8 +2146,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d goto out; } - - priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + DS_SIZE); @@ -2105,7 +2167,7 @@ int mlx4_en_init_netdev(struct mlx4_en_d /* * Set driver features */ - dev->if_capabilities |= IFCAP_RXCSUM | IFCAP_TXCSUM; + dev->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6; dev->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; dev->if_capabilities |= IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER; dev->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU; @@ -2115,9 +2177,9 @@ int mlx4_en_init_netdev(struct mlx4_en_d dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO; /* set TSO limits so that we don't have to drop TX packets */ - dev->if_hw_tsomax = 65536 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); - dev->if_hw_tsomaxsegcount = 16; - dev->if_hw_tsomaxsegsize = 65536; /* XXX can do up to 4GByte */ + dev->if_hw_tsomax = MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */; + dev->if_hw_tsomaxsegcount = MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */; + dev->if_hw_tsomaxsegsize = MLX4_EN_TX_MAX_MBUF_SIZE; dev->if_capenable = dev->if_capabilities; @@ -2126,6 +2188,8 @@ int mlx4_en_init_netdev(struct mlx4_en_d dev->if_hwassist |= CSUM_TSO; if (dev->if_capenable & IFCAP_TXCSUM) dev->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); + if (dev->if_capenable & IFCAP_TXCSUM_IPV6) + dev->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); /* Register for VLAN events */ @@ -2188,8 +2252,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) queue_delayed_work(mdev->workqueue, &priv->service_task, SERVICE_TASK_DELAY); - - return 0; out: @@ -2271,6 +2333,162 @@ static int mlx4_en_set_tx_ring_size(SYSC return (error); } +static int mlx4_en_get_module_info(struct net_device *dev, + struct ethtool_modinfo *modinfo) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + int ret; + u8 data[4]; + + /* Read first 2 bytes to get Module & REV ID */ + ret = mlx4_get_module_info(mdev->dev, priv->port, + 0/*offset*/, 2/*size*/, data); + + if (ret < 2) { + en_err(priv, "Failed to read eeprom module first two bytes, error: 0x%x\n", -ret); + return -EIO; + } + + switch (data[0] /* identifier */) { + case MLX4_MODULE_ID_QSFP: + modinfo->type = ETH_MODULE_SFF_8436; + modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; + break; + case MLX4_MODULE_ID_QSFP_PLUS: + if (data[1] >= 0x3) { /* revision id */ + modinfo->type = ETH_MODULE_SFF_8636; + modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; + } else { + modinfo->type = ETH_MODULE_SFF_8436; + modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; + } + break; + case MLX4_MODULE_ID_QSFP28: + modinfo->type = ETH_MODULE_SFF_8636; + modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; + break; + case MLX4_MODULE_ID_SFP: + modinfo->type = ETH_MODULE_SFF_8472; + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; + break; + default: + en_err(priv, "mlx4_en_get_module_info : Not recognized cable type\n"); + return -EINVAL; + } + + return 0; +} + +static int mlx4_en_get_module_eeprom(struct net_device *dev, + struct ethtool_eeprom *ee, + u8 *data) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + int offset = ee->offset; + int i = 0, ret; + + if (ee->len == 0) + return -EINVAL; + + memset(data, 0, ee->len); + + while (i < ee->len) { + en_dbg(DRV, priv, + "mlx4_get_module_info i(%d) offset(%d) len(%d)\n", + i, offset, ee->len - i); + + ret = mlx4_get_module_info(mdev->dev, priv->port, + offset, ee->len - i, data + i); + + if (!ret) /* Done reading */ + return 0; + + if (ret < 0) { + en_err(priv, + "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n", + i, offset, ee->len - i, ret); + return -1; + } + + i += ret; + offset += ret; + } + return 0; +} + +static void mlx4_en_print_eeprom(u8 *data, __u32 len) +{ + int i; + int j = 0; + int row = 0; + const int NUM_OF_BYTES = 16; + + printf("\nOffset\t\tValues\n"); + printf("------\t\t------\n"); + while(row < len){ + printf("0x%04x\t\t",row); + for(i=0; i < NUM_OF_BYTES; i++){ + printf("%02x ", data[j]); + row++; + j++; + } + printf("\n"); + } +} + +/* Read cable EEPROM module information by first inspecting the first + * two bytes to get the length and then read the rest of the information. + * The information is printed to dmesg. */ +static int mlx4_en_read_eeprom(SYSCTL_HANDLER_ARGS) +{ + + u8* data; + int error; + int result = 0; + struct mlx4_en_priv *priv; + struct net_device *dev; + struct ethtool_modinfo modinfo; + struct ethtool_eeprom ee; + + error = sysctl_handle_int(oidp, &result, 0, req); + if (error || !req->newptr) + return (error); + + if (result == 1) { + priv = arg1; + dev = priv->dev; + data = kmalloc(PAGE_SIZE, GFP_KERNEL); + + error = mlx4_en_get_module_info(dev, &modinfo); + if (error) { + en_err(priv, + "mlx4_en_get_module_info returned with error - FAILED (0x%x)\n", + -error); + goto out; + } + + ee.len = modinfo.eeprom_len; + ee.offset = 0; + + error = mlx4_en_get_module_eeprom(dev, &ee, data); + if (error) { + en_err(priv, + "mlx4_en_get_module_eeprom returned with error - FAILED (0x%x)\n", + -error); + /* Continue printing partial information in case of an error */ + } + + /* EEPROM information will be printed in dmesg */ + mlx4_en_print_eeprom(data, ee.len); +out: + kfree(data); + } + /* Return zero to prevent sysctl failure. */ + return (0); +} + static int mlx4_en_set_tx_ppp(SYSCTL_HANDLER_ARGS) { struct mlx4_en_priv *priv; @@ -2396,7 +2614,7 @@ static void mlx4_en_sysctl_conf(struct m /* Add coalescer configuration. */ coal = SYSCTL_ADD_NODE(ctx, node_list, OID_AUTO, "coalesce", CTLFLAG_RD, NULL, "Interrupt coalesce configuration"); - coal_list = SYSCTL_CHILDREN(node); + coal_list = SYSCTL_CHILDREN(coal); SYSCTL_ADD_UINT(ctx, coal_list, OID_AUTO, "pkt_rate_low", CTLFLAG_RW, &priv->pkt_rate_low, 0, "Packets per-second for minimum delay"); @@ -2415,11 +2633,14 @@ static void mlx4_en_sysctl_conf(struct m SYSCTL_ADD_UINT(ctx, coal_list, OID_AUTO, "adaptive_rx_coal", CTLFLAG_RW, &priv->adaptive_rx_coal, 0, "Enable adaptive rx coalescing"); + /* EEPROM support */ + SYSCTL_ADD_PROC(ctx, node_list, OID_AUTO, "eeprom_info", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, + mlx4_en_read_eeprom, "I", "EEPROM information"); } static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv) { - struct net_device *dev; struct sysctl_ctx_list *ctx; struct sysctl_oid *node; struct sysctl_oid_list *node_list; @@ -2430,8 +2651,6 @@ static void mlx4_en_sysctl_stat(struct m char namebuf[128]; int i; - dev = priv->dev; - ctx = &priv->stat_ctx; sysctl_ctx_init(ctx); node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(priv->sysctl), OID_AUTO, @@ -2459,6 +2678,8 @@ static void mlx4_en_sysctl_stat(struct m &priv->port_stats.wake_queue, "Queue resumed after full"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_timeout", CTLFLAG_RD, &priv->port_stats.tx_timeout, "Transmit timeouts"); + SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_oversized_packets", CTLFLAG_RD, + &priv->port_stats.oversized_packets, "TX oversized packets, m_defrag failed"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_alloc_failed", CTLFLAG_RD, &priv->port_stats.rx_alloc_failed, "RX failed to allocate mbuf"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_chksum_good", CTLFLAG_RD, @@ -2542,7 +2763,7 @@ struct mlx4_en_pkt_stats { SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_packets", CTLFLAG_RD, &priv->pkstats.tx_packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_bytes", CTLFLAG_RD, - &priv->pkstats.tx_packets, "TX Bytes"); + &priv->pkstats.tx_bytes, "TX Bytes"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_multicast_packets", CTLFLAG_RD, &priv->pkstats.tx_multicast_packets, "TX Multicast Packets"); SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_broadcast_packets", CTLFLAG_RD, @@ -2583,8 +2804,8 @@ struct mlx4_en_pkt_stats { CTLFLAG_RD, &tx_ring->packets, "TX packets"); SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes", CTLFLAG_RD, &tx_ring->bytes, "TX bytes"); - } + for (i = 0; i < priv->rx_ring_num; i++) { rx_ring = priv->rx_ring[i]; snprintf(namebuf, sizeof(namebuf), "rx_ring%d", i); Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_port.c Fri Dec 11 16:51:04 2015 (r292114) +++ stable/9/sys/ofed/drivers/net/mlx4/en_port.c Fri Dec 11 18:28:20 2015 (r292115) @@ -194,6 +194,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_e priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum; priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped; priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue; + priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets; } /* RX Statistics */ priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) + Modified: stable/9/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Fri Dec 11 16:51:04 2015 (r292114) +++ stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Fri Dec 11 18:28:20 2015 (r292115) @@ -49,106 +49,135 @@ static void mlx4_en_init_rx_desc(struct struct mlx4_en_rx_ring *ring, int index) { - struct mlx4_en_rx_desc *rx_desc = ring->buf + ring->stride * index; + struct mlx4_en_rx_desc *rx_desc = (struct mlx4_en_rx_desc *) + (ring->buf + (ring->stride * index)); int possible_frags; int i; - /* Set size and memtype fields */ - for (i = 0; i < priv->num_frags; i++) { - rx_desc->data[i].byte_count = - cpu_to_be32(priv->frag_info[i].frag_size); - rx_desc->data[i].lkey = cpu_to_be32(priv->mdev->mr.key); - } + rx_desc->data[0].byte_count = cpu_to_be32(priv->rx_mb_size); + rx_desc->data[0].lkey = cpu_to_be32(priv->mdev->mr.key); - /* If the number of used fragments does not fill up the ring stride, - * * remaining (unused) fragments must be padded with null address/size - * * and a special memory key */ + /* + * If the number of used fragments does not fill up the ring + * stride, remaining (unused) fragments must be padded with + * null address/size and a special memory key: + */ possible_frags = (ring->stride - sizeof(struct mlx4_en_rx_desc)) / DS_SIZE; - for (i = priv->num_frags; i < possible_frags; i++) { + for (i = 1; i < possible_frags; i++) { rx_desc->data[i].byte_count = 0; rx_desc->data[i].lkey = cpu_to_be32(MLX4_EN_MEMTYPE_PAD); rx_desc->data[i].addr = 0; } - } -static int mlx4_en_alloc_buf(struct mlx4_en_priv *priv, - struct mlx4_en_rx_desc *rx_desc, - struct mbuf **mb_list, - int i) +static int +mlx4_en_alloc_buf(struct mlx4_en_rx_ring *ring, + __be64 *pdma, struct mlx4_en_rx_mbuf *mb_list) { - struct mlx4_en_dev *mdev = priv->mdev; - struct mlx4_en_frag_info *frag_info = &priv->frag_info[i]; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; struct mbuf *mb; - dma_addr_t dma; + int nsegs; + int err; - if (i == 0) - mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, frag_info->frag_size); - else - mb = m_getjcl(M_NOWAIT, MT_DATA, 0, frag_info->frag_size); - if (mb == NULL) { - priv->port_stats.rx_alloc_failed++; - return -ENOMEM; + /* try to allocate a new spare mbuf */ + if (unlikely(ring->spare.mbuf == NULL)) { + mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + if (unlikely(mb == NULL)) + return (-ENOMEM); + /* setup correct length */ + mb->m_len = ring->rx_mb_size; + + /* load spare mbuf into BUSDMA */ + err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, ring->spare.dma_map, + mb, segs, &nsegs, BUS_DMA_NOWAIT); + if (unlikely(err != 0)) { + m_freem(mb); + return (err); + } + + /* store spare info */ + ring->spare.mbuf = mb; + ring->spare.paddr_be = cpu_to_be64(segs[0].ds_addr); + + bus_dmamap_sync(ring->dma_tag, ring->spare.dma_map, + BUS_DMASYNC_PREREAD); } - dma = pci_map_single(mdev->pdev, mb->m_data, frag_info->frag_size, - PCI_DMA_FROMDEVICE); - rx_desc->data[i].addr = cpu_to_be64(dma); - mb_list[i] = mb; - return 0; -} + /* synchronize and unload the current mbuf, if any */ + if (likely(mb_list->mbuf != NULL)) { + bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->dma_tag, mb_list->dma_map); + } -static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, - struct mlx4_en_rx_ring *ring, int index) -{ - struct mlx4_en_rx_desc *rx_desc = ring->buf + (index * ring->stride); - struct mbuf **mb_list = ring->rx_info + (index << priv->log_rx_info); - int i; + mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, ring->rx_mb_size); + if (unlikely(mb == NULL)) + goto use_spare; + + /* setup correct length */ + mb->m_len = ring->rx_mb_size; + + err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, mb_list->dma_map, + mb, segs, &nsegs, BUS_DMA_NOWAIT); + if (unlikely(err != 0)) { + m_freem(mb); + goto use_spare; + } + + *pdma = cpu_to_be64(segs[0].ds_addr); + mb_list->mbuf = mb; + + bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, BUS_DMASYNC_PREREAD); + return (0); - for (i = 0; i < priv->num_frags; i++) - if (mlx4_en_alloc_buf(priv, rx_desc, mb_list, i)) - goto err; +use_spare: + /* swap DMA maps */ + map = mb_list->dma_map; + mb_list->dma_map = ring->spare.dma_map; + ring->spare.dma_map = map; - return 0; + /* swap MBUFs */ + mb_list->mbuf = ring->spare.mbuf; + ring->spare.mbuf = NULL; -err: - while (i--) - m_free(mb_list[i]); - return -ENOMEM; + /* store physical address */ + *pdma = ring->spare.paddr_be; + return (0); } -static inline void mlx4_en_update_rx_prod_db(struct mlx4_en_rx_ring *ring) +static void +mlx4_en_free_buf(struct mlx4_en_rx_ring *ring, struct mlx4_en_rx_mbuf *mb_list) { - *ring->wqres.db.db = cpu_to_be32(ring->prod & 0xffff); + bus_dmamap_t map = mb_list->dma_map; + bus_dmamap_sync(ring->dma_tag, map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->dma_tag, map); + m_freem(mb_list->mbuf); + mb_list->mbuf = NULL; /* safety clearing */ } -static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv, - struct mlx4_en_rx_ring *ring, - int index) +static int +mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, + struct mlx4_en_rx_ring *ring, int index) { - struct mlx4_en_frag_info *frag_info; - struct mlx4_en_dev *mdev = priv->mdev; - struct mbuf **mb_list; - struct mlx4_en_rx_desc *rx_desc = ring->buf + (index << ring->log_stride); - dma_addr_t dma; - int nr; - - mb_list = ring->rx_info + (index << priv->log_rx_info); - for (nr = 0; nr < priv->num_frags; nr++) { - en_dbg(DRV, priv, "Freeing fragment:%d\n", nr); - frag_info = &priv->frag_info[nr]; - dma = be64_to_cpu(rx_desc->data[nr].addr); - -#if BITS_PER_LONG == 64 - en_dbg(DRV, priv, "Unmaping buffer at dma:0x%lx\n", (u64) dma); -#elif BITS_PER_LONG == 32 - en_dbg(DRV, priv, "Unmaping buffer at dma:0x%llx\n", (u64) dma); -#endif - pci_unmap_single(mdev->pdev, dma, frag_info->frag_size, - PCI_DMA_FROMDEVICE); - m_free(mb_list[nr]); + struct mlx4_en_rx_desc *rx_desc = (struct mlx4_en_rx_desc *) + (ring->buf + (index * ring->stride)); + struct mlx4_en_rx_mbuf *mb_list = ring->mbuf + index; + + mb_list->mbuf = NULL; + + if (mlx4_en_alloc_buf(ring, &rx_desc->data[0].addr, mb_list)) { + priv->port_stats.rx_alloc_failed++; + return (-ENOMEM); } + return (0); +} + +static inline void +mlx4_en_update_rx_prod_db(struct mlx4_en_rx_ring *ring) +{ + *ring->wqres.db.db = cpu_to_be32(ring->prod & 0xffff); } static int mlx4_en_fill_rx_buffers(struct mlx4_en_priv *priv) @@ -191,7 +220,8 @@ reduce_rings: while (ring->actual_size > new_size) { ring->actual_size--; ring->prod--; - mlx4_en_free_rx_desc(priv, ring, ring->actual_size); + mlx4_en_free_buf(ring, + ring->mbuf + ring->actual_size); } } @@ -211,100 +241,106 @@ static void mlx4_en_free_rx_buf(struct m while (ring->cons != ring->prod) { index = ring->cons & ring->size_mask; en_dbg(DRV, priv, "Processing descriptor:%d\n", index); - mlx4_en_free_rx_desc(priv, ring, index); + mlx4_en_free_buf(ring, ring->mbuf + index); ++ring->cons; } } -#if MLX4_EN_MAX_RX_FRAGS == 3 -static int frag_sizes[] = { - FRAG_SZ0, - FRAG_SZ1, - FRAG_SZ2, -}; -#elif MLX4_EN_MAX_RX_FRAGS == 2 -static int frag_sizes[] = { - FRAG_SZ0, - FRAG_SZ1, -}; -#else -#error "Unknown MAX_RX_FRAGS" -#endif - void mlx4_en_calc_rx_buf(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; - int buf_size = 0; - int i, frag; - for (i = 0, frag = 0; buf_size < eff_mtu; frag++, i++) { - /* - * Allocate small to large but only as much as is needed for - * the tail. - */ - while (i > 0 && eff_mtu - buf_size <= frag_sizes[i - 1]) - i--; - priv->frag_info[frag].frag_size = frag_sizes[i]; - priv->frag_info[frag].frag_prefix_size = buf_size; - buf_size += priv->frag_info[frag].frag_size; - } + if (eff_mtu > MJUM16BYTES) { + en_err(priv, "MTU(%d) is too big\n", (int)dev->if_mtu); + eff_mtu = MJUM16BYTES; + } else if (eff_mtu > MJUM9BYTES) { + eff_mtu = MJUM16BYTES; + } else if (eff_mtu > MJUMPAGESIZE) { + eff_mtu = MJUM9BYTES; + } else if (eff_mtu > MCLBYTES) { + eff_mtu = MJUMPAGESIZE; + } else { + eff_mtu = MCLBYTES; + } - priv->num_frags = frag; priv->rx_mb_size = eff_mtu; - priv->log_rx_info = - ROUNDUP_LOG2(priv->num_frags * sizeof(struct mbuf *)); - en_dbg(DRV, priv, "Rx buffer scatter-list (effective-mtu:%d " - "num_frags:%d):\n", eff_mtu, priv->num_frags); - for (i = 0; i < priv->num_frags; i++) { - en_dbg(DRV, priv, " frag:%d - size:%d prefix:%d\n", i, - priv->frag_info[i].frag_size, - priv->frag_info[i].frag_prefix_size); - } + en_dbg(DRV, priv, "Effective RX MTU: %d bytes\n", eff_mtu); } - int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, u32 size, int node) { struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_rx_ring *ring; - int err = -ENOMEM; + int err; int tmp; + uint32_t x; ring = kzalloc(sizeof(struct mlx4_en_rx_ring), GFP_KERNEL); if (!ring) { en_err(priv, "Failed to allocate RX ring structure\n"); return -ENOMEM; } - + + /* Create DMA descriptor TAG */ + if ((err = -bus_dma_tag_create( + bus_get_dma_tag(mdev->pdev->dev.bsddev), + 1, /* any alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MJUM16BYTES, /* maxsize */ + 1, /* nsegments */ + MJUM16BYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &ring->dma_tag))) { + en_err(priv, "Failed to create DMA tag\n"); + goto err_ring; + } + ring->prod = 0; ring->cons = 0; ring->size = size; ring->size_mask = size - 1; - ring->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + - DS_SIZE * MLX4_EN_MAX_RX_FRAGS); + ring->stride = roundup_pow_of_two( + sizeof(struct mlx4_en_rx_desc) + DS_SIZE); ring->log_stride = ffs(ring->stride) - 1; ring->buf_size = ring->size * ring->stride + TXBB_SIZE; - tmp = size * roundup_pow_of_two(MLX4_EN_MAX_RX_FRAGS * - sizeof(struct mbuf *)); + tmp = size * sizeof(struct mlx4_en_rx_mbuf); - ring->rx_info = kmalloc(tmp, GFP_KERNEL); - if (!ring->rx_info) { + ring->mbuf = kzalloc(tmp, GFP_KERNEL); + if (ring->mbuf == NULL) { err = -ENOMEM; - goto err_ring; + goto err_dma_tag; } - en_dbg(DRV, priv, "Allocated rx_info ring at addr:%p size:%d\n", - ring->rx_info, tmp); + err = -bus_dmamap_create(ring->dma_tag, 0, &ring->spare.dma_map); + if (err != 0) + goto err_info; + + for (x = 0; x != size; x++) { + err = -bus_dmamap_create(ring->dma_tag, 0, + &ring->mbuf[x].dma_map); + if (err != 0) { + while (x--) + bus_dmamap_destroy(ring->dma_tag, + ring->mbuf[x].dma_map); + goto err_info; + } + } + en_dbg(DRV, priv, "Allocated MBUF ring at addr:%p size:%d\n", + ring->mbuf, tmp); err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres, ring->buf_size, 2 * PAGE_SIZE); if (err) - goto err_info; + goto err_dma_map; err = mlx4_en_map_buffer(&ring->wqres.buf); if (err) { @@ -317,23 +353,29 @@ int mlx4_en_create_rx_ring(struct mlx4_e err_hwq: mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); +err_dma_map: + for (x = 0; x != size; x++) { + bus_dmamap_destroy(ring->dma_tag, + ring->mbuf[x].dma_map); + } + bus_dmamap_destroy(ring->dma_tag, ring->spare.dma_map); err_info: - vfree(ring->rx_info); + vfree(ring->mbuf); +err_dma_tag: + bus_dma_tag_destroy(ring->dma_tag); err_ring: kfree(ring); - - return err; + return (err); } - int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) { struct mlx4_en_rx_ring *ring; int i; int ring_ind; int err; - int stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + - DS_SIZE * priv->num_frags); + int stride = roundup_pow_of_two( + sizeof(struct mlx4_en_rx_desc) + DS_SIZE); for (ring_ind = 0; ring_ind < priv->rx_ring_num; ring_ind++) { ring = priv->rx_ring[ring_ind]; @@ -409,10 +451,22 @@ void mlx4_en_destroy_rx_ring(struct mlx4 { struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_rx_ring *ring = *pring; + uint32_t x; mlx4_en_unmap_buffer(&ring->wqres.buf); mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE); - vfree(ring->rx_info); + for (x = 0; x != size; x++) + bus_dmamap_destroy(ring->dma_tag, ring->mbuf[x].dma_map); + /* free spare mbuf, if any */ + if (ring->spare.mbuf != NULL) { + bus_dmamap_sync(ring->dma_tag, ring->spare.dma_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(ring->dma_tag, ring->spare.dma_map); + m_freem(ring->spare.mbuf); + } + bus_dmamap_destroy(ring->dma_tag, ring->spare.dma_map); + vfree(ring->mbuf); + bus_dma_tag_destroy(ring->dma_tag); kfree(ring); *pring = NULL; #ifdef CONFIG_RFS_ACCEL @@ -420,7 +474,6 @@ void mlx4_en_destroy_rx_ring(struct mlx4 #endif } - void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring) { @@ -469,69 +522,27 @@ static inline int invalid_cqe(struct mlx return 0; } - -/* Unmap a completed descriptor and free unused pages */ -static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, - struct mlx4_en_rx_desc *rx_desc, - struct mbuf **mb_list, - int length) +static struct mbuf * +mlx4_en_rx_mb(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring, + struct mlx4_en_rx_desc *rx_desc, struct mlx4_en_rx_mbuf *mb_list, + int length) { - struct mlx4_en_dev *mdev = priv->mdev; - struct mlx4_en_frag_info *frag_info; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***