svn commit: r340868 - head/sys/contrib/ipfilter/netinet

2018-11-23 Thread Cy Schubert
Author: cy
Date: Sat Nov 24 07:16:44 2018
New Revision: 340868
URL: https://svnweb.freebsd.org/changeset/base/340868

Log:
  An OSF/1 ifdef makes absolutley no sense in a FreeBSD specific source
  file.
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sat Nov 24 06:49:41 
2018(r340867)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sat Nov 24 07:16:44 
2018(r340868)
@@ -58,9 +58,6 @@ static const char rcsid[] = "@(#)$Id$";
 #include 
 #include 
 #include 
-#if defined(__osf__)
-# include 
-#endif
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340867 - head/sys/contrib/ipfilter/netinet

2018-11-23 Thread Cy Schubert
Author: cy
Date: Sat Nov 24 06:49:41 2018
New Revision: 340867
URL: https://svnweb.freebsd.org/changeset/base/340867

Log:
  FreeBSD 7 has been history for many moons. Remove some dead code.
  
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sat Nov 24 01:25:45 
2018(r340866)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sat Nov 24 06:49:41 
2018(r340867)
@@ -57,15 +57,7 @@ static const char rcsid[] = "@(#)$Id$";
 #include 
 #include 
 #include 
-#if defined(__FreeBSD_version) && (__FreeBSD_version >= 80)
 #include 
-#else
-#define CURVNET_SET(arg)
-#define CURVNET_RESTORE()
-#defineVNET_DEFINE(_t, _v) _t _v
-#defineVNET_DECLARE(_t, _v)extern _t _v
-#defineVNET(arg)   arg
-#endif
 #if defined(__osf__)
 # include 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340866 - in head/contrib/libarchive: cpio libarchive libarchive/test tar

2018-11-23 Thread Martin Matuska
Author: mm
Date: Sat Nov 24 01:25:45 2018
New Revision: 340866
URL: https://svnweb.freebsd.org/changeset/base/340866

Log:
  MFV r340865:
  Sync libarchive with vendor.
  
  Relevant vendor changes:
PR #1080: Spelling fixes
PR #1084: RAR5 reader bugfixes
PR #1091: fix use-after-free in delayed newc link processing
PR #1092: Fix a few obvious resource leaks and strcpy() misuses
  
  MFC after:1 week

Modified:
  head/contrib/libarchive/cpio/cpio.c
  head/contrib/libarchive/libarchive/archive_acl.c
  head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c
  head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c
  head/contrib/libarchive/libarchive/archive_write_set_format_pax.c
  head/contrib/libarchive/libarchive/archive_write_set_format_xar.c
  head/contrib/libarchive/libarchive/test/test_fuzz.c
  head/contrib/libarchive/libarchive/test/test_read_format_rar5.c
  head/contrib/libarchive/libarchive/test/test_write_disk_perms.c
  head/contrib/libarchive/tar/write.c
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/cpio/cpio.c
==
--- head/contrib/libarchive/cpio/cpio.c Sat Nov 24 01:15:08 2018
(r340865)
+++ head/contrib/libarchive/cpio/cpio.c Sat Nov 24 01:25:45 2018
(r340866)
@@ -755,8 +755,10 @@ file_to_archive(struct cpio *cpio, const char *srcpath
}
if (cpio->option_rename)
destpath = cpio_rename(destpath);
-   if (destpath == NULL)
+   if (destpath == NULL) {
+   archive_entry_free(entry);
return (0);
+   }
archive_entry_copy_pathname(entry, destpath);
 
/*

Modified: head/contrib/libarchive/libarchive/archive_acl.c
==
--- head/contrib/libarchive/libarchive/archive_acl.cSat Nov 24 01:15:08 
2018(r340865)
+++ head/contrib/libarchive/libarchive/archive_acl.cSat Nov 24 01:25:45 
2018(r340866)
@@ -753,8 +753,10 @@ archive_acl_to_text_w(struct archive_acl *acl, ssize_t
append_entry_w(, prefix, ap->type, ap->tag, flags,
wname, ap->permset, id);
count++;
-   } else if (r < 0 && errno == ENOMEM)
+   } else if (r < 0 && errno == ENOMEM) {
+   free(ws);
return (NULL);
+   }
}
 
/* Add terminating character */
@@ -975,8 +977,10 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t
prefix = NULL;
r = archive_mstring_get_mbs_l(
>name, , , sc);
-   if (r != 0)
+   if (r != 0) {
+   free(s);
return (NULL);
+   }
if (count > 0)
*p++ = separator;
if (name == NULL ||

Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c
==
--- head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c   
Sat Nov 24 01:15:08 2018(r340865)
+++ head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c   
Sat Nov 24 01:25:45 2018(r340866)
@@ -88,6 +88,7 @@ struct file_header {
 
 uint8_t solid : 1;   /* Is this a solid stream? */
 uint8_t service : 1; /* Is this file a service data? */
+uint8_t eof : 1; /* Did we finish unpacking the file? */
 
 /* Optional time fields. */
 uint64_t e_mtime;
@@ -176,7 +177,7 @@ struct comp_state {
 decompression. */
 uint8_t* filtered_buf;   /* Buffer used when applying filters. */
 const uint8_t* block_buf;/* Buffer used when merging blocks. */
-size_t window_mask;  /* Convinience field; window_size - 1. */
+size_t window_mask;  /* Convenience field; window_size - 1. */
 int64_t write_ptr;   /* This amount of data has been unpacked in
 the window buffer. */
 int64_t last_write_ptr;  /* This amount of data has been stored in
@@ -279,7 +280,7 @@ struct rar5 {
 int skip_mode;
 
 /* An offset to QuickOpen list. This is not supported by this unpacker,
- * becuase we're focusing on streaming interface. QuickOpen is designed
+ * because we're focusing on streaming interface. QuickOpen is designed
  * to make things quicker for non-stream interfaces, so it's not our
  * use case. */
 uint64_t qlist_offset;
@@ -387,7 +388,7 @@ static void cdeque_pop_front_fast(struct cdeque* d, vo
 d->size--;
 }
 
-/* Pops a front element of this cicrular deque object and 

svn commit: r340865 - in vendor/libarchive/dist: build/cmake cpio libarchive libarchive/test tar

2018-11-23 Thread Martin Matuska
Author: mm
Date: Sat Nov 24 01:15:08 2018
New Revision: 340865
URL: https://svnweb.freebsd.org/changeset/base/340865

Log:
  Update vendor/libarchive/dist to git 0e416f2fe757ad6841dbb3386a17d88b5c9f5533
  Relevant vendor changes:
PR #1080: Spelling fixes
PR #1084: RAR5 reader bugfixes
PR #1091: fix use-after-free in delayed newc link processing
PR #1092: Fix a few obvious resource leaks and strcpy() misuses

Modified:
  vendor/libarchive/dist/build/cmake/config.h.in
  vendor/libarchive/dist/cpio/cpio.c
  vendor/libarchive/dist/libarchive/archive_acl.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c
  vendor/libarchive/dist/libarchive/archive_windows.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_iso9660.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_mtree.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_pax.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_xar.c
  vendor/libarchive/dist/libarchive/test/test_fuzz.c
  vendor/libarchive/dist/libarchive/test/test_read_format_rar5.c
  vendor/libarchive/dist/libarchive/test/test_write_disk_perms.c
  vendor/libarchive/dist/tar/write.c

Modified: vendor/libarchive/dist/build/cmake/config.h.in
==
--- vendor/libarchive/dist/build/cmake/config.h.in  Fri Nov 23 23:33:55 
2018(r340864)
+++ vendor/libarchive/dist/build/cmake/config.h.in  Sat Nov 24 01:15:08 
2018(r340865)
@@ -680,6 +680,12 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the `bz2' library (-lbz2). */
 #cmakedefine HAVE_LIBBZ2 1
 
+/* Define to 1 if you have the `b2' library (-lb2). */
+#cmakedefine HAVE_LIBB2 1
+
+/* Define to 1 if you have the  header file. */
+#cmakedefine HAVE_BLAKE2_H 1
+
 /* Define to 1 if you have the `charset' library (-lcharset). */
 #cmakedefine HAVE_LIBCHARSET 1
 

Modified: vendor/libarchive/dist/cpio/cpio.c
==
--- vendor/libarchive/dist/cpio/cpio.c  Fri Nov 23 23:33:55 2018
(r340864)
+++ vendor/libarchive/dist/cpio/cpio.c  Sat Nov 24 01:15:08 2018
(r340865)
@@ -755,8 +755,10 @@ file_to_archive(struct cpio *cpio, const char *srcpath
}
if (cpio->option_rename)
destpath = cpio_rename(destpath);
-   if (destpath == NULL)
+   if (destpath == NULL) {
+   archive_entry_free(entry);
return (0);
+   }
archive_entry_copy_pathname(entry, destpath);
 
/*

Modified: vendor/libarchive/dist/libarchive/archive_acl.c
==
--- vendor/libarchive/dist/libarchive/archive_acl.c Fri Nov 23 23:33:55 
2018(r340864)
+++ vendor/libarchive/dist/libarchive/archive_acl.c Sat Nov 24 01:15:08 
2018(r340865)
@@ -753,8 +753,10 @@ archive_acl_to_text_w(struct archive_acl *acl, ssize_t
append_entry_w(, prefix, ap->type, ap->tag, flags,
wname, ap->permset, id);
count++;
-   } else if (r < 0 && errno == ENOMEM)
+   } else if (r < 0 && errno == ENOMEM) {
+   free(ws);
return (NULL);
+   }
}
 
/* Add terminating character */
@@ -975,8 +977,10 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t
prefix = NULL;
r = archive_mstring_get_mbs_l(
>name, , , sc);
-   if (r != 0)
+   if (r != 0) {
+   free(s);
return (NULL);
+   }
if (count > 0)
*p++ = separator;
if (name == NULL ||

Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c
==
--- vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c
Fri Nov 23 23:33:55 2018(r340864)
+++ vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c
Sat Nov 24 01:15:08 2018(r340865)
@@ -88,6 +88,7 @@ struct file_header {
 
 uint8_t solid : 1;   /* Is this a solid stream? */
 uint8_t service : 1; /* Is this file a service data? */
+uint8_t eof : 1; /* Did we finish unpacking the file? */
 
 /* Optional time fields. */
 uint64_t e_mtime;
@@ -176,7 +177,7 @@ struct comp_state {
 decompression. */
 uint8_t* filtered_buf;   /* Buffer used when applying filters. */
 const uint8_t* block_buf;/* Buffer used when merging blocks. */
-size_t window_mask;  /* Convinience field; window_size - 1. */
+size_t window_mask;  /* Convenience field; window_size - 1. */
 int64_t 

svn commit: r340864 - head/sys/kern

2018-11-23 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 23 23:33:55 2018
New Revision: 340864
URL: https://svnweb.freebsd.org/changeset/base/340864

Log:
  Parse FreeBSD Feature Control note on the ELF image activation.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Fri Nov 23 23:29:14 2018(r340863)
+++ head/sys/kern/imgact_elf.c  Fri Nov 23 23:33:55 2018(r340864)
@@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
 
 static int __elfN(check_header)(const Elf_Ehdr *hdr);
 static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp,
-const char *interp, int interp_name_len, int32_t *osrel);
+const char *interp, int interp_name_len, int32_t *osrel, uint32_t *fctl0);
 static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
 u_long *entry, size_t pagesize);
 static int __elfN(load_section)(struct image_params *imgp, vm_ooffset_t offset,
@@ -99,7 +99,7 @@ static bool __elfN(freebsd_trans_osrel)(const Elf_Note
 int32_t *osrel);
 static bool kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static boolean_t __elfN(check_note)(struct image_params *imgp,
-Elf_Brandnote *checknote, int32_t *osrel);
+Elf_Brandnote *checknote, int32_t *osrel, uint32_t *fctl0);
 static vm_prot_t __elfN(trans_prot)(Elf_Word);
 static Elf_Word __elfN(untrans_prot)(vm_prot_t);
 
@@ -256,7 +256,7 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry)
 
 static Elf_Brandinfo *
 __elfN(get_brandinfo)(struct image_params *imgp, const char *interp,
-int interp_name_len, int32_t *osrel)
+int interp_name_len, int32_t *osrel, uint32_t *fctl0)
 {
const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
Elf_Brandinfo *bi, *bi_m;
@@ -280,7 +280,8 @@ __elfN(get_brandinfo)(struct image_params *imgp, const
continue;
if (hdr->e_machine == bi->machine && (bi->flags &
(BI_BRAND_NOTE|BI_BRAND_NOTE_MANDATORY)) != 0) {
-   ret = __elfN(check_note)(imgp, bi->brand_note, osrel);
+   ret = __elfN(check_note)(imgp, bi->brand_note, osrel,
+   fctl0);
/* Give brand a chance to veto check_note's guess */
if (ret && bi->header_supported)
ret = bi->header_supported(imgp);
@@ -789,6 +790,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
vm_prot_t prot;
u_long text_size, data_size, total_size, text_addr, data_addr;
u_long seg_size, seg_addr, addr, baddr, et_dyn_addr, entry, proghdr;
+   uint32_t fctl0;
int32_t osrel;
int error, i, n, interp_name_len, have_interp;
 
@@ -824,6 +826,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
n = error = 0;
baddr = 0;
osrel = 0;
+   fctl0 = 0;
text_size = data_size = total_size = text_addr = data_addr = 0;
entry = proghdr = 0;
interp_name_len = 0;
@@ -889,7 +892,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
}
 
brand_info = __elfN(get_brandinfo)(imgp, interp, interp_name_len,
-   );
+   , );
if (brand_info == NULL) {
uprintf("ELF binary type \"%u\" not known.\n",
hdr->e_ident[EI_OSABI]);
@@ -1092,6 +1095,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
imgp->interpreted = 0;
imgp->reloc_base = addr;
imgp->proc->p_osrel = osrel;
+   imgp->proc->p_fctl0 = fctl0;
imgp->proc->p_elf_machine = hdr->e_machine;
imgp->proc->p_elf_flags = hdr->e_flags;
 
@@ -2428,29 +2432,64 @@ brandnote_cb(const Elf_Note *note, void *arg0, boolean
return (TRUE);
 }
 
+static Elf_Note fctl_note = {
+   .n_namesz = sizeof(FREEBSD_ABI_VENDOR),
+   .n_descsz = sizeof(uint32_t),
+   .n_type = NT_FREEBSD_FEATURE_CTL,
+};
+
+struct fctl_cb_arg {
+   uint32_t *fctl0;
+};
+
+static boolean_t
+note_fctl_cb(const Elf_Note *note, void *arg0, boolean_t *res)
+{
+   struct fctl_cb_arg *arg;
+   const Elf32_Word *desc;
+   uintptr_t p;
+
+   arg = arg0;
+   p = (uintptr_t)(note + 1);
+   p += roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE);
+   desc = (const Elf32_Word *)p;
+   *arg->fctl0 = desc[0];
+   return (TRUE);
+}
+
 /*
- * Try to find the appropriate ABI-note section for checknote,
- * fetch the osreldate for binary from the ELF OSABI-note. Only the
- * first page of the image is searched, the same as for headers.
+ * Try to find the appropriate ABI-note section for checknote, fetch
+ * the osreldate and feature control flags for binary from the ELF
+ * OSABI-note.  Only the first page of the image is searched, the same
+ * as for headers.
  */
 static boolean_t
 __elfN(check_note)(struct 

svn commit: r340863 - head/sys/kern

2018-11-23 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 23 23:29:14 2018
New Revision: 340863
URL: https://svnweb.freebsd.org/changeset/base/340863

Log:
  Generalize ELF parse_notes().
  
  Remove the knowledge of the ABI note type and brandnote from it,
  instead provide it with a callback to do note-specific matching and
  data fetching.  Implement callback to match against ELF brand.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Fri Nov 23 23:16:01 2018(r340862)
+++ head/sys/kern/imgact_elf.c  Fri Nov 23 23:29:14 2018(r340863)
@@ -2341,8 +2341,9 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb,
 }
 
 static boolean_t
-__elfN(parse_notes)(struct image_params *imgp, Elf_Brandnote *checknote,
-int32_t *osrel, const Elf_Phdr *pnote)
+__elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote,
+const char *note_vendor, const Elf_Phdr *pnote,
+boolean_t (*cb)(const Elf_Note *, void *, boolean_t *), void *cb_arg)
 {
const Elf_Note *note, *note0, *note_end;
const char *note_name;
@@ -2380,27 +2381,18 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra
(const char *)note < sizeof(Elf_Note)) {
goto retf;
}
-   if (note->n_namesz != checknote->hdr.n_namesz ||
-   note->n_descsz != checknote->hdr.n_descsz ||
-   note->n_type != checknote->hdr.n_type)
+   if (note->n_namesz != checknote->n_namesz ||
+   note->n_descsz != checknote->n_descsz ||
+   note->n_type != checknote->n_type)
goto nextnote;
note_name = (const char *)(note + 1);
-   if (note_name + checknote->hdr.n_namesz >=
-   (const char *)note_end || strncmp(checknote->vendor,
-   note_name, checknote->hdr.n_namesz) != 0)
+   if (note_name + checknote->n_namesz >=
+   (const char *)note_end || strncmp(note_vendor,
+   note_name, checknote->n_namesz) != 0)
goto nextnote;
 
-   /*
-* Fetch the osreldate for binary
-* from the ELF OSABI-note if necessary.
-*/
-   if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 &&
-   checknote->trans_osrel != NULL) {
-   res = checknote->trans_osrel(note, osrel);
+   if (cb(note, cb_arg, ))
goto ret;
-   }
-   res = TRUE;
-   goto ret;
 nextnote:
note = (const Elf_Note *)((const char *)(note + 1) +
roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) +
@@ -2413,26 +2405,54 @@ ret:
return (res);
 }
 
+struct brandnote_cb_arg {
+   Elf_Brandnote *brandnote;
+   int32_t *osrel;
+};
+
+static boolean_t
+brandnote_cb(const Elf_Note *note, void *arg0, boolean_t *res)
+{
+   struct brandnote_cb_arg *arg;
+
+   arg = arg0;
+
+   /*
+* Fetch the osreldate for binary from the ELF OSABI-note if
+* necessary.
+*/
+   *res = (arg->brandnote->flags & BN_TRANSLATE_OSREL) != 0 &&
+   arg->brandnote->trans_osrel != NULL ?
+   arg->brandnote->trans_osrel(note, arg->osrel) : TRUE;
+
+   return (TRUE);
+}
+
 /*
  * Try to find the appropriate ABI-note section for checknote,
  * fetch the osreldate for binary from the ELF OSABI-note. Only the
  * first page of the image is searched, the same as for headers.
  */
 static boolean_t
-__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote,
+__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *brandnote,
 int32_t *osrel)
 {
const Elf_Phdr *phdr;
const Elf_Ehdr *hdr;
+   struct brandnote_cb_arg b_arg;
int i;
 
hdr = (const Elf_Ehdr *)imgp->image_header;
phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff);
+   b_arg.brandnote = brandnote;
+   b_arg.osrel = osrel;
 
for (i = 0; i < hdr->e_phnum; i++) {
-   if (phdr[i].p_type == PT_NOTE &&
-   __elfN(parse_notes)(imgp, checknote, osrel, [i]))
+   if (phdr[i].p_type == PT_NOTE && __elfN(parse_notes)(imgp,
+   >hdr, brandnote->vendor, [i], brandnote_cb,
+   _arg)) {
return (TRUE);
+   }
}
return (FALSE);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340862 - head/sys/kern

2018-11-23 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 23 23:16:01 2018
New Revision: 340862
URL: https://svnweb.freebsd.org/changeset/base/340862

Log:
  Trivial reduction of the code duplication, reuse the return FALSE code.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Fri Nov 23 23:10:03 2018(r340861)
+++ head/sys/kern/imgact_elf.c  Fri Nov 23 23:16:01 2018(r340862)
@@ -2364,8 +2364,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra
curthread->td_ucred, NOCRED, NULL, curthread);
if (error != 0) {
uprintf("i/o error PT_NOTE\n");
-   res = FALSE;
-   goto ret;
+   goto retf;
}
note = note0 = (const Elf_Note *)buf;
note_end = (const Elf_Note *)(buf + pnote->p_filesz);
@@ -2379,8 +2378,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Bra
for (i = 0; i < 100 && note >= note0 && note < note_end; i++) {
if (!aligned(note, Elf32_Addr) || (const char *)note_end -
(const char *)note < sizeof(Elf_Note)) {
-   res = FALSE;
-   goto ret;
+   goto retf;
}
if (note->n_namesz != checknote->hdr.n_namesz ||
note->n_descsz != checknote->hdr.n_descsz ||
@@ -2408,6 +2406,7 @@ nextnote:
roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE) +
roundup2(note->n_descsz, ELF_NOTE_ROUNDSIZE));
}
+retf:
res = FALSE;
 ret:
free(buf, M_TEMP);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340861 - head/sys/kern

2018-11-23 Thread Mark Johnston
Author: markj
Date: Fri Nov 23 23:10:03 2018
New Revision: 340861
URL: https://svnweb.freebsd.org/changeset/base/340861

Log:
  Honour the waitok parameter in kevent_expand().
  
  Reviewed by:  kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D18316

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Fri Nov 23 23:07:57 2018(r340860)
+++ head/sys/kern/kern_event.c  Fri Nov 23 23:10:03 2018(r340861)
@@ -1686,10 +1686,6 @@ kqueue_schedtask(struct kqueue *kq)
  * Expand the kq to make sure we have storage for fops/ident pair.
  *
  * Return 0 on success (or no work necessary), return errno on failure.
- *
- * Not calling hashinit w/ waitok (proper malloc flag) should be safe.
- * If kqueue_register is called from a non-fd context, there usually/should
- * be no locks held.
  */
 static int
 kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
@@ -1734,8 +1730,9 @@ kqueue_expand(struct kqueue *kq, struct filterops *fop
}
} else {
if (kq->kq_knhashmask == 0) {
-   tmp_knhash = hashinit(KN_HASHSIZE, M_KQUEUE,
-   _knhashmask);
+   tmp_knhash = hashinit_flags(KN_HASHSIZE, M_KQUEUE,
+   _knhashmask,
+   waitok ? HASH_WAITOK : HASH_NOWAIT);
if (tmp_knhash == NULL)
return ENOMEM;
KQ_LOCK(kq);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340859 - head/sys/fs/nandfs

2018-11-23 Thread Mark Johnston
Author: markj
Date: Fri Nov 23 23:07:49 2018
New Revision: 340859
URL: https://svnweb.freebsd.org/changeset/base/340859

Log:
  Ensure the dirent remains initialized when dirent.d_fileno is unset.
  
  Reported by:  rmacklem
  MFC with: r340856
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/fs/nandfs/nandfs_vnops.c

Modified: head/sys/fs/nandfs/nandfs_vnops.c
==
--- head/sys/fs/nandfs/nandfs_vnops.c   Fri Nov 23 22:37:35 2018
(r340858)
+++ head/sys/fs/nandfs/nandfs_vnops.c   Fri Nov 23 23:07:49 2018
(r340859)
@@ -1226,6 +1226,7 @@ nandfs_readdir(struct vop_readdir_args *ap)
ndirent = (struct nandfs_dir_entry *)pos;
 
name_len = ndirent->name_len;
+   memset(, 0, sizeof(dirent));
dirent.d_fileno = ndirent->inode;
if (dirent.d_fileno) {
dirent.d_type = ndirent->file_type;
@@ -1243,7 +1244,7 @@ nandfs_readdir(struct vop_readdir_args *ap)
 * If there isn't enough space in the uio to return a
 * whole dirent, break off read
 */
-   if (uio->uio_resid < dirent.d_reclen)
+   if (uio->uio_resid < GENERIC_DIRSIZ())
break;
 
/* Transfer */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340860 - in head/sys: kern sys

2018-11-23 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 23 23:07:57 2018
New Revision: 340860
URL: https://svnweb.freebsd.org/changeset/base/340860

Log:
  Provide storage for the process feature control flags in struct proc.
  
  The flags are cleared on exec, it is up to the image activator to set
  them.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Fri Nov 23 23:07:49 2018(r340859)
+++ head/sys/kern/kern_exec.c   Fri Nov 23 23:07:57 2018(r340860)
@@ -488,6 +488,7 @@ interpret:
goto exec_fail_dealloc;
 
imgp->proc->p_osrel = 0;
+   imgp->proc->p_fctl0 = 0;
 
/*
 * Implement image setuid/setgid.

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Fri Nov 23 23:07:49 2018(r340859)
+++ head/sys/kern/kern_thread.c Fri Nov 23 23:07:57 2018(r340860)
@@ -92,9 +92,9 @@ _Static_assert(offsetof(struct proc, p_pid) == 0xbc,
 "struct proc KBI p_pid");
 _Static_assert(offsetof(struct proc, p_filemon) == 0x3d0,
 "struct proc KBI p_filemon");
-_Static_assert(offsetof(struct proc, p_comm) == 0x3e4,
+_Static_assert(offsetof(struct proc, p_comm) == 0x3e8,
 "struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x4b8,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x4c0,
 "struct proc KBI p_emuldata");
 #endif
 #ifdef __i386__
@@ -112,9 +112,9 @@ _Static_assert(offsetof(struct proc, p_pid) == 0x74,
 "struct proc KBI p_pid");
 _Static_assert(offsetof(struct proc, p_filemon) == 0x27c,
 "struct proc KBI p_filemon");
-_Static_assert(offsetof(struct proc, p_comm) == 0x28c,
+_Static_assert(offsetof(struct proc, p_comm) == 0x290,
 "struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x318,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x31c,
 "struct proc KBI p_emuldata");
 #endif
 

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Fri Nov 23 23:07:49 2018(r340859)
+++ head/sys/sys/proc.h Fri Nov 23 23:07:57 2018(r340860)
@@ -642,6 +642,7 @@ struct proc {
u_int   p_magic;/* (b) Magic number. */
int p_osrel;/* (x) osreldate for the
   binary (from ELF note, if any) */
+   uint32_tp_fctl0;/* (x) ABI feature control, ELF note */
charp_comm[MAXCOMLEN + 1];  /* (x) Process name. */
struct sysentvec *p_sysent; /* (b) Syscall dispatch info. */
struct pargs*p_args;/* (c) Process arguments. */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340857 - head/stand/common

2018-11-23 Thread Maxim Sobolev
Author: sobomax
Date: Fri Nov 23 22:36:56 2018
New Revision: 340857
URL: https://svnweb.freebsd.org/changeset/base/340857

Log:
  Nuke out buffer overflow safety marker code, it duplicates similar code in
  the malloc()/free() as well as having potential of softening the handling
  in case error is detected down to a mere warning as compared to hard panic
  in free().
  
  Submitted by: tsoome
  Differential Revision:https://reviews.freebsd.org/D18299

Modified:
  head/stand/common/bcache.c

Modified: head/stand/common/bcache.c
==
--- head/stand/common/bcache.c  Fri Nov 23 22:24:59 2018(r340856)
+++ head/stand/common/bcache.c  Fri Nov 23 22:36:56 2018(r340857)
@@ -86,7 +86,6 @@ static u_int bcache_rablks;
((bc)->bcache_ctl[BHASH((bc), (blkno))].bc_blkno != (blkno))
 #defineBCACHE_READAHEAD256
 #defineBCACHE_MINREADAHEAD 32
-#defineBCACHE_MARKER   0xdeadbeef
 
 static voidbcache_invalidate(struct bcache *bc, daddr_t blkno);
 static voidbcache_insert(struct bcache *bc, daddr_t blkno);
@@ -123,7 +122,6 @@ bcache_allocate(void)
 u_int i;
 struct bcache *bc = malloc(sizeof (struct bcache));
 int disks = bcache_numdev;
-uint32_t *marker;
 
 if (disks == 0)
disks = 1;  /* safe guard */
@@ -142,8 +140,7 @@ bcache_allocate(void)
 
 bc->bcache_nblks = bcache_total_nblks >> i;
 bcache_unit_nblks = bc->bcache_nblks;
-bc->bcache_data = malloc(bc->bcache_nblks * bcache_blksize +
-   sizeof(uint32_t));
+bc->bcache_data = malloc(bc->bcache_nblks * bcache_blksize);
 if (bc->bcache_data == NULL) {
/* dont error out yet. fall back to 32 blocks and try again */
bc->bcache_nblks = 32;
@@ -158,9 +155,6 @@ bcache_allocate(void)
errno = ENOMEM;
return (NULL);
 }
-/* Insert cache end marker. */
-marker = (uint32_t *)(bc->bcache_data + bc->bcache_nblks * bcache_blksize);
-*marker = BCACHE_MARKER;
 
 /* Flush the cache */
 for (i = 0; i < bc->bcache_nblks; i++) {
@@ -222,15 +216,12 @@ read_strategy(void *devdata, int rw, daddr_t blk, size
 intresult;
 daddr_tp_blk;
 caddr_tp_buf;
-uint32_t   *marker;
 
 if (bc == NULL) {
errno = ENODEV;
return (-1);
 }
 
-marker = (uint32_t *)(bc->bcache_data + bc->bcache_nblks * bcache_blksize);
-
 if (rsize != NULL)
*rsize = 0;
 
@@ -348,12 +339,6 @@ read_strategy(void *devdata, int rw, daddr_t blk, size
 if (size != 0) {
bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size);
result = 0;
-}
-
-if (*marker != BCACHE_MARKER) {
-   printf("BUG: bcache corruption detected: nblks: %zu p_blk: %lu, "
-   "p_size: %zu, ra: %zu\n", bc->bcache_nblks,
-   (long unsigned)BHASH(bc, p_blk), p_size, ra);
 }
 
  done:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340858 - head/libexec/rtld-elf

2018-11-23 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 23 22:37:35 2018
New Revision: 340858
URL: https://svnweb.freebsd.org/changeset/base/340858

Log:
  rtld: parse FreeBSD Feature Control note on the object load.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cFri Nov 23 22:36:56 2018
(r340857)
+++ head/libexec/rtld-elf/rtld.cFri Nov 23 22:37:35 2018
(r340858)
@@ -1477,6 +1477,7 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_
note->n_descsz != sizeof(int32_t))
continue;
if (note->n_type != NT_FREEBSD_ABI_TAG &&
+   note->n_type != NT_FREEBSD_FEATURE_CTL &&
note->n_type != NT_FREEBSD_NOINIT_TAG)
continue;
note_name = (const char *)(note + 1);
@@ -1490,6 +1491,13 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_
p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
obj->osrel = *(const int32_t *)(p);
dbg("note osrel %d", obj->osrel);
+   break;
+   case NT_FREEBSD_FEATURE_CTL:
+   /* FreeBSD ABI feature control note */
+   p = (uintptr_t)(note + 1);
+   p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+   obj->fctl0 = *(const uint32_t *)(p);
+   dbg("note fctl0 %#x", obj->fctl0);
break;
case NT_FREEBSD_NOINIT_TAG:
/* FreeBSD 'crt does not call init' note */

Modified: head/libexec/rtld-elf/rtld.h
==
--- head/libexec/rtld-elf/rtld.hFri Nov 23 22:36:56 2018
(r340857)
+++ head/libexec/rtld-elf/rtld.hFri Nov 23 22:37:35 2018
(r340858)
@@ -235,6 +235,7 @@ typedef struct Struct_Obj_Entry {
 int fini_array_num;/* Number of entries in fini_array */
 
 int32_t osrel; /* OSREL note value */
+uint32_t fctl0;/* FEATURE_CONTROL note desc[0] value */
 
 bool mainprog : 1; /* True if this is the main program */
 bool rtld : 1; /* True if this is the dynamic linker */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340856 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/autofs fs/cd9660 fs/devfs fs/ext2fs fs/fdescfs fs/fuse fs/msdosfs fs/nandfs fs/pseudofs fs/smbfs fs/tmpfs fs/udf ker...

2018-11-23 Thread Mark Johnston
Author: markj
Date: Fri Nov 23 22:24:59 2018
New Revision: 340856
URL: https://svnweb.freebsd.org/changeset/base/340856

Log:
  Ensure that directory entry padding bytes are zeroed.
  
  Directory entries must be padded to maintain alignment; in many
  filesystems the padding was not initialized, resulting in stack
  memory being copied out to userspace.  With the ino64 work there
  are also some explicit pad fields in struct dirent.  Add a subroutine
  to clear these bytes and use it in the in-tree filesystems.  The
  NFS client is omitted for now as it was fixed separately in r340787.
  
  Reported by:  Thomas Barabosch, Fraunhofer FKIE
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/fs/autofs/autofs_vnops.c
  head/sys/fs/cd9660/cd9660_vnops.c
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/fdescfs/fdesc_vnops.c
  head/sys/fs/fuse/fuse_internal.c
  head/sys/fs/msdosfs/msdosfs_vnops.c
  head/sys/fs/nandfs/nandfs_vnops.c
  head/sys/fs/pseudofs/pseudofs_vnops.c
  head/sys/fs/smbfs/smbfs_io.c
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vfsops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/fs/udf/udf_vnops.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/vfs_export.c
  head/sys/sys/dirent.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cFri Nov 
23 21:08:11 2018(r340855)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cFri Nov 
23 22:24:59 2018(r340856)
@@ -262,9 +262,9 @@ sfs_readdir_common(uint64_t parent_id, uint64_t id, st
entry.d_fileno = id;
entry.d_type = DT_DIR;
entry.d_name[0] = '.';
-   entry.d_name[1] = '\0';
entry.d_namlen = 1;
entry.d_reclen = sizeof(entry);
+   dirent_terminate();
error = vfs_read_dirent(ap, , uio->uio_offset);
if (error != 0)
return (SET_ERROR(error));
@@ -277,9 +277,9 @@ sfs_readdir_common(uint64_t parent_id, uint64_t id, st
entry.d_type = DT_DIR;
entry.d_name[0] = '.';
entry.d_name[1] = '.';
-   entry.d_name[2] = '\0';
entry.d_namlen = 2;
entry.d_reclen = sizeof(entry);
+   dirent_terminate();
error = vfs_read_dirent(ap, , uio->uio_offset);
if (error != 0)
return (SET_ERROR(error));
@@ -694,6 +694,7 @@ zfsctl_root_readdir(ap)
strcpy(entry.d_name, node->snapdir->sn_name);
entry.d_namlen = strlen(entry.d_name);
entry.d_reclen = sizeof(entry);
+   dirent_terminate();
error = vfs_read_dirent(ap, , uio->uio_offset);
if (error != 0) {
if (error == ENAMETOOLONG)
@@ -1099,6 +1100,7 @@ zfsctl_snapdir_readdir(ap)
entry.d_reclen = sizeof(entry);
/* NOTE: d_off is the offset for the *next* entry. */
entry.d_off = cookie + dots_offset;
+   dirent_terminate();
error = vfs_read_dirent(ap, , uio->uio_offset);
if (error != 0) {
if (error == ENAMETOOLONG)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Nov 
23 21:08:11 2018(r340855)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Nov 
23 22:24:59 2018(r340856)
@@ -2547,6 +2547,7 @@ zfs_readdir(vnode_t *vp, uio_t *uio, cred_t *cr, int *
next = >d_off;
(void) strlcpy(odp->d_name, zap.za_name, odp->d_namlen 
+ 1);
odp->d_type = type;
+   dirent_terminate(odp);
odp = (dirent64_t *)((intptr_t)odp + reclen);
}
outcount += reclen;

Modified: head/sys/fs/autofs/autofs_vnops.c
==
--- head/sys/fs/autofs/autofs_vnops.c   Fri Nov 23 21:08:11 2018
(r340855)
+++ head/sys/fs/autofs/autofs_vnops.c   Fri Nov 23 22:24:59 2018
(r340856)
@@ -34,6 +34,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,7 +45,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -354,14 +354,11 @@ autofs_readdir_one(struct uio *uio, const char *name, 
 size_t 

svn commit: r340855 - in releng/12.0/sys/fs: nfs nfsserver

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 21:08:11 2018
New Revision: 340855
URL: https://svnweb.freebsd.org/changeset/base/340855

Log:
  MFS12 r340849, r340850, r340851:
  
  MFC r340661 (rmacklem):
  
  r304026 added code that started statistics gathering for an operation
  before the operation number (the variable called "op") was sanity checked.
  This patch moves the code down to below the range sanity check for "op".
  
  MFC r340662 (rmacklem):
  
  nfsm_advance() would panic() when the offs argument was negative.
  The code assumed that this would indicate a corrupted mbuf chain, but
  it could simply be caused by bogus RPC message data.
  This patch replaces the panic() with a printf() plus error return.
  
  MFC r340663 (rmacklem):
  
  Improve sanity checking for the dircount hint argument to
  NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code
  checked for a zero argument, but did not check for a very large value.
  This patch clips dircount at the server's maximum data size.
  
  Approved by:  re (kib)

Modified:
  releng/12.0/sys/fs/nfs/nfs_commonsubs.c
  releng/12.0/sys/fs/nfsserver/nfs_nfsdport.c
  releng/12.0/sys/fs/nfsserver/nfs_nfsdsocket.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/fs/nfs/nfs_commonsubs.c
==
--- releng/12.0/sys/fs/nfs/nfs_commonsubs.c Fri Nov 23 20:41:54 2018
(r340854)
+++ releng/12.0/sys/fs/nfs/nfs_commonsubs.c Fri Nov 23 21:08:11 2018
(r340855)
@@ -725,10 +725,14 @@ nfsm_advance(struct nfsrv_descript *nd, int offs, int 
if (offs == 0)
goto out;
/*
-* A negative offs should be considered a serious problem.
+* A negative offs might indicate a corrupted mbuf chain and,
+* as such, a printf is logged.
 */
-   if (offs < 0)
-   panic("nfsrv_advance");
+   if (offs < 0) {
+   printf("nfsrv_advance: negative offs\n");
+   error = EBADRPC;
+   goto out;
+   }
 
/*
 * If left == -1, calculate it here.

Modified: releng/12.0/sys/fs/nfsserver/nfs_nfsdport.c
==
--- releng/12.0/sys/fs/nfsserver/nfs_nfsdport.c Fri Nov 23 20:41:54 2018
(r340854)
+++ releng/12.0/sys/fs/nfsserver/nfs_nfsdport.c Fri Nov 23 21:08:11 2018
(r340855)
@@ -2107,9 +2107,15 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg
 * cookie) should be in the reply. At least one client "hints" 0,
 * so I set it to cnt for that case. I also round it up to the
 * next multiple of DIRBLKSIZ.
+* Since the size of a Readdirplus directory entry reply will always
+* be greater than a directory entry returned by VOP_READDIR(), it
+* does not make sense to read more than NFS_SRVMAXDATA() via
+* VOP_READDIR().
 */
if (siz <= 0)
siz = cnt;
+   else if (siz > NFS_SRVMAXDATA(nd))
+   siz = NFS_SRVMAXDATA(nd);
siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
 
if (nd->nd_flag & ND_NFSV4) {

Modified: releng/12.0/sys/fs/nfsserver/nfs_nfsdsocket.c
==
--- releng/12.0/sys/fs/nfsserver/nfs_nfsdsocket.c   Fri Nov 23 20:41:54 
2018(r340854)
+++ releng/12.0/sys/fs/nfsserver/nfs_nfsdsocket.c   Fri Nov 23 21:08:11 
2018(r340855)
@@ -766,11 +766,6 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
*repp = *tl;
op = fxdr_unsigned(int, *tl);
NFSD_DEBUG(4, "op=%d\n", op);
-
-   binuptime(_time);
-   nfsrvd_statstart(op, _time);
-   statsinprog = 1;
-
if (op < NFSV4OP_ACCESS ||
(op >= NFSV4OP_NOPS && (nd->nd_flag & ND_NFSV41) == 0) ||
(op >= NFSV41_NOPS && (nd->nd_flag & ND_NFSV41) != 0)) {
@@ -782,6 +777,11 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
} else {
repp++;
}
+
+   binuptime(_time);
+   nfsrvd_statstart(op, _time);
+   statsinprog = 1;
+
if (i == 0)
op0 = op;
if (i == numops - 1)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340854 - stable/11/sys/fs/nfsserver

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 20:41:54 2018
New Revision: 340854
URL: https://svnweb.freebsd.org/changeset/base/340854

Log:
  MFC r340663 (rmacklem):
  
  Improve sanity checking for the dircount hint argument to
  NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code
  checked for a zero argument, but did not check for a very large value.
  This patch clips dircount at the server's maximum data size.

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Fri Nov 23 20:39:37 2018
(r340853)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Fri Nov 23 20:41:54 2018
(r340854)
@@ -1858,9 +1858,15 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg
 * cookie) should be in the reply. At least one client "hints" 0,
 * so I set it to cnt for that case. I also round it up to the
 * next multiple of DIRBLKSIZ.
+* Since the size of a Readdirplus directory entry reply will always
+* be greater than a directory entry returned by VOP_READDIR(), it
+* does not make sense to read more than NFS_SRVMAXDATA() via
+* VOP_READDIR().
 */
if (siz <= 0)
siz = cnt;
+   else if (siz > NFS_SRVMAXDATA(nd))
+   siz = NFS_SRVMAXDATA(nd);
siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
 
if (nd->nd_flag & ND_NFSV4) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340853 - stable/11/sys/fs/nfs

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 20:39:37 2018
New Revision: 340853
URL: https://svnweb.freebsd.org/changeset/base/340853

Log:
  MFC r340662 (rmacklem):
  
  nfsm_advance() would panic() when the offs argument was negative.
  The code assumed that this would indicate a corrupted mbuf chain, but
  it could simply be caused by bogus RPC message data.
  This patch replaces the panic() with a printf() plus error return.

Modified:
  stable/11/sys/fs/nfs/nfs_commonsubs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/11/sys/fs/nfs/nfs_commonsubs.c   Fri Nov 23 20:38:50 2018
(r340852)
+++ stable/11/sys/fs/nfs/nfs_commonsubs.c   Fri Nov 23 20:39:37 2018
(r340853)
@@ -360,10 +360,14 @@ nfsm_advance(struct nfsrv_descript *nd, int offs, int 
if (offs == 0)
goto out;
/*
-* A negative offs should be considered a serious problem.
+* A negative offs might indicate a corrupted mbuf chain and,
+* as such, a printf is logged.
 */
-   if (offs < 0)
-   panic("nfsrv_advance");
+   if (offs < 0) {
+   printf("nfsrv_advance: negative offs\n");
+   error = EBADRPC;
+   goto out;
+   }
 
/*
 * If left == -1, calculate it here.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340852 - stable/11/sys/fs/nfsserver

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 20:38:50 2018
New Revision: 340852
URL: https://svnweb.freebsd.org/changeset/base/340852

Log:
  MFC r340661 (rmacklem):
  
  r304026 added code that started statistics gathering for an operation
  before the operation number (the variable called "op") was sanity checked.
  This patch moves the code down to below the range sanity check for "op".

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Nov 23 20:32:41 2018
(r340851)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Nov 23 20:38:50 2018
(r340852)
@@ -758,11 +758,6 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
*repp = *tl;
op = fxdr_unsigned(int, *tl);
NFSD_DEBUG(4, "op=%d\n", op);
-
-   binuptime(_time);
-   nfsrvd_statstart(op, _time);
-   statsinprog = 1;
-
if (op < NFSV4OP_ACCESS ||
(op >= NFSV4OP_NOPS && (nd->nd_flag & ND_NFSV41) == 0) ||
(op >= NFSV41_NOPS && (nd->nd_flag & ND_NFSV41) != 0)) {
@@ -774,6 +769,11 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
} else {
repp++;
}
+
+   binuptime(_time);
+   nfsrvd_statstart(op, _time);
+   statsinprog = 1;
+
if (i == 0)
op0 = op;
if (i == numops - 1)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340851 - stable/12/sys/fs/nfsserver

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 20:32:41 2018
New Revision: 340851
URL: https://svnweb.freebsd.org/changeset/base/340851

Log:
  MFC r340663 (rmacklem):
  
  Improve sanity checking for the dircount hint argument to
  NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code
  checked for a zero argument, but did not check for a very large value.
  This patch clips dircount at the server's maximum data size.

Modified:
  stable/12/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdport.c   Fri Nov 23 20:31:27 2018
(r340850)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdport.c   Fri Nov 23 20:32:41 2018
(r340851)
@@ -2107,9 +2107,15 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdg
 * cookie) should be in the reply. At least one client "hints" 0,
 * so I set it to cnt for that case. I also round it up to the
 * next multiple of DIRBLKSIZ.
+* Since the size of a Readdirplus directory entry reply will always
+* be greater than a directory entry returned by VOP_READDIR(), it
+* does not make sense to read more than NFS_SRVMAXDATA() via
+* VOP_READDIR().
 */
if (siz <= 0)
siz = cnt;
+   else if (siz > NFS_SRVMAXDATA(nd))
+   siz = NFS_SRVMAXDATA(nd);
siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
 
if (nd->nd_flag & ND_NFSV4) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340850 - stable/12/sys/fs/nfs

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 20:31:27 2018
New Revision: 340850
URL: https://svnweb.freebsd.org/changeset/base/340850

Log:
  MFC r340662 (rmacklem):
  
  nfsm_advance() would panic() when the offs argument was negative.
  The code assumed that this would indicate a corrupted mbuf chain, but
  it could simply be caused by bogus RPC message data.
  This patch replaces the panic() with a printf() plus error return.

Modified:
  stable/12/sys/fs/nfs/nfs_commonsubs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/12/sys/fs/nfs/nfs_commonsubs.c   Fri Nov 23 20:29:47 2018
(r340849)
+++ stable/12/sys/fs/nfs/nfs_commonsubs.c   Fri Nov 23 20:31:27 2018
(r340850)
@@ -725,10 +725,14 @@ nfsm_advance(struct nfsrv_descript *nd, int offs, int 
if (offs == 0)
goto out;
/*
-* A negative offs should be considered a serious problem.
+* A negative offs might indicate a corrupted mbuf chain and,
+* as such, a printf is logged.
 */
-   if (offs < 0)
-   panic("nfsrv_advance");
+   if (offs < 0) {
+   printf("nfsrv_advance: negative offs\n");
+   error = EBADRPC;
+   goto out;
+   }
 
/*
 * If left == -1, calculate it here.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340849 - stable/12/sys/fs/nfsserver

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 20:29:47 2018
New Revision: 340849
URL: https://svnweb.freebsd.org/changeset/base/340849

Log:
  MFC r340661 (rmacklem):
  
  r304026 added code that started statistics gathering for an operation
  before the operation number (the variable called "op") was sanity checked.
  This patch moves the code down to below the range sanity check for "op".

Modified:
  stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Nov 23 19:45:57 2018
(r340848)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdsocket.c Fri Nov 23 20:29:47 2018
(r340849)
@@ -766,11 +766,6 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
*repp = *tl;
op = fxdr_unsigned(int, *tl);
NFSD_DEBUG(4, "op=%d\n", op);
-
-   binuptime(_time);
-   nfsrvd_statstart(op, _time);
-   statsinprog = 1;
-
if (op < NFSV4OP_ACCESS ||
(op >= NFSV4OP_NOPS && (nd->nd_flag & ND_NFSV41) == 0) ||
(op >= NFSV41_NOPS && (nd->nd_flag & ND_NFSV41) != 0)) {
@@ -782,6 +777,11 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
} else {
repp++;
}
+
+   binuptime(_time);
+   nfsrvd_statstart(op, _time);
+   statsinprog = 1;
+
if (i == 0)
op0 = op;
if (i == numops - 1)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340846 - head/sys/arm/allwinner

2018-11-23 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 23 19:44:26 2018
New Revision: 340846
URL: https://svnweb.freebsd.org/changeset/base/340846

Log:
  aw_usbphy: Convert to usbphy subclass
  
  Instead of routing the phy when enabling it, do the configuration
  and routing in the phynode_usb_set_mode function.
  While here, if we don't have a vbus detection method, enable the phy
  if requested.
  
  MFC after:1 month

Modified:
  head/sys/arm/allwinner/aw_usbphy.c

Modified: head/sys/arm/allwinner/aw_usbphy.c
==
--- head/sys/arm/allwinner/aw_usbphy.c  Fri Nov 23 19:43:18 2018
(r340845)
+++ head/sys/arm/allwinner/aw_usbphy.c  Fri Nov 23 19:44:26 2018
(r340846)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "phynode_if.h"
 
@@ -139,17 +139,22 @@ struct awusbphy_softc {
gpio_pin_t  vbus_det_pin;
int vbus_det_valid;
struct aw_usbphy_conf   *phy_conf;
+   int mode;
 };
 
  /* Phy class and methods. */
 static int awusbphy_phy_enable(struct phynode *phy, bool enable);
-static phynode_method_t awusbphy_phynode_methods[] = {
+static int awusbphy_get_mode(struct phynode *phy, int *mode);
+static int awusbphy_set_mode(struct phynode *phy, int mode);
+static phynode_usb_method_t awusbphy_phynode_methods[] = {
PHYNODEMETHOD(phynode_enable, awusbphy_phy_enable),
+   PHYNODEMETHOD(phynode_usb_get_mode, awusbphy_get_mode),
+   PHYNODEMETHOD(phynode_usb_set_mode, awusbphy_set_mode),
 
PHYNODEMETHOD_END
 };
 DEFINE_CLASS_1(awusbphy_phynode, awusbphy_phynode_class, 
awusbphy_phynode_methods,
-0, phynode_class);
+  sizeof(struct phynode_usb_sc), phynode_usb_class);
 
 #defineRD4(res, o) bus_read_4(res, (o))
 #defineWR4(res, o, v)  bus_write_4(res, (o), (v))
@@ -165,6 +170,18 @@ DEFINE_CLASS_1(awusbphy_phynode, awusbphy_phynode_clas
 #define PMU_ULPI_BYPASS(1 << 0)
 #definePMU_UNK_H3  0x10
 #define PMU_UNK_H3_CLR 0x2
+#definePHY_CSR 0x00
+#define ID_PULLUP_EN   (1 << 17)
+#define DPDM_PULLUP_EN (1 << 16)
+#define FORCE_ID   (0x3 << 14)
+#define FORCE_ID_SHIFT 14
+#define FORCE_ID_LOW   2
+#define FORCE_VBUS_VALID   (0x3 << 12)
+#define FORCE_VBUS_VALID_SHIFT 12
+#define FORCE_VBUS_VALID_HIGH  3
+#define VBUS_CHANGE_DET(1 << 6)
+#define ID_CHANGE_DET  (1 << 5)
+#define DPDM_CHANGE_DET(1 << 4)
 
 static void
 awusbphy_configure(device_t dev, int phyno)
@@ -287,7 +304,7 @@ awusbphy_vbus_detect(device_t dev, int *val)
return (0);
}
 
-   *val = 1;
+   *val = 0;
return (0);
 }
 
@@ -315,30 +332,22 @@ awusbphy_phy_enable(struct phynode *phynode, bool enab
if (reg == NULL)
return (0);
 
-   if (enable) {
+   if (phy == 0) {
/* If an external vbus is detected, do not enable phy 0 */
-   if (phy == 0) {
-   error = awusbphy_vbus_detect(dev, _det);
-   if (error)
-   goto out;
+   error = awusbphy_vbus_detect(dev, _det);
+   if (error)
+   goto out;
 
-   /* Depending on the PHY we need to route OTG to 
OHCI/EHCI */
-   if (sc->phy_conf->phy0_route == true) {
-   if (vbus_det == 0)
-   /* Host mode */
-   CLR4(sc->phy_ctrl, OTG_PHY_CFG,
-OTG_PHY_ROUTE_OTG);
-   else
-   /* Peripheral mode */
-   SET4(sc->phy_ctrl, OTG_PHY_CFG,
-OTG_PHY_ROUTE_OTG);
-   }
-   if (vbus_det == 1)
-   return (0);
-   } else
-   error = 0;
-   if (error == 0)
-   error = regulator_enable(reg);
+   if (vbus_det == 1) {
+   if (bootverbose)
+   device_printf(dev, "External VBUS detected, not 
enabling the regulator\n");
+
+   return (0);
+   }
+   }
+   if (enable) {
+   /* Depending on the PHY we need to route OTG to OHCI/EHCI */
+   error = regulator_enable(reg);
} else
error = regulator_disable(reg);
 
@@ -350,6 +359,70 @@ out:
return (error);
}
 
+   return (0);
+}
+
+static int
+awusbphy_get_mode(struct phynode *phynode, int *mode)
+{
+   struct 

svn commit: r340848 - head/sys/arm/allwinner

2018-11-23 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 23 19:45:57 2018
New Revision: 340848
URL: https://svnweb.freebsd.org/changeset/base/340848

Log:
  axp8xx: Rework the enable part and add the GPIOXLDO regulators
  
  MFC after:1 month

Modified:
  head/sys/arm/allwinner/axp81x.c

Modified: head/sys/arm/allwinner/axp81x.c
==
--- head/sys/arm/allwinner/axp81x.c Fri Nov 23 19:45:11 2018
(r340847)
+++ head/sys/arm/allwinner/axp81x.c Fri Nov 23 19:45:57 2018
(r340848)
@@ -126,12 +126,16 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8x
 #defineAXP_IRQSTAT50x4c
 #define AXP_IRQSTAT5_POKSIRQ   (1 << 4)
 #defineAXP_GPIO0_CTRL  0x90
+#defineAXP_GPIO0LDO_CTRL   0x91
 #defineAXP_GPIO1_CTRL  0x92
+#defineAXP_GPIO1LDO_CTRL   0x93
 #define AXP_GPIO_FUNC  (0x7 << 0)
 #define AXP_GPIO_FUNC_SHIFT0
 #define AXP_GPIO_FUNC_DRVLO0
 #define AXP_GPIO_FUNC_DRVHI1
 #define AXP_GPIO_FUNC_INPUT2
+#define AXP_GPIO_FUNC_LDO_ON   3
+#define AXP_GPIO_FUNC_LDO_OFF  4
 #defineAXP_GPIO_SIGBIT 0x94
 #defineAXP_GPIO_PD 0x97
 
@@ -166,6 +170,8 @@ struct axp8xx_regdef {
char*supply_name;
uint8_t enable_reg;
uint8_t enable_mask;
+   uint8_t enable_value;
+   uint8_t disable_value;
uint8_t voltage_reg;
int voltage_min;
int voltage_max;
@@ -197,6 +203,8 @@ enum axp8xx_reg_id {
AXP8XX_REG_ID_FLDO1,
AXP8XX_REG_ID_FLDO2,
AXP813_REG_ID_FLDO3,
+   AXP8XX_REG_ID_GPIO0_LDO,
+   AXP8XX_REG_ID_GPIO1_LDO,
 };
 
 static struct axp8xx_regdef axp803_regdefs[] = {
@@ -204,7 +212,8 @@ static struct axp8xx_regdef axp803_regdefs[] = {
.id = AXP803_REG_ID_DC1SW,
.name = "dc1sw",
.enable_reg = AXP_POWERCTL2,
-   .enable_mask = AXP_POWERCTL2_DC1SW,
+   .enable_mask = (uint8_t) AXP_POWERCTL2_DC1SW,
+   .enable_value = AXP_POWERCTL2_DC1SW,
},
 };
 
@@ -213,7 +222,8 @@ static struct axp8xx_regdef axp813_regdefs[] = {
.id = AXP813_REG_ID_DCDC7,
.name = "dcdc7",
.enable_reg = AXP_POWERCTL1,
-   .enable_mask = AXP_POWERCTL1_DCDC7,
+   .enable_mask = (uint8_t) AXP_POWERCTL1_DCDC7,
+   .enable_value = AXP_POWERCTL1_DCDC7,
.voltage_reg = AXP_VOLTCTL_DCDC7,
.voltage_min = 600,
.voltage_max = 1520,
@@ -229,7 +239,8 @@ static struct axp8xx_regdef axp8xx_common_regdefs[] = 
.id = AXP8XX_REG_ID_DCDC1,
.name = "dcdc1",
.enable_reg = AXP_POWERCTL1,
-   .enable_mask = AXP_POWERCTL1_DCDC1,
+   .enable_mask = (uint8_t) AXP_POWERCTL1_DCDC1,
+   .enable_value = AXP_POWERCTL1_DCDC1,
.voltage_reg = AXP_VOLTCTL_DCDC1,
.voltage_min = 1600,
.voltage_max = 3400,
@@ -240,7 +251,8 @@ static struct axp8xx_regdef axp8xx_common_regdefs[] = 
.id = AXP8XX_REG_ID_DCDC2,
.name = "dcdc2",
.enable_reg = AXP_POWERCTL1,
-   .enable_mask = AXP_POWERCTL1_DCDC2,
+   .enable_mask = (uint8_t) AXP_POWERCTL1_DCDC2,
+   .enable_value = AXP_POWERCTL1_DCDC2,
.voltage_reg = AXP_VOLTCTL_DCDC2,
.voltage_min = 500,
.voltage_max = 1300,
@@ -253,7 +265,8 @@ static struct axp8xx_regdef axp8xx_common_regdefs[] = 
.id = AXP8XX_REG_ID_DCDC3,
.name = "dcdc3",
.enable_reg = AXP_POWERCTL1,
-   .enable_mask = AXP_POWERCTL1_DCDC3,
+   .enable_mask = (uint8_t) AXP_POWERCTL1_DCDC3,
+   .enable_value = AXP_POWERCTL1_DCDC3,
.voltage_reg = AXP_VOLTCTL_DCDC3,
.voltage_min = 500,
.voltage_max = 1300,
@@ -266,7 +279,8 @@ static struct axp8xx_regdef axp8xx_common_regdefs[] = 
.id = AXP8XX_REG_ID_DCDC4,
.name = "dcdc4",
.enable_reg = AXP_POWERCTL1,
-   .enable_mask = AXP_POWERCTL1_DCDC4,
+   .enable_mask = (uint8_t) AXP_POWERCTL1_DCDC4,
+   .enable_value = AXP_POWERCTL1_DCDC4,
.voltage_reg = AXP_VOLTCTL_DCDC4,
.voltage_min = 500,
.voltage_max = 1300,
@@ -279,7 +293,8 @@ static struct axp8xx_regdef axp8xx_common_regdefs[] = 
.id = AXP8XX_REG_ID_DCDC5,
.name = "dcdc5",
.enable_reg = AXP_POWERCTL1,
-   .enable_mask = AXP_POWERCTL1_DCDC5,

svn commit: r340847 - head/sys/arm/allwinner

2018-11-23 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 23 19:45:11 2018
New Revision: 340847
URL: https://svnweb.freebsd.org/changeset/base/340847

Log:
  a10_ehci: Always set the phy to host mode
  
  MFC after:1 month

Modified:
  head/sys/arm/allwinner/a10_ehci.c

Modified: head/sys/arm/allwinner/a10_ehci.c
==
--- head/sys/arm/allwinner/a10_ehci.c   Fri Nov 23 19:44:26 2018
(r340846)
+++ head/sys/arm/allwinner/a10_ehci.c   Fri Nov 23 19:45:11 2018
(r340847)
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define EHCI_HC_DEVSTR "Allwinner Integrated USB 2.0 
controller"
 
@@ -242,6 +242,11 @@ a10_ehci_attach(device_t self)
 
/* Enable USB PHY */
if (phy_get_by_ofw_name(self, 0, "usb", _sc->phy) == 0) {
+   err = phy_usb_set_mode(aw_sc->phy, PHY_USB_MODE_HOST);
+   if (err != 0) {
+   device_printf(self, "Could not set phy to host mode\n");
+   goto error;
+   }
err = phy_enable(aw_sc->phy);
if (err != 0) {
device_printf(self, "Could not enable phy\n");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340845 - in head/sys: conf dev/extres/phy

2018-11-23 Thread Emmanuel Vadot
Author: manu
Date: Fri Nov 23 19:43:18 2018
New Revision: 340845
URL: https://svnweb.freebsd.org/changeset/base/340845

Log:
  Derive PHY class to new one specialized for USB PHY functions.
  
  Submitted by: mmel

Added:
  head/sys/dev/extres/phy/phy_internal.h   (contents, props changed)
  head/sys/dev/extres/phy/phy_usb.c   (contents, props changed)
  head/sys/dev/extres/phy/phy_usb.h   (contents, props changed)
  head/sys/dev/extres/phy/phynode_usb_if.m   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/extres/phy/phy.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Nov 23 18:27:16 2018(r340844)
+++ head/sys/conf/files Fri Nov 23 19:43:18 2018(r340845)
@@ -1734,6 +1734,8 @@ dev/extres/clk/clk_mux.c  optional ext_resources clk fd
 dev/extres/phy/phy.c   optional ext_resources phy fdt
 dev/extres/phy/phydev_if.m optional ext_resources phy fdt
 dev/extres/phy/phynode_if.moptional ext_resources phy fdt
+dev/extres/phy/phy_usb.c   optional ext_resources phy fdt
+dev/extres/phy/phynode_usb_if.moptional ext_resources phy fdt
 dev/extres/hwreset/hwreset.c   optional ext_resources hwreset fdt
 dev/extres/hwreset/hwreset_if.moptional ext_resources hwreset fdt
 dev/extres/nvmem/nvmem.c   optional ext_resources nvmem fdt

Modified: head/sys/dev/extres/phy/phy.c
==
--- head/sys/dev/extres/phy/phy.c   Fri Nov 23 18:27:16 2018
(r340844)
+++ head/sys/dev/extres/phy/phy.c   Fri Nov 23 19:43:18 2018
(r340845)
@@ -43,18 +43,12 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #include  
+#include  
 
 #include "phydev_if.h"
 
 MALLOC_DEFINE(M_PHY, "phy", "Phy framework");
 
-/* Forward declarations. */
-struct phy;
-struct phynode;
-
-typedef TAILQ_HEAD(phynode_list, phynode) phynode_list_t;
-typedef TAILQ_HEAD(phy_list, phy) phy_list_t;
-
 /* Default phy methods. */
 static int phynode_method_init(struct phynode *phynode);
 static int phynode_method_enable(struct phynode *phynode, bool disable);
@@ -73,52 +67,9 @@ static phynode_method_t phynode_methods[] = {
 };
 DEFINE_CLASS_0(phynode, phynode_class, phynode_methods, 0);
 
-/*
- * Phy node
- */
-struct phynode {
-   KOBJ_FIELDS;
-
-   TAILQ_ENTRY(phynode)phylist_link;   /* Global list entry */
-   phy_list_t  consumers_list; /* Consumers list */
-
-
-   /* Details of this device. */
-   const char  *name;  /* Globally unique name */
-
-   device_tpdev;   /* Producer device_t */
-   void*softc; /* Producer softc */
-   intptr_tid; /* Per producer unique id */
-#ifdef FDT
-phandle_t  ofw_node;   /* OFW node of phy */
-#endif
-   struct sx   lock;   /* Lock for this phy */
-   int ref_cnt;/* Reference counter */
-   int enable_cnt; /* Enabled counter */
-};
-
-struct phy {
-   device_tcdev;   /* consumer device*/
-   struct phynode  *phynode;
-   TAILQ_ENTRY(phy)link;   /* Consumers list entry */
-
-   int enable_cnt;
-};
-
 static phynode_list_t phynode_list = TAILQ_HEAD_INITIALIZER(phynode_list);
 
-static struct sx   phynode_topo_lock;
 SX_SYSINIT(phy_topology, _topo_lock, "Phy topology lock");
-
-#define PHY_TOPO_SLOCK()   sx_slock(_topo_lock)
-#define PHY_TOPO_XLOCK()   sx_xlock(_topo_lock)
-#define PHY_TOPO_UNLOCK()  sx_unlock(_topo_lock)
-#define PHY_TOPO_ASSERT()  sx_assert(_topo_lock, SA_LOCKED)
-#define PHY_TOPO_XASSERT() sx_assert(_topo_lock, SA_XLOCKED)
-
-#define PHYNODE_SLOCK(_sc) sx_slock(&((_sc)->lock))
-#define PHYNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock))
-#define PHYNODE_UNLOCK(_sc)sx_unlock(&((_sc)->lock))
 
 /* 
  *

Added: head/sys/dev/extres/phy/phy_internal.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/extres/phy/phy_internal.h  Fri Nov 23 19:43:18 2018
(r340845)
@@ -0,0 +1,83 @@
+/*-
+ * Copyright 2018 Michal Meloun 
+ * 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 

svn commit: r340844 - head/libexec/rtld-elf

2018-11-23 Thread Conrad Meyer
Author: cem
Date: Fri Nov 23 18:27:16 2018
New Revision: 340844
URL: https://svnweb.freebsd.org/changeset/base/340844

Log:
  Revert r340843 - addressed independently in r340842!

Modified:
  head/libexec/rtld-elf/Makefile

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Fri Nov 23 18:23:29 2018
(r340843)
+++ head/libexec/rtld-elf/Makefile  Fri Nov 23 18:27:16 2018
(r340844)
@@ -102,10 +102,6 @@ ${PROG_FULL}:  ${VERSION_MAP}
 # GCC warns about redeclarations even though they have __exported
 # and are therefore not identical to the ones from the system headers.
 CFLAGS+=   -Wno-redundant-decls
-# GCC (6.4.0) doesn't grok the complicated lifetimes in reloc_non_plt():
-.if ${MACHINE_CPUARCH} == "amd64"
-CFLAGS.reloc.c+=-Wno-maybe-uninitialized
-.endif
 .if ${COMPILER_VERSION} < 40300
 # Silence -Wshadow false positives in ancient GCC
 CFLAGS+=   -Wno-shadow
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340843 - head/libexec/rtld-elf

2018-11-23 Thread Conrad Meyer
Author: cem
Date: Fri Nov 23 18:23:29 2018
New Revision: 340843
URL: https://svnweb.freebsd.org/changeset/base/340843

Log:
  rtld: Silence a false positive GCC 6.4.0 warning
  
  The function reloc_non_plt has complicated variable lifetimes that GCC 6.4.0
  (the version currently used by amd64-xtoolchain-gcc) misunderstands and
  produces an erroneous warning about.  Silence it to allow the -Werror build
  to proceed.
  
  Reviewed by:  emaste

Modified:
  head/libexec/rtld-elf/Makefile

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Fri Nov 23 18:15:23 2018
(r340842)
+++ head/libexec/rtld-elf/Makefile  Fri Nov 23 18:23:29 2018
(r340843)
@@ -102,6 +102,10 @@ ${PROG_FULL}:  ${VERSION_MAP}
 # GCC warns about redeclarations even though they have __exported
 # and are therefore not identical to the ones from the system headers.
 CFLAGS+=   -Wno-redundant-decls
+# GCC (6.4.0) doesn't grok the complicated lifetimes in reloc_non_plt():
+.if ${MACHINE_CPUARCH} == "amd64"
+CFLAGS.reloc.c+=-Wno-maybe-uninitialized
+.endif
 .if ${COMPILER_VERSION} < 40300
 # Silence -Wshadow false positives in ancient GCC
 CFLAGS+=   -Wno-shadow
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340842 - head/libexec/rtld-elf/amd64

2018-11-23 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 23 18:15:23 2018
New Revision: 340842
URL: https://svnweb.freebsd.org/changeset/base/340842

Log:
  Silence gcc warnings.
  
  Reported by:  emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/libexec/rtld-elf/amd64/reloc.c

Modified: head/libexec/rtld-elf/amd64/reloc.c
==
--- head/libexec/rtld-elf/amd64/reloc.c Fri Nov 23 16:45:07 2018
(r340841)
+++ head/libexec/rtld-elf/amd64/reloc.c Fri Nov 23 18:15:23 2018
(r340842)
@@ -138,6 +138,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int
int r;
 
r = -1;
+   symval = 0;
+   def = NULL;
+
/*
 * The dynamic loader may be called from a thread, we have
 * limited amounts of stack available so we cannot use alloca().
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340841 - in head: . share/mk sys/sys

2018-11-23 Thread Andrew Turner
Author: andrew
Date: Fri Nov 23 16:45:07 2018
New Revision: 340841
URL: https://svnweb.freebsd.org/changeset/base/340841

Log:
  Enable the BSD crtbegin/crtend by default.
  
  It has passed an exp run on amd64 and i386, and has testing on arm64. On
  other architectures it is expected to run, however it can be disabled by
  building world with -DWITHOUT_BSD_CRTBEGIN.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/UPDATING
  head/share/mk/src.opts.mk
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Fri Nov 23 16:33:03 2018(r340840)
+++ head/UPDATING   Fri Nov 23 16:45:07 2018(r340841)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20181123:
+   The BSD crtbegin and crtend code has been enabled by default. It has
+   had extensive testing on amd64, arm64, and i386. It can be disabled
+   by building a world with -DWITHOUT_BSD_CRTBEGIN.
+
 20181115:
The set of CTM commands (ctm, ctm_smail, ctm_rmail, ctm_dequeue)
has been converted to a port (misc/ctm) and will be removed from

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Fri Nov 23 16:33:03 2018(r340840)
+++ head/share/mk/src.opts.mk   Fri Nov 23 16:45:07 2018(r340841)
@@ -71,6 +71,7 @@ __DEFAULT_YES_OPTIONS = \
 BOOTPARAMD \
 BOOTPD \
 BSD_CPIO \
+BSD_CRTBEGIN \
 BSDINSTALL \
 BSNMP \
 BZIP2 \
@@ -193,7 +194,6 @@ __DEFAULT_YES_OPTIONS = \
 ZONEINFO
 
 __DEFAULT_NO_OPTIONS = \
-BSD_CRTBEGIN \
 BSD_GREP \
 CLANG_EXTRAS \
 DTRACE_TESTS \

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hFri Nov 23 16:33:03 2018(r340840)
+++ head/sys/sys/param.hFri Nov 23 16:45:07 2018(r340841)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 133  /* Master, propagated to newvers */
+#define __FreeBSD_version 134  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340840 - head/lib/csu/mips

2018-11-23 Thread Andrew Turner
Author: andrew
Date: Fri Nov 23 16:33:03 2018
New Revision: 340840
URL: https://svnweb.freebsd.org/changeset/base/340840

Log:
  Mark the function called by the MIPS .init/.fini sequence with .local.
  
  As with r328939 we need to mark local symbols as such. Without this the
  assembly parser treats the symbols as global and created relocations
  against these private symbols.
  
  MFC with: r339738
  Sponsored by: DARPA, AFRL

Modified:
  head/lib/csu/mips/crt.h

Modified: head/lib/csu/mips/crt.h
==
--- head/lib/csu/mips/crt.h Fri Nov 23 16:32:27 2018(r340839)
+++ head/lib/csu/mips/crt.h Fri Nov 23 16:33:03 2018(r340840)
@@ -36,6 +36,7 @@
 "1:\n" 
\
 ".cpload $ra   \n" \
 ".set reorder  \n" \
+".local" __STRING(func) "\n"   \
 "jal   " __STRING(func)
 #else
 #defineINIT_CALL_SEQ(func) 
\
@@ -45,6 +46,7 @@
 "1:\n" 
\
 ".set reorder  \n" \
 ".cpsetup $ra, $v0, 1b \n" \
+".local" __STRING(func) "\n"   \
 "jal   " __STRING(func)
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340839 - in releng/12.0: release/pkg_repos sys/conf

2018-11-23 Thread Glen Barber
Author: gjb
Date: Fri Nov 23 16:32:27 2018
New Revision: 340839
URL: https://svnweb.freebsd.org/changeset/base/340839

Log:
  - Update releng/12.0 from RC1 to RC2 as part of the 12.0-RELEASE
cycle.
  - Update the dvd1.iso pkg(8) configuration to use the release_0
package set to populate the dvd.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/12.0/release/pkg_repos/release-dvd.conf
  releng/12.0/sys/conf/newvers.sh

Modified: releng/12.0/release/pkg_repos/release-dvd.conf
==
--- releng/12.0/release/pkg_repos/release-dvd.conf  Fri Nov 23 16:18:36 
2018(r340838)
+++ releng/12.0/release/pkg_repos/release-dvd.conf  Fri Nov 23 16:32:27 
2018(r340839)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 release: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_0;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",

Modified: releng/12.0/sys/conf/newvers.sh
==
--- releng/12.0/sys/conf/newvers.sh Fri Nov 23 16:18:36 2018
(r340838)
+++ releng/12.0/sys/conf/newvers.sh Fri Nov 23 16:32:27 2018
(r340839)
@@ -46,7 +46,7 @@
 
 TYPE="FreeBSD"
 REVISION="12.0"
-BRANCH="RC1"
+BRANCH="RC2"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340838 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 16:18:36 2018
New Revision: 340838
URL: https://svnweb.freebsd.org/changeset/base/340838

Log:
  sfxge(4): request info about outer frame in Rx events
  
  For encapsulated packets, the firmware gives info about the inner frame
  fields by default. When not using encapsulation offload, ask for info
  about the outer frame instead.
  
  On SFN8xxx with firmware version before v6.4.2.1007 driver reload is
  needed after switching from full-feature to low-latency firmware
  variant since the driver still thinks that firmware supports
  encapsulation, but firmware does not tolerate request to provide info
  about outer frame in Rx events.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18105

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 15:59:49 2018
(r340837)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 16:18:36 2018
(r340838)
@@ -49,6 +49,7 @@ efx_mcdi_init_rxq(
__inboolean_t disable_scatter,
__inuint32_t ps_bufsize)
 {
+   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_INIT_RXQ_EXT_IN_LEN,
MC_CMD_INIT_RXQ_EXT_OUT_LEN)];
@@ -58,6 +59,7 @@ efx_mcdi_init_rxq(
uint64_t addr;
efx_rc_t rc;
uint32_t dma_mode;
+   boolean_t want_outer_classes;
 
/* If this changes, then the payload size might need to change. */
EFSYS_ASSERT3U(MC_CMD_INIT_RXQ_OUT_LEN, ==, 0);
@@ -68,6 +70,25 @@ efx_mcdi_init_rxq(
else
dma_mode = MC_CMD_INIT_RXQ_EXT_IN_SINGLE_PACKET;
 
+   if (encp->enc_tunnel_encapsulations_supported != 0) {
+   /*
+* WANT_OUTER_CLASSES can only be specified on hardware which
+* supports tunnel encapsulation offloads, even though it is
+* effectively the behaviour the hardware gives.
+*
+* Also, on hardware which does support such offloads, older
+* firmware rejects the flag if the offloads are not supported
+* by the current firmware variant, which means this may fail if
+* the capabilities are not updated when the firmware variant
+* changes. This is not an issue on newer firmware, as it was
+* changed in bug 69842 (v6.4.2.1007) to permit this flag to be
+* specified on all firmware variants.
+*/
+   want_outer_classes = B_TRUE;
+   } else {
+   want_outer_classes = B_FALSE;
+   }
+
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_INIT_RXQ;
req.emr_in_buf = payload;
@@ -79,7 +100,7 @@ efx_mcdi_init_rxq(
MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_TARGET_EVQ, target_evq);
MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_LABEL, label);
MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_INSTANCE, instance);
-   MCDI_IN_POPULATE_DWORD_8(req, INIT_RXQ_EXT_IN_FLAGS,
+   MCDI_IN_POPULATE_DWORD_9(req, INIT_RXQ_EXT_IN_FLAGS,
INIT_RXQ_EXT_IN_FLAG_BUFF_MODE, 0,
INIT_RXQ_EXT_IN_FLAG_HDR_SPLIT, 0,
INIT_RXQ_EXT_IN_FLAG_TIMESTAMP, 0,
@@ -88,7 +109,8 @@ efx_mcdi_init_rxq(
INIT_RXQ_EXT_IN_FLAG_DISABLE_SCATTER, disable_scatter,
INIT_RXQ_EXT_IN_DMA_MODE,
dma_mode,
-   INIT_RXQ_EXT_IN_PACKED_STREAM_BUFF_SIZE, ps_bufsize);
+   INIT_RXQ_EXT_IN_PACKED_STREAM_BUFF_SIZE, ps_bufsize,
+   INIT_RXQ_EXT_IN_FLAG_WANT_OUTER_CLASSES, want_outer_classes);
MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_OWNER_ID, 0);
MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_PORT_ID, EVB_PORT_ID_ASSIGNED);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340837 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 15:59:49 2018
New Revision: 340837
URL: https://svnweb.freebsd.org/changeset/base/340837

Log:
  sfxge(4): ignore error in completion event on MCDIv2 HW
  
  With MCDIv2, the reponse length can be to big to fit into the
  CMDDONE_DATALEN field in the MCDI completion event. But rather that
  the length being truncated, it can overflow into the CMDDONE_ERRNO
  field (this is a longstanding firmware bug). Hence the CMDDONE_ERRNO
  field may not be valid.
  
  It isn't necessary to use the value in the CMDDONE_ERRNO field though,
  so it can be ignored. The actual error code is already read from the
  response header on MCDIv2 capable hardware and stored in emr_rc, so
  that can be used instead.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18104

Modified:
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cFri Nov 23 15:59:37 2018
(r340836)
+++ head/sys/dev/sfxge/common/efx_mcdi.cFri Nov 23 15:59:49 2018
(r340837)
@@ -798,9 +798,8 @@ efx_mcdi_ev_cpl(
emrp->emr_rc = 0;
}
}
-   if (errcode == 0) {
+   if (emrp->emr_rc == 0)
efx_mcdi_finish_response(enp, emrp);
-   }
 
emtp->emt_ev_cpl(emtp->emt_context);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340836 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 15:59:37 2018
New Revision: 340836
URL: https://svnweb.freebsd.org/changeset/base/340836

Log:
  sfxge(4): use MCDIv2 for requests with too long response
  
  Use MCDIv2 for requests with a response size too long for MCDIv1.
  
  Required for MC_CMD_MAC_STATS to reports the stats without using DMA.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18103

Modified:
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cFri Nov 23 15:49:18 2018
(r340835)
+++ head/sys/dev/sfxge/common/efx_mcdi.cFri Nov 23 15:59:37 2018
(r340836)
@@ -295,7 +295,8 @@ efx_mcdi_request_start(
 */
if ((max_version >= 2) &&
((emrp->emr_cmd > MC_CMD_CMD_SPACE_ESCAPE_7) ||
-   (emrp->emr_in_length > MCDI_CTL_SDU_LEN_MAX_V1))) {
+   (emrp->emr_in_length > MCDI_CTL_SDU_LEN_MAX_V1) ||
+   (emrp->emr_out_length > MCDI_CTL_SDU_LEN_MAX_V1))) {
/* Construct MCDI v2 header */
hdr_len = sizeof (hdr);
EFX_POPULATE_DWORD_8(hdr[0],
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340835 - in head/lib/libc: regex tests/regex

2018-11-23 Thread Yuri Pankov
Author: yuripv
Date: Fri Nov 23 15:49:18 2018
New Revision: 340835
URL: https://svnweb.freebsd.org/changeset/base/340835

Log:
  regexec: fix processing multibyte strings.
  
  Matcher function incorrectly assumed that moffset that we get from
  findmust is in bytes. Fix this by introducing a stepback function,
  taking short path if MB_CUR_MAX is 1, and going back byte-by-byte,
  checking if we have a legal character sequence otherwise.
  
  PR:   153502
  Reviewed by:  pfg, kevans
  Approved by:  kib (mentor, implicit)
  Differential revision:https://reviews.freebsd.org/D18297

Added:
  head/lib/libc/tests/regex/multibyte.sh   (contents, props changed)
Modified:
  head/lib/libc/regex/engine.c
  head/lib/libc/tests/regex/Makefile

Modified: head/lib/libc/regex/engine.c
==
--- head/lib/libc/regex/engine.cFri Nov 23 13:50:18 2018
(r340834)
+++ head/lib/libc/regex/engine.cFri Nov 23 15:49:18 2018
(r340835)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #ifdef SNAMES
+#definestepback sstepback
 #definematcher smatcher
 #definewalkswalk
 #definedissect sdissect
@@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #definematch   smat
 #endif
 #ifdef LNAMES
+#definestepback lstepback
 #definematcher lmatcher
 #definewalklwalk
 #definedissect ldissect
@@ -68,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #definematch   lmat
 #endif
 #ifdef MNAMES
+#definestepback mstepback
 #definematcher mmatcher
 #definewalkmwalk
 #definedissect mdissect
@@ -142,6 +145,39 @@ static const char *pchar(int ch);
 #endif
 
 /*
+ * Given a multibyte string pointed to by start, step back nchar characters
+ * from current position pointed to by cur.
+ */
+static const char *
+stepback(const char *start, const char *cur, int nchar)
+{
+   const char *ret;
+   int wc, mbc;
+   mbstate_t mbs;
+   size_t clen;
+
+   if (MB_CUR_MAX == 1)
+   return ((cur - nchar) > start ? cur - nchar : NULL);
+
+   ret = cur;
+   for (wc = nchar; wc > 0; wc--) {
+   for (mbc = 1; mbc <= MB_CUR_MAX; mbc++) {
+   if ((ret - mbc) < start)
+   return (NULL);
+   memset(, 0, sizeof(mbs));
+   clen = mbrtowc(NULL, ret - mbc, mbc, );
+   if (clen != (size_t)-1 && clen != (size_t)-2)
+   break;
+   }
+   if (mbc > MB_CUR_MAX)
+   return (NULL);
+   ret -= mbc;
+   }
+
+   return (ret);
+}
+
+/*
  - matcher - the actual matching engine
  == static int matcher(struct re_guts *g, const char *string, \
  ==size_t nmatch, regmatch_t pmatch[], int eflags);
@@ -244,9 +280,14 @@ matcher(struct re_guts *g,
ZAPSTATE(>mbs);
 
/* Adjust start according to moffset, to speed things up */
-   if (dp != NULL && g->moffset > -1)
-   start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
+   if (dp != NULL && g->moffset > -1) {
+   const char *nstart;
 
+   nstart = stepback(start, dp, g->moffset);
+   if (nstart != NULL)
+   start = nstart;
+   }
+
SP("mloop", m->st, *start);
 
/* this loop does only one repetition except for backrefs */
@@ -1083,6 +1124,7 @@ pchar(int ch)
 #endif
 #endif
 
+#undef stepback
 #undef matcher
 #undef walk
 #undef dissect

Modified: head/lib/libc/tests/regex/Makefile
==
--- head/lib/libc/tests/regex/Makefile  Fri Nov 23 13:50:18 2018
(r340834)
+++ head/lib/libc/tests/regex/Makefile  Fri Nov 23 15:49:18 2018
(r340835)
@@ -2,6 +2,9 @@
 
 PACKAGE=   tests
 
+# local test cases
+ATF_TESTS_SH+= multibyte
+
 .include "Makefile.inc"
 .include "${.CURDIR:H}/Makefile.netbsd-tests"
 .include 

Added: head/lib/libc/tests/regex/multibyte.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/tests/regex/multibyte.sh  Fri Nov 23 15:49:18 2018
(r340835)
@@ -0,0 +1,35 @@
+# $FreeBSD$
+
+atf_test_case multibyte
+multibyte_head()
+{
+   atf_set "descr" "Check matching multibyte characters (PR153502)"
+}
+multibyte_body()
+{
+   export LC_CTYPE="C.UTF-8"
+
+   printf 'é' | atf_check -o "inline:é" \
+   sed -ne '/^.$/p'
+   printf 'éé' | atf_check -o "inline:éé" \
+   sed -ne '/^..$/p'
+   printf 'aéa' | atf_check -o "inline:aéa" \
+   sed -ne '/a.a/p'
+   printf 'aéa'| atf_check -o "inline:aéa" \
+   sed -ne '/a.*a/p'
+   printf 'aaéaa' | atf_check -o "inline:aaéaa" \
+   sed -ne '/aa.aa/p'
+ 

svn commit: r340834 - head/stand/i386

2018-11-23 Thread Ed Maste
Author: emaste
Date: Fri Nov 23 13:50:18 2018
New Revision: 340834
URL: https://svnweb.freebsd.org/changeset/base/340834

Log:
  Disable build-id in i386 binary boot components
  
  A user may enable build-id for all builds by adding
  LDFLAGS=-Wl,--build-id=sha1 to /etc/make.conf.  In this case the build-id
  note ends added up to mbr and pmbr's .text, which makes it too large (it
  ends up being 532 bytes). To avoid this explicitly turn off build-id for
  these components.
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15470

Modified:
  head/stand/i386/Makefile.inc

Modified: head/stand/i386/Makefile.inc
==
--- head/stand/i386/Makefile.incFri Nov 23 13:12:04 2018
(r340833)
+++ head/stand/i386/Makefile.incFri Nov 23 13:50:18 2018
(r340834)
@@ -2,6 +2,8 @@
 #
 # $FreeBSD$
 
+.include "bsd.linker.mk"
+
 LOADER_ADDRESS?=0x20
 LDFLAGS+=  -nostdlib
 LDFLAGS.lld+=  -Wl,--no-rosegment
@@ -22,6 +24,9 @@ LDSCRIPT= ${BOOTSRC}/i386/boot.ldscript
 # LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary
 # LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections
 LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
+.if ${LINKER_FEATURES:Mbuild-id} != ""
+LDFLAGS_BIN+=-Wl,--build-id=none
+.endif
 LD_FLAGS_BIN=-static -N --gc-sections
 
 .if ${MACHINE_CPUARCH} == "amd64"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340833 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 13:12:04 2018
New Revision: 340833
URL: https://svnweb.freebsd.org/changeset/base/340833

Log:
  sfxge(4): support inner checksum offload on transmit
  
  Inner checksum offloads may be used only if firmware supports
  these tunnels.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18102

Modified:
  head/sys/dev/sfxge/common/ef10_tx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_tx.c

Modified: head/sys/dev/sfxge/common/ef10_tx.c
==
--- head/sys/dev/sfxge/common/ef10_tx.c Fri Nov 23 12:03:01 2018
(r340832)
+++ head/sys/dev/sfxge/common/ef10_tx.c Fri Nov 23 13:12:04 2018
(r340833)
@@ -87,12 +87,16 @@ efx_mcdi_init_txq(
MCDI_IN_SET_DWORD(req, INIT_TXQ_IN_LABEL, label);
MCDI_IN_SET_DWORD(req, INIT_TXQ_IN_INSTANCE, instance);
 
-   MCDI_IN_POPULATE_DWORD_7(req, INIT_TXQ_IN_FLAGS,
+   MCDI_IN_POPULATE_DWORD_9(req, INIT_TXQ_IN_FLAGS,
INIT_TXQ_IN_FLAG_BUFF_MODE, 0,
INIT_TXQ_IN_FLAG_IP_CSUM_DIS,
(flags & EFX_TXQ_CKSUM_IPV4) ? 0 : 1,
INIT_TXQ_IN_FLAG_TCP_CSUM_DIS,
(flags & EFX_TXQ_CKSUM_TCPUDP) ? 0 : 1,
+   INIT_TXQ_EXT_IN_FLAG_INNER_IP_CSUM_EN,
+   (flags & EFX_TXQ_CKSUM_INNER_IPV4) ? 1 : 0,
+   INIT_TXQ_EXT_IN_FLAG_INNER_TCP_CSUM_EN,
+   (flags & EFX_TXQ_CKSUM_INNER_TCPUDP) ? 1 : 0,
INIT_TXQ_EXT_IN_FLAG_TSOV2_EN, (flags & EFX_TXQ_FATSOV2) ? 1 : 0,
INIT_TXQ_IN_FLAG_TCP_UDP_ONLY, 0,
INIT_TXQ_IN_CRC_MODE, 0,
@@ -197,14 +201,23 @@ ef10_tx_qcreate(
__inefx_txq_t *etp,
__out   unsigned int *addedp)
 {
+   efx_nic_cfg_t *encp = >en_nic_cfg;
+   uint16_t inner_csum;
efx_qword_t desc;
efx_rc_t rc;
 
_NOTE(ARGUNUSED(id))
 
+   inner_csum = EFX_TXQ_CKSUM_INNER_IPV4 | EFX_TXQ_CKSUM_INNER_TCPUDP;
+   if (((flags & inner_csum) != 0) &&
+   (encp->enc_tunnel_encapsulations_supported == 0)) {
+   rc = EINVAL;
+   goto fail1;
+   }
+
if ((rc = efx_mcdi_init_txq(enp, n, eep->ee_index, label, index, flags,
esmp)) != 0)
-   goto fail1;
+   goto fail2;
 
/*
 * A previous user of this TX queue may have written a descriptor to the
@@ -215,19 +228,25 @@ ef10_tx_qcreate(
 * a no-op TX option descriptor. See bug29981 for details.
 */
*addedp = 1;
-   EFX_POPULATE_QWORD_4(desc,
+   EFX_POPULATE_QWORD_6(desc,
ESF_DZ_TX_DESC_IS_OPT, 1,
ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_CRC_CSUM,
ESF_DZ_TX_OPTION_UDP_TCP_CSUM,
(flags & EFX_TXQ_CKSUM_TCPUDP) ? 1 : 0,
ESF_DZ_TX_OPTION_IP_CSUM,
-   (flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0);
+   (flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0,
+   ESF_DZ_TX_OPTION_INNER_UDP_TCP_CSUM,
+   (flags & EFX_TXQ_CKSUM_INNER_TCPUDP) ? 1 : 0,
+   ESF_DZ_TX_OPTION_INNER_IP_CSUM,
+   (flags & EFX_TXQ_CKSUM_INNER_IPV4) ? 1 : 0);
 
EFSYS_MEM_WRITEQ(etp->et_esmp, 0, );
ef10_tx_qpush(etp, *addedp, 0);
 
return (0);
 
+fail2:
+   EFSYS_PROBE(fail2);
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
 

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 12:03:01 2018
(r340832)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 13:12:04 2018
(r340833)
@@ -2111,9 +2111,11 @@ efx_tx_fini(
 
 #defineEFX_TXQ_MAX_BUFS 8 /* Maximum independent of 
EFX_BUG35388_WORKAROUND. */
 
-#defineEFX_TXQ_CKSUM_IPV4  0x0001
-#defineEFX_TXQ_CKSUM_TCPUDP0x0002
-#defineEFX_TXQ_FATSOV2 0x0004
+#defineEFX_TXQ_CKSUM_IPV4  0x0001
+#defineEFX_TXQ_CKSUM_TCPUDP0x0002
+#defineEFX_TXQ_FATSOV2 0x0004
+#defineEFX_TXQ_CKSUM_INNER_IPV40x0008
+#defineEFX_TXQ_CKSUM_INNER_TCPUDP  0x0010
 
 extern __checkReturn   efx_rc_t
 efx_tx_qcreate(

Modified: head/sys/dev/sfxge/common/efx_tx.c
==
--- head/sys/dev/sfxge/common/efx_tx.c  Fri Nov 23 12:03:01 2018
(r340832)
+++ head/sys/dev/sfxge/common/efx_tx.c  Fri Nov 23 13:12:04 2018
(r340833)
@@ -905,6 +905,7 @@ siena_tx_qcreate(
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_oword_t oword;
uint32_t size;
+   uint16_t inner_csum;
efx_rc_t rc;
 
_NOTE(ARGUNUSED(esmp))
@@ -934,6 +935,12 @@ siena_tx_qcreate(
goto fail3;
}
 
+   inner_csum = EFX_TXQ_CKSUM_INNER_IPV4 | EFX_TXQ_CKSUM_INNER_TCPUDP;
+   if ((flags & 

svn commit: r340832 - head/sys/dev/acpica

2018-11-23 Thread Tom Jones
Author: thj
Date: Fri Nov 23 12:03:01 2018
New Revision: 340832
URL: https://svnweb.freebsd.org/changeset/base/340832

Log:
  Add support for none ACPI battery method batteries
  
  Remove the requirement that a device be a ACPI method battery to be supported
  as a battery.
  
  Require now that the device be in the battery devclass and implement the
  get_status and get_info functions. This allows batteries which are not ACPI
  method batteries to be supported.
  
  Reviewed by: jtl
  Approved by: jtl (mentor)
  MFC after: 1 Month
  Differential Revision:https://reviews.freebsd.org/D17434

Modified:
  head/sys/dev/acpica/acpi_battery.c

Modified: head/sys/dev/acpica/acpi_battery.c
==
--- head/sys/dev/acpica/acpi_battery.c  Fri Nov 23 11:39:24 2018
(r340831)
+++ head/sys/dev/acpica/acpi_battery.c  Fri Nov 23 12:03:01 2018
(r340832)
@@ -169,14 +169,11 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba
dev_idx = i;
 
/*
-* Be sure we can get various info from the battery.  Note that
-* acpi_BatteryIsPresent() is not enough because smart batteries only
-* return that the device is present.
+* Be sure we can get various info from the battery.
 */
-   if (!acpi_BatteryIsPresent(batt_dev) ||
-   ACPI_BATT_GET_STATUS(batt_dev, [i]) != 0 ||
-   ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
-   continue;
+   if (ACPI_BATT_GET_STATUS(batt_dev, [i]) != 0 ||
+   ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
+   continue;
 
/* If a battery is not installed, we sometimes get strange values. */
if (!acpi_battery_bst_valid([i]) ||
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340831 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 11:39:24 2018
New Revision: 340831
URL: https://svnweb.freebsd.org/changeset/base/340831

Log:
  sfxge(4): make MAC naming consistent with other modules
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18101

Modified:
  head/sys/dev/sfxge/common/efx_mac.c

Modified: head/sys/dev/sfxge/common/efx_mac.c
==
--- head/sys/dev/sfxge/common/efx_mac.c Fri Nov 23 11:39:13 2018
(r340830)
+++ head/sys/dev/sfxge/common/efx_mac.c Fri Nov 23 11:39:24 2018
(r340831)
@@ -45,7 +45,7 @@ siena_mac_multicast_list_set(
 #endif /* EFSYS_OPT_SIENA */
 
 #if EFSYS_OPT_SIENA
-static const efx_mac_ops_t __efx_siena_mac_ops = {
+static const efx_mac_ops_t __efx_mac_siena_ops = {
siena_mac_poll, /* emo_poll */
siena_mac_up,   /* emo_up */
siena_mac_reconfigure,  /* emo_addr_set */
@@ -69,7 +69,7 @@ static const efx_mac_ops_t__efx_siena_mac_ops = {
 #endif /* EFSYS_OPT_SIENA */
 
 #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static const efx_mac_ops_t __efx_ef10_mac_ops = {
+static const efx_mac_ops_t __efx_mac_ef10_ops = {
ef10_mac_poll,  /* emo_poll */
ef10_mac_up,/* emo_up */
ef10_mac_addr_set,  /* emo_addr_set */
@@ -845,21 +845,21 @@ efx_mac_select(
switch (enp->en_family) {
 #if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
-   emop = &__efx_siena_mac_ops;
+   emop = &__efx_mac_siena_ops;
type = EFX_MAC_SIENA;
break;
 #endif /* EFSYS_OPT_SIENA */
 
 #if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
-   emop = &__efx_ef10_mac_ops;
+   emop = &__efx_mac_ef10_ops;
type = EFX_MAC_HUNTINGTON;
break;
 #endif /* EFSYS_OPT_HUNTINGTON */
 
 #if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
-   emop = &__efx_ef10_mac_ops;
+   emop = &__efx_mac_ef10_ops;
type = EFX_MAC_MEDFORD;
break;
 #endif /* EFSYS_OPT_MEDFORD */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340829 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 11:39:02 2018
New Revision: 340829
URL: https://svnweb.freebsd.org/changeset/base/340829

Log:
  sfxge(4): provide simple access to RxQ state in EvQ
  
  Packed stream Rx datapath requires access to packed stream state
  stored in event queue. Number of credits is upstead in event handler
  on a new buffer, packets parsing on 64k boundary crossing and
  Rx doorbell push to give credits back.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18099

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx_impl.h

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 11:38:50 2018
(r340828)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 11:39:02 2018
(r340829)
@@ -787,8 +787,7 @@ ef10_rx_qpush_ps_credits(
 {
efx_nic_t *enp = erp->er_enp;
efx_dword_t dword;
-   efx_evq_rxq_state_t *rxq_state =
-   >er_eep->ee_rxq_state[erp->er_label];
+   efx_evq_rxq_state_t *rxq_state = erp->er_ev_qstate;
uint32_t credits;
 
EFSYS_ASSERT(rxq_state->eers_rx_packed_stream);
@@ -837,8 +836,7 @@ ef10_rx_qps_packet_info(
uint16_t buf_len;
uint8_t *pkt_start;
efx_qword_t *qwordp;
-   efx_evq_rxq_state_t *rxq_state =
-   >er_eep->ee_rxq_state[erp->er_label];
+   efx_evq_rxq_state_t *rxq_state = erp->er_ev_qstate;
 
EFSYS_ASSERT(rxq_state->eers_rx_packed_stream);
 
@@ -996,6 +994,8 @@ ef10_rx_qcreate(
erp->er_label = label;
 
ef10_ev_rxlabel_init(eep, erp, label, type);
+
+   erp->er_ev_qstate = >er_eep->ee_rxq_state[label];
 
return (0);
 

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 11:38:50 2018
(r340828)
+++ head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 11:39:02 2018
(r340829)
@@ -757,6 +757,7 @@ struct efx_rxq_s {
unsigned inter_label;
unsigned inter_mask;
efsys_mem_t *er_esmp;
+   efx_evq_rxq_state_t *er_ev_qstate;
 };
 
 #defineEFX_RXQ_MAGIC   0x15022005
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340830 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 11:39:13 2018
New Revision: 340830
URL: https://svnweb.freebsd.org/changeset/base/340830

Log:
  sfxge(4): enforce packed stream fake buffer size
  
  In the case of packed stream real size of the buffer does not fit in
  Rx descriptor byte count. Real size is specified on Rx queue setup.
  Non-zero fake should be used to bypass hardware checks.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18100

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 11:39:02 2018
(r340829)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 11:39:13 2018
(r340830)
@@ -710,6 +710,14 @@ ef10_rx_prefix_hash(
 }
 #endif /* EFSYS_OPT_RX_SCALE */
 
+#if EFSYS_OPT_RX_PACKED_STREAM
+/*
+ * Fake length for RXQ descriptors in packed stream mode
+ * to make hardware happy
+ */
+#defineEFX_RXQ_PACKED_STREAM_FAKE_BUF_SIZE 32
+#endif
+
void
 ef10_rx_qpost(
__inefx_rxq_t *erp,
@@ -723,6 +731,15 @@ ef10_rx_qpost(
unsigned int i;
unsigned int offset;
unsigned int id;
+
+#if EFSYS_OPT_RX_PACKED_STREAM
+   /*
+* Real size of the buffer does not fit into ESF_DZ_RX_KER_BYTE_CNT
+* and equal to 0 after applying mask. Hardware does not like it.
+*/
+   if (erp->er_ev_qstate->eers_rx_packed_stream)
+   size = EFX_RXQ_PACKED_STREAM_FAKE_BUF_SIZE;
+#endif
 
/* The client driver must not overfill the queue */
EFSYS_ASSERT3U(added - completed + n, <=,

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 11:39:02 2018
(r340829)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 11:39:13 2018
(r340830)
@@ -2050,12 +2050,6 @@ efx_rx_qpush(
 
 #if EFSYS_OPT_RX_PACKED_STREAM
 
-/*
- * Fake length for RXQ descriptors in packed stream mode
- * to make hardware happy
- */
-#defineEFX_RXQ_PACKED_STREAM_FAKE_BUF_SIZE 32
-
 extern void
 efx_rx_qpush_ps_credits(
__inefx_rxq_t *erp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340828 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 11:38:50 2018
New Revision: 340828
URL: https://svnweb.freebsd.org/changeset/base/340828

Log:
  sfxge(4): improve RxQ label init prototype
  
  RxQ type provides more information which may be useful to
  setup event queue appropriately.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18098

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_rx.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Fri Nov 23 11:31:57 2018
(r340827)
+++ head/sys/dev/sfxge/common/ef10_ev.c Fri Nov 23 11:38:50 2018
(r340828)
@@ -1344,9 +1344,11 @@ ef10_ev_rxlabel_init(
__inefx_evq_t *eep,
__inefx_rxq_t *erp,
__inunsigned int label,
-   __inboolean_t packed_stream)
+   __inefx_rxq_type_t type)
 {
efx_evq_rxq_state_t *eersp;
+   boolean_t packed_stream = (type >= EFX_RXQ_TYPE_PACKED_STREAM_1M) &&
+   (type <= EFX_RXQ_TYPE_PACKED_STREAM_64K);
 
EFSYS_ASSERT3U(label, <, EFX_ARRAY_SIZE(eep->ee_rxq_state));
eersp = >ee_rxq_state[label];

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 11:31:57 2018
(r340827)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 11:38:50 2018
(r340828)
@@ -119,7 +119,7 @@ ef10_ev_rxlabel_init(
__inefx_evq_t *eep,
__inefx_rxq_t *erp,
__inunsigned int label,
-   __inboolean_t packed_stream);
+   __inefx_rxq_type_t type);
 
void
 ef10_ev_rxlabel_fini(

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 11:31:57 2018
(r340827)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 11:38:50 2018
(r340828)
@@ -995,7 +995,7 @@ ef10_rx_qcreate(
erp->er_eep = eep;
erp->er_label = label;
 
-   ef10_ev_rxlabel_init(eep, erp, label, ps_buf_size != 0);
+   ef10_ev_rxlabel_init(eep, erp, label, type);
 
return (0);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340827 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 11:31:57 2018
New Revision: 340827
URL: https://svnweb.freebsd.org/changeset/base/340827

Log:
  sfxge(4): support MUM/SUC firmware partitions
  
  Submitted by:   Andrew Lee 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18097

Modified:
  head/sys/dev/sfxge/common/ef10_nvram.c
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 11:31:45 2018
(r340826)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 11:31:57 2018
(r340827)
@@ -2173,6 +2173,7 @@ static ef10_parttbl_entry_t medford_parttbl[] = {
PARTN_MAP_ENTRY(FPGA_BACKUP,ALL,FPGA_BACKUP),
PARTN_MAP_ENTRY(LICENSE,ALL,LICENSE),
PARTN_MAP_ENTRY(EXPANSION_UEFI, ALL,UEFIROM),
+   PARTN_MAP_ENTRY(MUM_FIRMWARE,   ALL,MUM_FIRMWARE),
 };
 
 static __checkReturn   efx_rc_t

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 11:31:45 2018
(r340826)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 11:31:57 2018
(r340827)
@@ -1388,6 +1388,7 @@ typedef enum efx_nvram_type_e {
EFX_NVRAM_DYNAMIC_CFG,
EFX_NVRAM_LICENSE,
EFX_NVRAM_UEFIROM,
+   EFX_NVRAM_MUM_FIRMWARE,
EFX_NVRAM_NTYPES,
 } efx_nvram_type_t;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340826 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 11:31:45 2018
New Revision: 340826
URL: https://svnweb.freebsd.org/changeset/base/340826

Log:
  sfxge(4): fix ignoring function return value
  
  fix PreFAST issue, add missing annotation that function return value
  should not be ignored. Fix alignment.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18096

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_phy.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:22:01 2018
(r340825)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 11:31:45 2018
(r340826)
@@ -920,13 +920,13 @@ efx_phy_media_type_get(
__inefx_nic_t *enp,
__out   efx_phy_media_type_t *typep);
 
-extern efx_rc_t
+extern __checkReturn   efx_rc_t
 efx_phy_module_get_info(
-   __inefx_nic_t *enp,
-   __inuint8_t dev_addr,
-   __inuint8_t offset,
-   __inuint8_t len,
-   __out_bcount(len)   uint8_t *data);
+   __inefx_nic_t *enp,
+   __inuint8_t dev_addr,
+   __inuint8_t offset,
+   __inuint8_t len,
+   __out_bcount(len)   uint8_t *data);
 
 #if EFSYS_OPT_PHY_STATS
 

Modified: head/sys/dev/sfxge/common/efx_phy.c
==
--- head/sys/dev/sfxge/common/efx_phy.c Fri Nov 23 10:22:01 2018
(r340825)
+++ head/sys/dev/sfxge/common/efx_phy.c Fri Nov 23 11:31:45 2018
(r340826)
@@ -301,7 +301,7 @@ efx_phy_media_type_get(
*typep = epp->ep_fixed_port_type;
 }
 
-   __checkReturn   efx_rc_t
+   __checkReturn   efx_rc_t
 efx_phy_module_get_info(
__inefx_nic_t *enp,
__inuint8_t dev_addr,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340823 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:21:36 2018
New Revision: 340823
URL: https://svnweb.freebsd.org/changeset/base/340823

Log:
  sfxge(4): precheck and verify flash writes
  
  Read existing flash content before writing, so the flash write can be
  avoided if the existing partition content matches the new image. This
  avoids unnecessary write cycles for the flash device, and may also be
  faster. If the flash does need to be updated, verify the content after
  writing.
  
  Note that reading the flash content after writing but before calling
  efx_nvram-rw_finish() avoids firmware bug68170, which can lead to
  signed image updates failing on Medford.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18093

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nvram.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nvram.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 10:21:28 2018
(r340822)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 10:21:36 2018
(r340823)
@@ -445,6 +445,14 @@ ef10_nvram_partn_read(
__insize_t size);
 
 extern __checkReturn   efx_rc_t
+ef10_nvram_partn_read_backup(
+   __inefx_nic_t *enp,
+   __inuint32_t partn,
+   __inunsigned int offset,
+   __out_bcount(size)  caddr_t data,
+   __insize_t size);
+
+extern __checkReturn   efx_rc_t
 ef10_nvram_partn_erase(
__inefx_nic_t *enp,
__inuint32_t partn,

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:21:28 2018
(r340822)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:21:36 2018
(r340823)
@@ -1940,11 +1940,34 @@ ef10_nvram_partn_read(
__insize_t size)
 {
/*
-* Read requests which come in through the EFX API expect to
-* read the current, active partition.
+* An A/B partition has two data stores (current and backup).
+* Read requests which come in through the EFX API expect to read the
+* current, active store of an A/B partition. For non A/B partitions,
+* there is only a single store and so the mode param is ignored.
 */
return ef10_nvram_partn_read_mode(enp, partn, offset, data, size,
MC_CMD_NVRAM_READ_IN_V2_TARGET_CURRENT);
+}
+
+   __checkReturn   efx_rc_t
+ef10_nvram_partn_read_backup(
+   __inefx_nic_t *enp,
+   __inuint32_t partn,
+   __inunsigned int offset,
+   __out_bcount(size)  caddr_t data,
+   __insize_t size)
+{
+   /*
+* An A/B partition has two data stores (current and backup).
+* Read the backup store of an A/B partition (i.e. the store currently
+* being written to if the partition is locked).
+*
+* This is needed when comparing the existing partition content to avoid
+* unnecessary writes, or to read back what has been written to check
+* that the writes have succeeded.
+*/
+   return ef10_nvram_partn_read_mode(enp, partn, offset, data, size,
+   MC_CMD_NVRAM_READ_IN_V2_TARGET_BACKUP);
 }
 
__checkReturn   efx_rc_t

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:21:28 2018
(r340822)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:21:36 2018
(r340823)
@@ -1437,6 +1437,14 @@ efx_nvram_read_chunk(
__insize_t size);
 
 extern __checkReturn   efx_rc_t
+efx_nvram_read_backup(
+   __inefx_nic_t *enp,
+   __inefx_nvram_type_t type,
+   __inunsigned int offset,
+   __out_bcount(size)  caddr_t data,
+   __insize_t size);
+
+extern __checkReturn   efx_rc_t
 efx_nvram_set_version(
__inefx_nic_t *enp,
__inefx_nvram_type_t type,

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 10:21:28 2018
(r340822)
+++ head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 10:21:36 2018

svn commit: r340825 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:22:01 2018
New Revision: 340825
URL: https://svnweb.freebsd.org/changeset/base/340825

Log:
  sfxge(4): quieten get version methods
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18095

Modified:
  head/sys/dev/sfxge/common/efx_nvram.c

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:21:50 2018
(r340824)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:22:01 2018
(r340825)
@@ -613,7 +613,7 @@ efx_mcdi_nvram_metadata(
 
MCDI_IN_SET_DWORD(req, NVRAM_METADATA_IN_TYPE, partn);
 
-   efx_mcdi_execute(enp, );
+   efx_mcdi_execute_quiet(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340820 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:21:06 2018
New Revision: 340820
URL: https://svnweb.freebsd.org/changeset/base/340820

Log:
  sfxge(4): check NVRAM locking by partition ID
  
  Tracking which partition is locked avoids being overly conservative
  when EFX_NVRAM_xxx maps to more than one partition (depnding on the
  current port number).
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18090

Modified:
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nvram.c

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 10:20:55 2018
(r340819)
+++ head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 10:21:06 2018
(r340820)
@@ -457,6 +457,10 @@ typedef struct efx_mcdi_s {
 #endif /* EFSYS_OPT_MCDI */
 
 #if EFSYS_OPT_NVRAM
+
+/* Invalid partition ID for en_nvram_partn_locked field of efx_nc_t */
+#defineEFX_NVRAM_PARTN_INVALID (0xu)
+
 typedef struct efx_nvram_ops_s {
 #if EFSYS_OPT_DIAG
efx_rc_t(*envo_test)(efx_nic_t *);
@@ -644,7 +648,7 @@ struct efx_nic_s {
efx_mcdi_t  en_mcdi;
 #endif /* EFSYS_OPT_MCDI */
 #if EFSYS_OPT_NVRAM
-   efx_nvram_type_ten_nvram_locked;
+   uint32_ten_nvram_partn_locked;
const efx_nvram_ops_t   *en_envop;
 #endif /* EFSYS_OPT_NVRAM */
 #if EFSYS_OPT_VPD

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:55 2018
(r340819)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:21:06 2018
(r340820)
@@ -117,6 +117,8 @@ efx_nvram_init(
enp->en_envop = envop;
enp->en_mod_flags |= EFX_MOD_NVRAM;
 
+   enp->en_nvram_partn_locked = EFX_NVRAM_PARTN_INVALID;
+
return (0);
 
 fail1:
@@ -232,15 +234,15 @@ efx_nvram_rw_start(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
 
-   EFSYS_ASSERT3U(enp->en_nvram_locked, ==, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
+   EFSYS_ASSERT3U(enp->en_nvram_partn_locked, ==, EFX_NVRAM_PARTN_INVALID);
+
if ((rc = envop->envo_partn_rw_start(enp, partn, chunk_sizep)) != 0)
goto fail2;
 
-   enp->en_nvram_locked = type;
+   enp->en_nvram_partn_locked = partn;
 
return (0);
 
@@ -270,11 +272,11 @@ efx_nvram_read_chunk(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
 
-   EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
+   EFSYS_ASSERT3U(enp->en_nvram_partn_locked, ==, partn);
+
if ((rc = envop->envo_partn_read(enp, partn, offset, data, size)) != 0)
goto fail2;
 
@@ -305,11 +307,11 @@ efx_nvram_erase(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
 
-   EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
+   EFSYS_ASSERT3U(enp->en_nvram_partn_locked, ==, partn);
+
if ((rc = envop->envo_partn_size(enp, partn, )) != 0)
goto fail2;
 
@@ -346,11 +348,11 @@ efx_nvram_write_chunk(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
 
-   EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
+   EFSYS_ASSERT3U(enp->en_nvram_partn_locked, ==, partn);
+
if ((rc = envop->envo_partn_write(enp, partn, offset, data, size)) != 0)
goto fail2;
 
@@ -381,15 +383,15 @@ efx_nvram_rw_finish(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
 
-   EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
+   EFSYS_ASSERT3U(enp->en_nvram_partn_locked, ==, partn);
+
if ((rc = envop->envo_partn_rw_finish(enp, partn, _result)) != 0)
goto fail2;
 
-   enp->en_nvram_locked = EFX_NVRAM_INVALID;
+   enp->en_nvram_partn_locked = EFX_NVRAM_PARTN_INVALID;
 
if (verify_resultp != NULL)
*verify_resultp = verify_result;
@@ -398,7 +400,7 @@ efx_nvram_rw_finish(
 
 fail2:
EFSYS_PROBE(fail2);
-   enp->en_nvram_locked = EFX_NVRAM_INVALID;
+   enp->en_nvram_partn_locked = EFX_NVRAM_PARTN_INVALID;
 
 fail1:
EFSYS_PROBE1(fail1, 

svn commit: r340822 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:21:28 2018
New Revision: 340822
URL: https://svnweb.freebsd.org/changeset/base/340822

Log:
  sfxge(4): fix check in NVRAM validate
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18092

Modified:
  head/sys/dev/sfxge/common/efx_nvram.c

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:21:17 2018
(r340821)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:21:28 2018
(r340822)
@@ -473,10 +473,11 @@ efx_nvram_validate(
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
-   if (envop->envo_type_to_partn != NULL &&
-   ((rc = envop->envo_buffer_validate(enp, partn,
-   partn_data, partn_size)) != 0))
-   goto fail2;
+   if (envop->envo_buffer_validate != NULL) {
+   if ((rc = envop->envo_buffer_validate(enp, partn,
+   partn_data, partn_size)) != 0)
+   goto fail2;
+   }
 
return (0);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340821 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:21:17 2018
New Revision: 340821
URL: https://svnweb.freebsd.org/changeset/base/340821

Log:
  sfxge(4): report correct partition write chunk size
  
  If the firmware reports a non-zero write chunk size then nvram writes
  may fail if a different granularity is used (e.g. for MUM firmware on
  Sorrento).
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18091

Modified:
  head/sys/dev/sfxge/common/ef10_nvram.c

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:21:06 2018
(r340820)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:21:17 2018
(r340821)
@@ -2313,16 +2313,27 @@ ef10_nvram_partn_rw_start(
__inuint32_t partn,
__out   size_t *chunk_sizep)
 {
+   uint32_t write_size = 0;
efx_rc_t rc;
 
-   if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0)
+   if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
+   NULL, _size)) != 0)
goto fail1;
 
-   if (chunk_sizep != NULL)
-   *chunk_sizep = EF10_NVRAM_CHUNK;
+   if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0)
+   goto fail2;
 
+   if (chunk_sizep != NULL) {
+   if (write_size == 0)
+   *chunk_sizep = EF10_NVRAM_CHUNK;
+   else
+   *chunk_sizep = write_size;
+   }
+
return (0);
 
+fail2:
+   EFSYS_PROBE(fail2);
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340824 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:21:50 2018
New Revision: 340824
URL: https://svnweb.freebsd.org/changeset/base/340824

Log:
  sfxge(4): remove duplicate NVRAM asserts
  
  The checking performed in the ->envo_type_to_partn
  internal method make these assertions unnecessary.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18094

Modified:
  head/sys/dev/sfxge/common/ef10_nvram.c
  head/sys/dev/sfxge/common/efx_nvram.c
  head/sys/dev/sfxge/common/siena_nvram.c

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:21:36 2018
(r340823)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:21:50 2018
(r340824)
@@ -2210,6 +2210,7 @@ ef10_nvram_type_to_partn(
size_t parttbl_rows = 0;
unsigned int i;
 
+   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
EFSYS_ASSERT(partnp != NULL);
 

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:21:36 2018
(r340823)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:21:50 2018
(r340824)
@@ -167,8 +167,6 @@ efx_nvram_size(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -201,8 +199,6 @@ efx_nvram_get_version(
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -233,9 +229,6 @@ efx_nvram_rw_start(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -271,9 +264,6 @@ efx_nvram_read_chunk(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -312,9 +302,6 @@ efx_nvram_read_backup(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -348,9 +335,6 @@ efx_nvram_erase(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -389,9 +373,6 @@ efx_nvram_write_chunk(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -424,9 +405,6 @@ efx_nvram_rw_finish(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-   EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -470,8 +448,6 @@ efx_nvram_set_version(
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
 
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;
 
@@ -510,9 +486,6 @@ efx_nvram_validate(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
-
-   EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
-
 
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;

Modified: head/sys/dev/sfxge/common/siena_nvram.c

svn commit: r340819 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:20:55 2018
New Revision: 340819
URL: https://svnweb.freebsd.org/changeset/base/340819

Log:
  sfxge(4): simplify NVRAM type to partition mappings
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18089

Modified:
  head/sys/dev/sfxge/common/ef10_nvram.c

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:20:44 2018
(r340818)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:20:55 2018
(r340819)
@@ -2109,83 +2109,47 @@ fail1:
 
 typedef struct ef10_parttbl_entry_s {
unsigned intpartn;
-   unsigned intport;
+   unsigned intport_mask;
efx_nvram_type_tnvtype;
 } ef10_parttbl_entry_t;
 
+/* Port mask values */
+#definePORT_1  (1u << 1)
+#definePORT_2  (1u << 2)
+#definePORT_3  (1u << 3)
+#definePORT_4  (1u << 4)
+#definePORT_ALL(0xu)
+
+#definePARTN_MAP_ENTRY(partn, port_mask, nvtype)   \
+{ (NVRAM_PARTITION_TYPE_##partn), (PORT_##port_mask), (EFX_NVRAM_##nvtype) }
+
 /* Translate EFX NVRAM types to firmware partition types */
 static ef10_parttbl_entry_t hunt_parttbl[] = {
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 1, EFX_NVRAM_MC_FIRMWARE},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 2, EFX_NVRAM_MC_FIRMWARE},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 3, EFX_NVRAM_MC_FIRMWARE},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 4, EFX_NVRAM_MC_FIRMWARE},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP,  1, EFX_NVRAM_MC_GOLDEN},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP,  2, EFX_NVRAM_MC_GOLDEN},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP,  3, EFX_NVRAM_MC_GOLDEN},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP,  4, EFX_NVRAM_MC_GOLDEN},
-   {NVRAM_PARTITION_TYPE_EXPANSION_ROM,   1, EFX_NVRAM_BOOTROM},
-   {NVRAM_PARTITION_TYPE_EXPANSION_ROM,   2, EFX_NVRAM_BOOTROM},
-   {NVRAM_PARTITION_TYPE_EXPANSION_ROM,   3, EFX_NVRAM_BOOTROM},
-   {NVRAM_PARTITION_TYPE_EXPANSION_ROM,   4, EFX_NVRAM_BOOTROM},
-   {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT0, 1, EFX_NVRAM_BOOTROM_CFG},
-   {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT1, 2, EFX_NVRAM_BOOTROM_CFG},
-   {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT2, 3, EFX_NVRAM_BOOTROM_CFG},
-   {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT3, 4, EFX_NVRAM_BOOTROM_CFG},
-   {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG,  1, EFX_NVRAM_DYNAMIC_CFG},
-   {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG,  2, EFX_NVRAM_DYNAMIC_CFG},
-   {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG,  3, EFX_NVRAM_DYNAMIC_CFG},
-   {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG,  4, EFX_NVRAM_DYNAMIC_CFG},
-   {NVRAM_PARTITION_TYPE_FPGA,1, EFX_NVRAM_FPGA},
-   {NVRAM_PARTITION_TYPE_FPGA,2, EFX_NVRAM_FPGA},
-   {NVRAM_PARTITION_TYPE_FPGA,3, EFX_NVRAM_FPGA},
-   {NVRAM_PARTITION_TYPE_FPGA,4, EFX_NVRAM_FPGA},
-   {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 1, EFX_NVRAM_FPGA_BACKUP},
-   {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 2, EFX_NVRAM_FPGA_BACKUP},
-   {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 3, EFX_NVRAM_FPGA_BACKUP},
-   {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 4, EFX_NVRAM_FPGA_BACKUP},
-   {NVRAM_PARTITION_TYPE_LICENSE, 1, EFX_NVRAM_LICENSE},
-   {NVRAM_PARTITION_TYPE_LICENSE, 2, EFX_NVRAM_LICENSE},
-   {NVRAM_PARTITION_TYPE_LICENSE, 3, EFX_NVRAM_LICENSE},
-   {NVRAM_PARTITION_TYPE_LICENSE, 4, EFX_NVRAM_LICENSE}
+   /*  partn   ports   nvtype */
+   PARTN_MAP_ENTRY(MC_FIRMWARE,ALL,MC_FIRMWARE),
+   PARTN_MAP_ENTRY(MC_FIRMWARE_BACKUP, ALL,MC_GOLDEN),
+   PARTN_MAP_ENTRY(EXPANSION_ROM,  ALL,BOOTROM),
+   PARTN_MAP_ENTRY(EXPROM_CONFIG_PORT0,1,  BOOTROM_CFG),
+   PARTN_MAP_ENTRY(EXPROM_CONFIG_PORT1,2,  BOOTROM_CFG),
+   PARTN_MAP_ENTRY(EXPROM_CONFIG_PORT2,3,  BOOTROM_CFG),
+   PARTN_MAP_ENTRY(EXPROM_CONFIG_PORT3,4,  BOOTROM_CFG),
+   PARTN_MAP_ENTRY(DYNAMIC_CONFIG, ALL,DYNAMIC_CFG),
+   PARTN_MAP_ENTRY(FPGA,   ALL,FPGA),
+   PARTN_MAP_ENTRY(FPGA_BACKUP,ALL,FPGA_BACKUP),
+   PARTN_MAP_ENTRY(LICENSE,ALL,LICENSE),
 };
 
 static ef10_parttbl_entry_t medford_parttbl[] = {
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 1, EFX_NVRAM_MC_FIRMWARE},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 2, EFX_NVRAM_MC_FIRMWARE},
-   {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 3, EFX_NVRAM_MC_FIRMWARE},
-   

svn commit: r340817 - in head/sys/dev/sfxge: . common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:20:32 2018
New Revision: 340817
URL: https://svnweb.freebsd.org/changeset/base/340817

Log:
  sfxge(4): extend NVRAM RW finish to return verify result
  
  Extend efx_nvram_rw_finish() to return firmware verify result code.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18087

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_bootcfg.c
  head/sys/dev/sfxge/common/efx_nvram.c
  head/sys/dev/sfxge/sfxge_nvram.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:20:20 2018
(r340816)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:20:32 2018
(r340817)
@@ -1418,7 +1418,8 @@ efx_nvram_rw_start(
 extern __checkReturn   efx_rc_t
 efx_nvram_rw_finish(
__inefx_nic_t *enp,
-   __inefx_nvram_type_t type);
+   __inefx_nvram_type_t type,
+   __out_opt   uint32_t *verify_resultp);
 
 extern __checkReturn   efx_rc_t
 efx_nvram_get_version(

Modified: head/sys/dev/sfxge/common/efx_bootcfg.c
==
--- head/sys/dev/sfxge/common/efx_bootcfg.c Fri Nov 23 10:20:20 2018
(r340816)
+++ head/sys/dev/sfxge/common/efx_bootcfg.c Fri Nov 23 10:20:32 2018
(r340817)
@@ -350,11 +350,11 @@ efx_bootcfg_read(
 
if ((rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG,
sector_offset, (caddr_t)payload, sector_length)) != 0) {
-   (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG);
+   (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL);
goto fail6;
}
 
-   if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG)) != 0)
+   if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0)
goto fail7;
 
/* Verify that the area is correctly formatted and checksummed */
@@ -526,7 +526,7 @@ efx_bootcfg_write(
0, (caddr_t)partn_data, partn_length)) != 0)
goto fail11;
 
-   if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG)) != 0)
+   if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0)
goto fail12;
 
EFSYS_KMEM_FREE(enp->en_esip, partn_length, partn_data);
@@ -542,7 +542,7 @@ fail10:
 fail9:
EFSYS_PROBE(fail9);
 
-   (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG);
+   (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL);
 fail8:
EFSYS_PROBE(fail8);
 

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:20 2018
(r340816)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:32 2018
(r340817)
@@ -367,11 +367,12 @@ fail1:
__checkReturn   efx_rc_t
 efx_nvram_rw_finish(
__inefx_nic_t *enp,
-   __inefx_nvram_type_t type)
+   __inefx_nvram_type_t type,
+   __out_opt   uint32_t *verify_resultp)
 {
const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
-   uint32_t verify_result;
+   uint32_t verify_result = 0;
efx_rc_t rc;
 
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -390,6 +391,9 @@ efx_nvram_rw_finish(
 
enp->en_nvram_locked = EFX_NVRAM_INVALID;
 
+   if (verify_resultp != NULL)
+   *verify_resultp = verify_result;
+
return (0);
 
 fail2:
@@ -398,6 +402,10 @@ fail2:
 
 fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   /* Always report verification result */
+   if (verify_resultp != NULL)
+   *verify_resultp = verify_result;
 
return (rc);
 }

Modified: head/sys/dev/sfxge/sfxge_nvram.c
==
--- head/sys/dev/sfxge/sfxge_nvram.cFri Nov 23 10:20:20 2018
(r340816)
+++ head/sys/dev/sfxge/sfxge_nvram.cFri Nov 23 10:20:32 2018
(r340817)
@@ -104,7 +104,7 @@ sfxge_nvram_rw(struct sfxge_softc *sc, sfxge_ioc_t *ip
 
 fail3:
free(buf, M_TEMP);
-   efx_nvram_rw_finish(enp, type);
+   efx_nvram_rw_finish(enp, type, NULL);
 fail1:
return (rc);
 }
@@ -125,7 +125,7 @@ sfxge_nvram_erase(struct sfxge_softc *sc, efx_nvram_ty
 
rc = efx_nvram_erase(enp, type);
 
-   efx_nvram_rw_finish(enp, type);
+   efx_nvram_rw_finish(enp, type, NULL);
return (rc);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all

svn commit: r340818 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:20:44 2018
New Revision: 340818
URL: https://svnweb.freebsd.org/changeset/base/340818

Log:
  sfxge(4): rename firmware update verify result cap field
  
  The existing name confuses support for secure boot with
  support for reporting a verify result after an NVRAM update.
  
  As the capability only reports support for returning a verify
  result, change the name to be less confusing.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18088

Modified:
  head/sys/dev/sfxge/common/ef10_mcdi.c
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_nvram.c
  head/sys/dev/sfxge/common/siena_nic.c

Modified: head/sys/dev/sfxge/common/ef10_mcdi.c
==
--- head/sys/dev/sfxge/common/ef10_mcdi.c   Fri Nov 23 10:20:32 2018
(r340817)
+++ head/sys/dev/sfxge/common/ef10_mcdi.c   Fri Nov 23 10:20:44 2018
(r340818)
@@ -133,7 +133,7 @@ ef10_mcdi_get_timeout(
case MC_CMD_NVRAM_ERASE:
case MC_CMD_LICENSING_V3:
case MC_CMD_NVRAM_UPDATE_FINISH:
-   if (encp->enc_fw_verified_nvram_update_required != B_FALSE) {
+   if (encp->enc_nvram_update_verify_result_supported != B_FALSE) {
/*
 * Potentially longer running commands, which firmware
 * may choose to process in a background thread.

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cFri Nov 23 10:20:32 2018
(r340817)
+++ head/sys/dev/sfxge/common/ef10_nic.cFri Nov 23 10:20:44 2018
(r340818)
@@ -1057,7 +1057,7 @@ ef10_get_datapath_caps(
 * and version 2 of MC_CMD_NVRAM_UPDATE_FINISH (to verify the updated
 * partition and report the result).
 */
-   encp->enc_fw_verified_nvram_update_required =
+   encp->enc_nvram_update_verify_result_supported =
CAP_FLAG2(flags2, NVRAM_UPDATE_REPORT_VERIFY_RESULT) ?
B_TRUE : B_FALSE;
 

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:20:32 2018
(r340817)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 10:20:44 2018
(r340818)
@@ -1213,7 +1213,7 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_required_pcie_bandwidth_mbps;
uint32_tenc_max_pcie_link_gen;
/* Firmware verifies integrity of NVRAM updates */
-   uint32_tenc_fw_verified_nvram_update_required;
+   uint32_tenc_nvram_update_verify_result_supported;
 } efx_nic_cfg_t;
 
 #defineEFX_PCI_FUNCTION_IS_PF(_encp)   ((_encp)->enc_vf == 0x)

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:32 2018
(r340817)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:44 2018
(r340818)
@@ -960,8 +960,8 @@ efx_mcdi_nvram_update_finish(
 
if (req.emr_out_length_used < MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) {
verify_result = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
-   if (encp->enc_fw_verified_nvram_update_required) {
-   /* Mandatory verification result is missing */
+   if (encp->enc_nvram_update_verify_result_supported) {
+   /* Result of update verification is missing */
rc = EMSGSIZE;
goto fail2;
}
@@ -970,9 +970,9 @@ efx_mcdi_nvram_update_finish(
MCDI_OUT_DWORD(req, NVRAM_UPDATE_FINISH_V2_OUT_RESULT_CODE);
}
 
-   if ((encp->enc_fw_verified_nvram_update_required) &&
+   if ((encp->enc_nvram_update_verify_result_supported) &&
(verify_result != MC_CMD_NVRAM_VERIFY_RC_SUCCESS)) {
-   /* Mandatory verification failed */
+   /* Update verification failed */
rc = EINVAL;
goto fail3;
}

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Fri Nov 23 10:20:32 2018
(r340817)
+++ head/sys/dev/sfxge/common/siena_nic.c   Fri Nov 23 10:20:44 2018
(r340818)
@@ -179,7 +179,7 @@ siena_board_cfg(
encp->enc_required_pcie_bandwidth_mbps = 2 * 1;
encp->enc_max_pcie_link_gen = EFX_PCIE_LINK_SPEED_GEN2;
 
-   encp->enc_fw_verified_nvram_update_required = B_FALSE;
+   

svn commit: r340815 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:20:08 2018
New Revision: 340815
URL: https://svnweb.freebsd.org/changeset/base/340815

Log:
  sfxge(4): simplify verify result handling
  
  Simplify verify result handling in NVRAM update finish
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18085

Modified:
  head/sys/dev/sfxge/common/efx_nvram.c

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:19:57 2018
(r340814)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:08 2018
(r340815)
@@ -949,24 +949,23 @@ efx_mcdi_nvram_update_finish(
goto fail1;
}
 
-   if (encp->enc_fw_verified_nvram_update_required == B_FALSE) {
-   /* Report success if verified updates are not supported. */
-   result = MC_CMD_NVRAM_VERIFY_RC_SUCCESS;
-   } else {
-   /* Firmware-verified NVRAM updates are required */
-   if (req.emr_out_length_used <
-   MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) {
+   if (req.emr_out_length_used < MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) {
+   result = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
+   if (encp->enc_fw_verified_nvram_update_required) {
+   /* Mandatory verification result is missing */
rc = EMSGSIZE;
goto fail2;
}
+   } else {
result =
MCDI_OUT_DWORD(req, NVRAM_UPDATE_FINISH_V2_OUT_RESULT_CODE);
+   }
 
-   if (result != MC_CMD_NVRAM_VERIFY_RC_SUCCESS) {
-   /* Mandatory verification failed */
-   rc = EINVAL;
-   goto fail3;
-   }
+   if ((encp->enc_fw_verified_nvram_update_required) &&
+   (result != MC_CMD_NVRAM_VERIFY_RC_SUCCESS)) {
+   /* Mandatory verification failed */
+   rc = EINVAL;
+   goto fail3;
}
 
if (resultp != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340814 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:19:57 2018
New Revision: 340814
URL: https://svnweb.freebsd.org/changeset/base/340814

Log:
  sfxge(4): fix result code in MCDI NVRAM update finish
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18084

Modified:
  head/sys/dev/sfxge/common/efx_nvram.c

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:19:46 2018
(r340813)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:19:57 2018
(r340814)
@@ -926,7 +926,7 @@ efx_mcdi_nvram_update_finish(
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN,
MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN)];
-   uint32_t result = 0; /* FIXME: use MC_CMD_NVRAM_VERIFY_RC_UNKNOWN */
+   uint32_t result = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
efx_rc_t rc;
 
(void) memset(payload, 0, sizeof (payload));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340816 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:20:20 2018
New Revision: 340816
URL: https://svnweb.freebsd.org/changeset/base/340816

Log:
  sfxge(4): report verify result from RW finish callback
  
  This makes the verify result visible to efx_nvram_rw_finish(), which
  can be extended to report it in a later patch.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18086

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nvram.c
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nvram.c
  head/sys/dev/sfxge/common/siena_impl.h
  head/sys/dev/sfxge/common/siena_nvram.c
  head/sys/dev/sfxge/common/siena_vpd.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 10:20:08 2018
(r340815)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 10:20:20 2018
(r340816)
@@ -462,7 +462,8 @@ ef10_nvram_partn_write(
 extern __checkReturn   efx_rc_t
 ef10_nvram_partn_rw_finish(
__inefx_nic_t *enp,
-   __inuint32_t partn);
+   __inuint32_t partn,
+   __out_opt   uint32_t *verify_resultp);
 
 extern __checkReturn   efx_rc_t
 ef10_nvram_partn_get_version(

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==
--- head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:20:08 2018
(r340815)
+++ head/sys/dev/sfxge/common/ef10_nvram.c  Fri Nov 23 10:20:20 2018
(r340816)
@@ -2050,15 +2050,15 @@ fail1:
 ef10_nvram_partn_unlock(
__inefx_nic_t *enp,
__inuint32_t partn,
-   __out_opt   uint32_t *resultp)
+   __out_opt   uint32_t *verify_resultp)
 {
boolean_t reboot = B_FALSE;
efx_rc_t rc;
 
-   if (resultp != NULL)
-   *resultp = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
+   if (verify_resultp != NULL)
+   *verify_resultp = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
 
-   rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, resultp);
+   rc = efx_mcdi_nvram_update_finish(enp, partn, reboot, verify_resultp);
if (rc != 0)
goto fail1;
 
@@ -2368,11 +2368,12 @@ fail1:
__checkReturn   efx_rc_t
 ef10_nvram_partn_rw_finish(
__inefx_nic_t *enp,
-   __inuint32_t partn)
+   __inuint32_t partn,
+   __out_opt   uint32_t *verify_resultp)
 {
efx_rc_t rc;
 
-   if ((rc = ef10_nvram_partn_unlock(enp, partn, NULL)) != 0)
+   if ((rc = ef10_nvram_partn_unlock(enp, partn, verify_resultp)) != 0)
goto fail1;
 
return (0);

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 10:20:08 2018
(r340815)
+++ head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 10:20:20 2018
(r340816)
@@ -471,7 +471,8 @@ typedef struct efx_nvram_ops_s {
unsigned int, size_t);
efx_rc_t(*envo_partn_write)(efx_nic_t *, uint32_t,
unsigned int, caddr_t, size_t);
-   efx_rc_t(*envo_partn_rw_finish)(efx_nic_t *, uint32_t);
+   efx_rc_t(*envo_partn_rw_finish)(efx_nic_t *, uint32_t,
+   uint32_t *);
efx_rc_t(*envo_partn_get_version)(efx_nic_t *, uint32_t,
uint32_t *, uint16_t *);
efx_rc_t(*envo_partn_set_version)(efx_nic_t *, uint32_t,
@@ -560,7 +561,7 @@ efx_mcdi_nvram_update_finish(
__inefx_nic_t *enp,
__inuint32_t partn,
__inboolean_t reboot,
-   __out_opt   uint32_t *resultp);
+   __out_opt   uint32_t *verify_resultp);
 
 #if EFSYS_OPT_DIAG
 

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==
--- head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:08 2018
(r340815)
+++ head/sys/dev/sfxge/common/efx_nvram.c   Fri Nov 23 10:20:20 2018
(r340816)
@@ -371,6 +371,7 @@ efx_nvram_rw_finish(
 {
const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
+   uint32_t verify_result;
efx_rc_t rc;
 
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -384,7 +385,7 @@ efx_nvram_rw_finish(
if ((rc = envop->envo_type_to_partn(enp, type, )) != 0)
goto fail1;

svn commit: r340813 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 10:19:46 2018
New Revision: 340813
URL: https://svnweb.freebsd.org/changeset/base/340813

Log:
  sfxge(4): copy new header from firmware src
  
  Submitted by:   Andrew Jackson 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18083

Modified:
  head/sys/dev/sfxge/common/siena_flash.h

Modified: head/sys/dev/sfxge/common/siena_flash.h
==
--- head/sys/dev/sfxge/common/siena_flash.h Fri Nov 23 09:16:07 2018
(r340812)
+++ head/sys/dev/sfxge/common/siena_flash.h Fri Nov 23 10:19:46 2018
(r340813)
@@ -117,15 +117,21 @@ typedef struct siena_mc_boot_hdr_s {  /* 
GENERATED BY 
efx_word_t  checksum;   /* of whole header area + 
firmware image */
efx_word_t  firmware_version_d;
efx_byte_t  mcfw_subtype;
-   efx_byte_t  generation; /* Valid for medford, SBZ for 
earlier chips */
+   efx_byte_t  generation; /* MC (Medford and later): MC 
partition generation when */
+   /* written to NVRAM. */
+   /* MUM & SUC images: subtype. */
+   /* (Otherwise set to 0) */
efx_dword_t firmware_text_offset;   /* offset to firmware .text */
efx_dword_t firmware_text_size; /* length of firmware .text, in 
bytes */
efx_dword_t firmware_data_offset;   /* offset to firmware .data */
efx_dword_t firmware_data_size; /* length of firmware .data, in 
bytes */
efx_byte_t  spi_rate;   /* SPI rate for reading image, 
0 is BootROM default */
efx_byte_t  spi_phase_adj;  /* SPI SDO/SCL phase 
adjustment, 0 is default (no adj) */
-   efx_word_t  xpm_sector; /* The sector that contains the 
key, or 0x if unsigned (medford) SBZ (earlier) */
-   efx_dword_t reserved_c[7];  /* (set to 0) */
+   efx_word_t  xpm_sector; /* XPM (MEDFORD and later): The 
sector that contains */
+   /* the key, or 0x if 
unsigned. (Otherwise set to 0) */
+   efx_byte_t  mumfw_subtype;  /* MUM & SUC images: subtype. 
(Otherwise set to 0) */
+   efx_byte_t  reserved_b[3];  /* (set to 0) */
+   efx_dword_t reserved_c[6];  /* (set to 0) */
 } siena_mc_boot_hdr_t;
 
 #defineSIENA_MC_BOOT_HDR_PADDING \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340812 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:16:07 2018
New Revision: 340812
URL: https://svnweb.freebsd.org/changeset/base/340812

Log:
  sfxge(4): add RSS key size define
  
  Submitted by:   Ivan Malov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18082

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:56 2018
(r340811)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:16:07 2018
(r340812)
@@ -588,6 +588,9 @@ ef10_rx_scale_key_set(
 {
efx_rc_t rc;
 
+   EFX_STATIC_ASSERT(EFX_RSS_KEY_SIZE ==
+   MC_CMD_RSS_CONTEXT_SET_KEY_IN_TOEPLITZ_KEY_LEN);
+
if (rss_context == EFX_RSS_CONTEXT_DEFAULT) {
if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
rc = ENOTSUP;

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:56 2018
(r340811)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:16:07 2018
(r340812)
@@ -1912,6 +1912,7 @@ typedef enum efx_rx_hash_support_e {
EFX_RX_HASH_AVAILABLE   /* Insert hash with/without RSS */
 } efx_rx_hash_support_t;
 
+#defineEFX_RSS_KEY_SIZE40  /* RSS key size (bytes) */
 #defineEFX_RSS_TBL_SIZE128 /* Rows in RX indirection table 
*/
 #defineEFX_MAXRSS  64  /* RX indirection entry range */
 #defineEFX_MAXRSS_LEGACY   16  /* See bug16611 and bug17213 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340810 - in head/sys/dev/sfxge: . common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:15:44 2018
New Revision: 340810
URL: https://svnweb.freebsd.org/changeset/base/340810

Log:
  sfxge(4): update RSS API to take RSS context parameter
  
  Update efx_rx_scale_mode_set(), efx_rx_scale_key_set()
  and efx_rx_scale_tbl_set().
  
  Submitted by:   Mark Spender 
  Submitted by:   Ivan Malov 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18080

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_rx.c
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 09:15:32 2018
(r340809)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 09:15:44 2018
(r340810)
@@ -914,6 +914,7 @@ ef10_rx_scale_context_free(
 extern __checkReturn   efx_rc_t
 ef10_rx_scale_mode_set(
__inefx_nic_t *enp,
+   __inuint32_t rss_context,
__inefx_rx_hash_alg_t alg,
__inefx_rx_hash_type_t type,
__inboolean_t insert);
@@ -921,12 +922,14 @@ ef10_rx_scale_mode_set(
 extern __checkReturn   efx_rc_t
 ef10_rx_scale_key_set(
__inefx_nic_t *enp,
+   __inuint32_t rss_context,
__in_ecount(n)  uint8_t *key,
__insize_t n);
 
 extern __checkReturn   efx_rc_t
 ef10_rx_scale_tbl_set(
__inefx_nic_t *enp,
+   __inuint32_t rss_context,
__in_ecount(n)  unsigned int *table,
__insize_t n);
 

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:32 2018
(r340809)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:44 2018
(r340810)
@@ -538,6 +538,7 @@ fail1:
__checkReturn   efx_rc_t
 ef10_rx_scale_mode_set(
__inefx_nic_t *enp,
+   __inuint32_t rss_context,
__inefx_rx_hash_alg_t alg,
__inefx_rx_hash_type_t type,
__inboolean_t insert)
@@ -552,13 +553,16 @@ ef10_rx_scale_mode_set(
goto fail1;
}
 
-   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
-   rc = ENOTSUP;
-   goto fail2;
+   if (rss_context == EFX_RSS_CONTEXT_DEFAULT) {
+   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
+   rc = ENOTSUP;
+   goto fail2;
+   }
+   rss_context = enp->en_rss_context;
}
 
if ((rc = efx_mcdi_rss_context_set_flags(enp,
-   enp->en_rss_context, type)) != 0)
+   rss_context, type)) != 0)
goto fail3;
 
return (0);
@@ -578,18 +582,21 @@ fail1:
__checkReturn   efx_rc_t
 ef10_rx_scale_key_set(
__inefx_nic_t *enp,
+   __inuint32_t rss_context,
__in_ecount(n)  uint8_t *key,
__insize_t n)
 {
efx_rc_t rc;
 
-   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
-   rc = ENOTSUP;
-   goto fail1;
+   if (rss_context == EFX_RSS_CONTEXT_DEFAULT) {
+   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
+   rc = ENOTSUP;
+   goto fail1;
+   }
+   rss_context = enp->en_rss_context;
}
 
-   if ((rc = efx_mcdi_rss_context_set_key(enp,
-   enp->en_rss_context, key, n)) != 0)
+   if ((rc = efx_mcdi_rss_context_set_key(enp, rss_context, key, n)) != 0)
goto fail2;
 
return (0);
@@ -607,18 +614,23 @@ fail1:
__checkReturn   efx_rc_t
 ef10_rx_scale_tbl_set(
__inefx_nic_t *enp,
+   __inuint32_t rss_context,
__in_ecount(n)  unsigned int *table,
__insize_t n)
 {
efx_rc_t rc;
 
-   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
-   rc = ENOTSUP;
-   goto fail1;
+
+   if (rss_context == EFX_RSS_CONTEXT_DEFAULT) {
+   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
+   rc = ENOTSUP;
+   goto fail1;
+   }
+   rss_context = enp->en_rss_context;
}
 
if ((rc = efx_mcdi_rss_context_set_table(enp,
-   enp->en_rss_context, table, n)) != 0)
+   rss_context, table, n)) != 0)
goto fail2;
 
return (0);

Modified: head/sys/dev/sfxge/common/efx.h

svn commit: r340811 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:15:56 2018
New Revision: 340811
URL: https://svnweb.freebsd.org/changeset/base/340811

Log:
  sfxge(4): add API to set an RSS context for a filter
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18081

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_filter.c

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:15:44 2018
(r340810)
+++ head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:15:56 2018
(r340811)
@@ -229,10 +229,20 @@ efx_mcdi_filter_op_add(
MC_CMD_FILTER_OP_EXT_IN_RX_DEST_HOST);
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_QUEUE,
spec->efs_dmaq_id);
+
+#if EFSYS_OPT_RX_SCALE
if (spec->efs_flags & EFX_FILTER_FLAG_RX_RSS) {
+   uint32_t rss_context;
+
+   if (spec->efs_rss_context == EFX_RSS_CONTEXT_DEFAULT)
+   rss_context = enp->en_rss_context;
+   else
+   rss_context = spec->efs_rss_context;
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_CONTEXT,
-   spec->efs_rss_context);
+   rss_context);
}
+#endif
+
MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_RX_MODE,
spec->efs_flags & EFX_FILTER_FLAG_RX_RSS ?
MC_CMD_FILTER_OP_EXT_IN_RX_MODE_RSS :
@@ -588,10 +598,6 @@ ef10_filter_add_internal(
 
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
enp->en_family == EFX_FAMILY_MEDFORD);
-
-#if EFSYS_OPT_RX_SCALE
-   spec->efs_rss_context = enp->en_rss_context;
-#endif
 
hash = ef10_filter_hash(spec);
 

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:44 2018
(r340810)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:56 2018
(r340811)
@@ -2426,7 +2426,12 @@ efx_filter_spec_set_encap_type(
__inefx_tunnel_protocol_t encap_type,
__inefx_filter_inner_frame_match_t inner_frame_match);
 
-
+#if EFSYS_OPT_RX_SCALE
+extern __checkReturn   efx_rc_t
+efx_filter_spec_set_rss_context(
+   __inout efx_filter_spec_t *spec,
+   __inuint32_t rss_context);
+#endif
 #endif /* EFSYS_OPT_FILTER */
 
 /* HASH */

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Fri Nov 23 09:15:44 2018
(r340810)
+++ head/sys/dev/sfxge/common/efx_filter.c  Fri Nov 23 09:15:56 2018
(r340811)
@@ -122,10 +122,6 @@ efx_filter_remove(
EFSYS_ASSERT3P(spec, !=, NULL);
EFSYS_ASSERT3U(spec->efs_flags, &, EFX_FILTER_FLAG_RX);
 
-#if EFSYS_OPT_RX_SCALE
-   spec->efs_rss_context = enp->en_rss_context;
-#endif
-
return (efop->efo_delete(enp, spec));
 }
 
@@ -495,7 +491,32 @@ fail1:
return (rc);
 }
 
+#if EFSYS_OPT_RX_SCALE
+   __checkReturn   efx_rc_t
+efx_filter_spec_set_rss_context(
+   __inout efx_filter_spec_t *spec,
+   __inuint32_t rss_context)
+{
+   efx_rc_t rc;
 
+   EFSYS_ASSERT3P(spec, !=, NULL);
+
+   /* The filter must have been created with EFX_FILTER_FLAG_RX_RSS. */
+   if ((spec->efs_flags & EFX_FILTER_FLAG_RX_RSS) == 0) {
+   rc = EINVAL;
+   goto fail1;
+   }
+
+   spec->efs_rss_context = rss_context;
+
+   return (0);
+
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+#endif
 
 #if EFSYS_OPT_SIENA
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340808 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:15:20 2018
New Revision: 340808
URL: https://svnweb.freebsd.org/changeset/base/340808

Log:
  sfxge(4): rename API to check Rx scale and hash support
  
  Rename efx_rx_scale_support_get() to efx_rx_scale_default_support_get(),
  and efx_rx_hash_support_get() to efx_rx_hash_default_support_get().
  
  All these really report is whether an exclusive RSS context was
  successfully acquired at efx_rx_init().
  
  efx_rx_scale_support_get() sounds like it reports whether the device
  supports RSS, and whether exclusive or shared contexts are supported,
  but it doesn't do that. Renaming it to
  efx_rx_scale_default_support_get() helps to reflect that it reports
  what RSS support the client gets without trying to allocate RSS
  contexts itself.
  
  Also rename efx_rx_scale_support_t to efx_rx_scale_context_type_t, to
  make the enum more suitable for specifying the type of an RSS context
  to be allocated.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18078

Modified:
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_rx.c

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:08 2018
(r340807)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:20 2018
(r340808)
@@ -162,7 +162,7 @@ fail1:
 static __checkReturn   efx_rc_t
 efx_mcdi_rss_context_alloc(
__inefx_nic_t *enp,
-   __inefx_rx_scale_support_t scale_support,
+   __inefx_rx_scale_context_type_t type,
__inuint32_t num_queues,
__out   uint32_t *rss_contextp)
 {
@@ -178,7 +178,7 @@ efx_mcdi_rss_context_alloc(
goto fail1;
}
 
-   switch (scale_support) {
+   switch (type) {
case EFX_RX_SCALE_EXCLUSIVE:
context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_EXCLUSIVE;
break;
@@ -464,7 +464,7 @@ ef10_rx_init(
 * Allocated an exclusive RSS context, which allows both the
 * indirection table and key to be modified.
 */
-   enp->en_rss_support = EFX_RX_SCALE_EXCLUSIVE;
+   enp->en_rss_context_type = EFX_RX_SCALE_EXCLUSIVE;
enp->en_hash_support = EFX_RX_HASH_AVAILABLE;
} else {
/*
@@ -472,7 +472,7 @@ ef10_rx_init(
 * operation without support for RSS. The pseudo-header in
 * received packets will not contain a Toeplitz hash value.
 */
-   enp->en_rss_support = EFX_RX_SCALE_UNAVAILABLE;
+   enp->en_rss_context_type = EFX_RX_SCALE_UNAVAILABLE;
enp->en_hash_support = EFX_RX_HASH_UNAVAILABLE;
}
 
@@ -510,7 +510,7 @@ ef10_rx_scale_mode_set(
goto fail1;
}
 
-   if (enp->en_rss_support == EFX_RX_SCALE_UNAVAILABLE) {
+   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
rc = ENOTSUP;
goto fail2;
}
@@ -541,7 +541,7 @@ ef10_rx_scale_key_set(
 {
efx_rc_t rc;
 
-   if (enp->en_rss_support == EFX_RX_SCALE_UNAVAILABLE) {
+   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
rc = ENOTSUP;
goto fail1;
}
@@ -570,7 +570,7 @@ ef10_rx_scale_tbl_set(
 {
efx_rc_t rc;
 
-   if (enp->en_rss_support == EFX_RX_SCALE_UNAVAILABLE) {
+   if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
rc = ENOTSUP;
goto fail1;
}
@@ -981,11 +981,10 @@ ef10_rx_fini(
__inefx_nic_t *enp)
 {
 #if EFSYS_OPT_RX_SCALE
-   if (enp->en_rss_support != EFX_RX_SCALE_UNAVAILABLE) {
+   if (enp->en_rss_context_type != EFX_RX_SCALE_UNAVAILABLE)
(void) efx_mcdi_rss_context_free(enp, enp->en_rss_context);
-   }
enp->en_rss_context = 0;
-   enp->en_rss_support = EFX_RX_SCALE_UNAVAILABLE;
+   enp->en_rss_context_type = EFX_RX_SCALE_UNAVAILABLE;
 #else
_NOTE(ARGUNUSED(enp))
 #endif /* EFSYS_OPT_RX_SCALE */

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:08 2018
(r340807)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:20 2018
(r340808)
@@ -1916,22 +1916,22 @@ typedef enum efx_rx_hash_support_e {
 #defineEFX_MAXRSS  64  /* RX indirection entry range */
 #defineEFX_MAXRSS_LEGACY   16  /* See bug16611 and bug17213 */
 
-typedef enum efx_rx_scale_support_e {
-   EFX_RX_SCALE_UNAVAILABLE = 0,   /* Not supported */
+typedef enum 

svn commit: r340807 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:15:08 2018
New Revision: 340807
URL: https://svnweb.freebsd.org/changeset/base/340807

Log:
  sfxge(4): add the max number of RSS exclusive contexts
  
  The patch adds enc_rx_scale_max_exclusive_contexts member
  to nic_cfg_t structure and sets the corresponding values
  for Siena, Huntington and Medford
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18077

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/hunt_nic.c
  head/sys/dev/sfxge/common/medford_nic.c
  head/sys/dev/sfxge/common/siena_nic.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:14:57 2018
(r340806)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:08 2018
(r340807)
@@ -1134,6 +1134,7 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_rx_prefix_size;
uint32_tenc_rx_buf_align_start;
uint32_tenc_rx_buf_align_end;
+   uint32_tenc_rx_scale_max_exclusive_contexts;
 #if EFSYS_OPT_LOOPBACK
efx_qword_t enc_loopback_types[EFX_LINK_NMODES];
 #endif /* EFSYS_OPT_LOOPBACK */

Modified: head/sys/dev/sfxge/common/hunt_nic.c
==
--- head/sys/dev/sfxge/common/hunt_nic.cFri Nov 23 09:14:57 2018
(r340806)
+++ head/sys/dev/sfxge/common/hunt_nic.cFri Nov 23 09:15:08 2018
(r340807)
@@ -304,6 +304,13 @@ hunt_board_cfg(
/* Alignment for WPTR updates */
encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
 
+   /*
+* Maximum number of exclusive RSS contexts which can be allocated. The
+* hardware supports 64, but 6 are reserved for shared contexts. They
+* are a global resource so not all may be available.
+*/
+   encp->enc_rx_scale_max_exclusive_contexts = 58;
+
encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT);
/* No boundary crossing limits */
encp->enc_tx_dma_desc_boundary = 0;

Modified: head/sys/dev/sfxge/common/medford_nic.c
==
--- head/sys/dev/sfxge/common/medford_nic.c Fri Nov 23 09:14:57 2018
(r340806)
+++ head/sys/dev/sfxge/common/medford_nic.c Fri Nov 23 09:15:08 2018
(r340807)
@@ -301,6 +301,13 @@ medford_board_cfg(
/* Alignment for WPTR updates */
encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
 
+   /*
+* Maximum number of exclusive RSS contexts which can be allocated. The
+* hardware supports 64, but 6 are reserved for shared contexts. They
+* are a global resource so not all may be available.
+*/
+   encp->enc_rx_scale_max_exclusive_contexts = 58;
+
encp->enc_tx_dma_desc_size_max = EFX_MASK32(ESF_DZ_RX_KER_BYTE_CNT);
/* No boundary crossing limits */
encp->enc_tx_dma_desc_boundary = 0;

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Fri Nov 23 09:14:57 2018
(r340806)
+++ head/sys/dev/sfxge/common/siena_nic.c   Fri Nov 23 09:15:08 2018
(r340807)
@@ -140,6 +140,9 @@ siena_board_cfg(
/* Alignment for WPTR updates */
encp->enc_rx_push_align = 1;
 
+   /* There is one RSS context per function */
+   encp->enc_rx_scale_max_exclusive_contexts = 1;
+
encp->enc_tx_dma_desc_size_max = EFX_MASK32(FSF_AZ_TX_KER_BYTE_COUNT);
/* Fragments must not span 4k boundaries. */
encp->enc_tx_dma_desc_boundary = 4096;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340809 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:15:32 2018
New Revision: 340809
URL: https://svnweb.freebsd.org/changeset/base/340809

Log:
  sfxge(4): add API to allocate and free RSS contexts
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18079

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_rx.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 09:15:20 2018
(r340808)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Fri Nov 23 09:15:32 2018
(r340809)
@@ -900,6 +900,18 @@ ef10_rx_scatter_enable(
 #if EFSYS_OPT_RX_SCALE
 
 extern __checkReturn   efx_rc_t
+ef10_rx_scale_context_alloc(
+   __inefx_nic_t *enp,
+   __inefx_rx_scale_context_type_t type,
+   __inuint32_t num_queues,
+   __out   uint32_t *rss_contextp);
+
+extern __checkReturn   efx_rc_t
+ef10_rx_scale_context_free(
+   __inefx_nic_t *enp,
+   __inuint32_t rss_context);
+
+extern __checkReturn   efx_rc_t
 ef10_rx_scale_mode_set(
__inefx_nic_t *enp,
__inefx_rx_hash_alg_t alg,

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==
--- head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:20 2018
(r340808)
+++ head/sys/dev/sfxge/common/ef10_rx.c Fri Nov 23 09:15:32 2018
(r340809)
@@ -494,6 +494,48 @@ ef10_rx_scatter_enable(
 
 #if EFSYS_OPT_RX_SCALE
__checkReturn   efx_rc_t
+ef10_rx_scale_context_alloc(
+   __inefx_nic_t *enp,
+   __inefx_rx_scale_context_type_t type,
+   __inuint32_t num_queues,
+   __out   uint32_t *rss_contextp)
+{
+   efx_rc_t rc;
+
+   rc = efx_mcdi_rss_context_alloc(enp, type, num_queues, rss_contextp);
+   if (rc != 0)
+   goto fail1;
+
+   return (0);
+
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+   return (rc);
+}
+#endif /* EFSYS_OPT_RX_SCALE */
+
+#if EFSYS_OPT_RX_SCALE
+   __checkReturn   efx_rc_t
+ef10_rx_scale_context_free(
+   __inefx_nic_t *enp,
+   __inuint32_t rss_context)
+{
+   efx_rc_t rc;
+
+   rc = efx_mcdi_rss_context_free(enp, rss_context);
+   if (rc != 0)
+   goto fail1;
+
+   return (0);
+
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+   return (rc);
+}
+#endif /* EFSYS_OPT_RX_SCALE */
+
+#if EFSYS_OPT_RX_SCALE
+   __checkReturn   efx_rc_t
 ef10_rx_scale_mode_set(
__inefx_nic_t *enp,
__inefx_rx_hash_alg_t alg,

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:20 2018
(r340808)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:15:32 2018
(r340809)
@@ -1934,6 +1934,18 @@ efx_rx_scale_default_support_get(
__out   efx_rx_scale_context_type_t *typep);
 
 extern __checkReturn   efx_rc_t
+efx_rx_scale_context_alloc(
+   __inefx_nic_t *enp,
+   __inefx_rx_scale_context_type_t type,
+   __inuint32_t num_queues,
+   __out   uint32_t *rss_contextp);
+
+extern __checkReturn   efx_rc_t
+efx_rx_scale_context_free(
+   __inefx_nic_t *enp,
+   __inuint32_t rss_context);
+
+extern __checkReturn   efx_rc_t
 efx_rx_scale_mode_set(
__inefx_nic_t *enp,
__inefx_rx_hash_alg_t alg,

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 09:15:20 2018
(r340808)
+++ head/sys/dev/sfxge/common/efx_impl.hFri Nov 23 09:15:32 2018
(r340809)
@@ -156,6 +156,10 @@ typedef struct efx_rx_ops_s {
efx_rc_t(*erxo_scatter_enable)(efx_nic_t *, unsigned int);
 #endif
 #if EFSYS_OPT_RX_SCALE
+   efx_rc_t(*erxo_scale_context_alloc)(efx_nic_t *,
+   efx_rx_scale_context_type_t,
+   uint32_t, uint32_t *);
+   efx_rc_t(*erxo_scale_context_free)(efx_nic_t *, uint32_t);
efx_rc_t(*erxo_scale_mode_set)(efx_nic_t *, efx_rx_hash_alg_t,
   efx_rx_hash_type_t, boolean_t);
efx_rc_t(*erxo_scale_key_set)(efx_nic_t *, uint8_t *, size_t);

Modified: head/sys/dev/sfxge/common/efx_rx.c

svn commit: r340805 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:14:45 2018
New Revision: 340805
URL: https://svnweb.freebsd.org/changeset/base/340805

Log:
  sfxge(4): define a handle to denote default RSS context
  
  Make the existing filter-specific define more general.
  This is the same as MC_CMD_RSS_CONTEXT_ALLOC_OUT_RSS_CONTEXT_ID_INVALID.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18075

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_filter.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:03:32 2018
(r340804)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:14:45 2018
(r340805)
@@ -1889,6 +1889,9 @@ efx_rx_scatter_enable(
__inunsigned int buf_size);
 #endif /* EFSYS_OPT_RX_SCATTER */
 
+/* Handle to represent use of the default RSS context. */
+#defineEFX_RSS_CONTEXT_DEFAULT 0x
+
 #if EFSYS_OPT_RX_SCALE
 
 typedef enum efx_rx_hash_alg_e {
@@ -2316,7 +2319,6 @@ typedef struct efx_filter_spec_s {
 
 
 /* Default values for use in filter specifications */
-#defineEFX_FILTER_SPEC_RSS_CONTEXT_DEFAULT 0x
 #defineEFX_FILTER_SPEC_RX_DMAQ_ID_DROP 0xfff
 #defineEFX_FILTER_SPEC_VID_UNSPEC  0x
 

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Fri Nov 23 09:03:32 2018
(r340804)
+++ head/sys/dev/sfxge/common/efx_filter.c  Fri Nov 23 09:14:45 2018
(r340805)
@@ -307,7 +307,7 @@ efx_filter_spec_init_rx(
memset(spec, 0, sizeof (*spec));
spec->efs_priority = priority;
spec->efs_flags = EFX_FILTER_FLAG_RX | flags;
-   spec->efs_rss_context = EFX_FILTER_SPEC_RSS_CONTEXT_DEFAULT;
+   spec->efs_rss_context = EFX_RSS_CONTEXT_DEFAULT;
spec->efs_dmaq_id = (uint16_t)erp->er_index;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340806 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:14:57 2018
New Revision: 340806
URL: https://svnweb.freebsd.org/changeset/base/340806

Log:
  sfxge(4): fix default RSS context check on Siena
  
  Default RSS context check is carried out during filter
  insertion on Siena and it needs to be fixed
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D18076

Modified:
  head/sys/dev/sfxge/common/efx_filter.c

Modified: head/sys/dev/sfxge/common/efx_filter.c
==
--- head/sys/dev/sfxge/common/efx_filter.c  Fri Nov 23 09:14:45 2018
(r340805)
+++ head/sys/dev/sfxge/common/efx_filter.c  Fri Nov 23 09:14:57 2018
(r340806)
@@ -527,9 +527,9 @@ siena_filter_spec_from_gen_spec(
else
EFSYS_ASSERT3U(gen_spec->efs_flags, &, EFX_FILTER_FLAG_RX);
 
-   /* Falconsiena only has one RSS context */
+   /* Siena only has one RSS context */
if ((gen_spec->efs_flags & EFX_FILTER_FLAG_RX_RSS) &&
-   gen_spec->efs_rss_context != 0) {
+   gen_spec->efs_rss_context != EFX_RSS_CONTEXT_DEFAULT) {
rc = EINVAL;
goto fail1;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340804 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:03:32 2018
New Revision: 340804
URL: https://svnweb.freebsd.org/changeset/base/340804

Log:
  sfxge(4): insert filters for encapsulated packets
  
  On Medford, with full-featured firmware running, encapsulated
  packets may not be delivered unless filters are inserted for
  them, as ordinary filters are not applied to encapsulated
  packets. So filters for encapsulated packets need to be
  inserted for each class of encapsulated packet. For simplicity,
  catch-all filters are always inserted. These may match more
  packets than the OS has asked for, but trying to insert more
  precise filters increases complexity for little gain.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18074

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/ef10_impl.h

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:03:20 2018
(r340803)
+++ head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:03:32 2018
(r340804)
@@ -1234,6 +1234,108 @@ fail1:
return (rc);
 }
 
+typedef struct ef10_filter_encap_entry_s {
+   uint16_tether_type;
+   efx_tunnel_protocol_t   encap_type;
+   uint32_tinner_frame_match;
+} ef10_filter_encap_entry_t;
+
+#define EF10_ENCAP_FILTER_ENTRY(ipv, encap_type, inner_frame_match)\
+   { EFX_ETHER_TYPE_##ipv, EFX_TUNNEL_PROTOCOL_##encap_type,   
\
+   EFX_FILTER_INNER_FRAME_MATCH_UNKNOWN_##inner_frame_match }
+
+static ef10_filter_encap_entry_t ef10_filter_encap_list[] = {
+   EF10_ENCAP_FILTER_ENTRY(IPV4, VXLAN, UCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV4, VXLAN, MCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV6, VXLAN, UCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV6, VXLAN, MCAST_DST),
+
+   EF10_ENCAP_FILTER_ENTRY(IPV4, GENEVE, UCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV4, GENEVE, MCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV6, GENEVE, UCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV6, GENEVE, MCAST_DST),
+
+   EF10_ENCAP_FILTER_ENTRY(IPV4, NVGRE, UCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV4, NVGRE, MCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV6, NVGRE, UCAST_DST),
+   EF10_ENCAP_FILTER_ENTRY(IPV6, NVGRE, MCAST_DST),
+};
+
+#undef EF10_ENCAP_FILTER_ENTRY
+
+static __checkReturn   efx_rc_t
+ef10_filter_insert_encap_filters(
+   __inefx_nic_t *enp,
+   __inboolean_t mulcst,
+   __inefx_filter_flags_t filter_flags)
+{
+   ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
+   uint32_t i;
+   efx_rc_t rc;
+
+   EFX_STATIC_ASSERT(EFX_ARRAY_SIZE(ef10_filter_encap_list) <=
+   EFX_ARRAY_SIZE(table->eft_encap_filter_indexes));
+
+   /*
+* On Medford, full-featured firmware can identify packets as being
+* tunnel encapsulated, even if no encapsulated packet offloads are in
+* use. When packets are identified as such, ordinary filters are not
+* applied, only ones specific to encapsulated packets. Hence we need to
+* insert filters for encapsulated packets in order to receive them.
+*
+* Separate filters need to be inserted for each ether type,
+* encapsulation type, and inner frame type (unicast or multicast). To
+* keep things simple and reduce the number of filters needed, catch-all
+* filters for all combinations of types are inserted, even if
+* all_unicst or all_mulcst have not been set. (These catch-all filters
+* may well, however, fail to insert on unprivileged functions.)
+*/
+   table->eft_encap_filter_count = 0;
+   for (i = 0; i < EFX_ARRAY_SIZE(ef10_filter_encap_list); i++) {
+   efx_filter_spec_t spec;
+   ef10_filter_encap_entry_t *encap_filter =
+   _filter_encap_list[i];
+
+   /*
+* Skip multicast filters if we've not been asked for
+* any multicast traffic.
+*/
+   if ((mulcst == B_FALSE) &&
+   (encap_filter->inner_frame_match ==
+EFX_FILTER_INNER_FRAME_MATCH_UNKNOWN_MCAST_DST))
+   continue;
+
+   efx_filter_spec_init_rx(, EFX_FILTER_PRI_AUTO,
+   filter_flags,
+   table->eft_default_rxq);
+   efx_filter_spec_set_ether_type(, encap_filter->ether_type);
+   rc = efx_filter_spec_set_encap_type(,
+   encap_filter->encap_type,
+   encap_filter->inner_frame_match);
+   if (rc != 0)
+   

svn commit: r340803 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:03:20 2018
New Revision: 340803
URL: https://svnweb.freebsd.org/changeset/base/340803

Log:
  sfxge(4): support filters for encapsulated packets
  
  This supports filters which match all unicast or multicast
  inner frames in VXLAN, GENEVE, or NVGRE packets.
  (Additional fields to match on can be added easily.)
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18073

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_filter.c

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:03:09 2018
(r340802)
+++ head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:03:20 2018
(r340803)
@@ -145,6 +145,10 @@ ef10_filter_init(
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_OUTER_VLAN));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IP_PROTO));
+   EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST ==
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_MCAST_DST));
+   EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST ==
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_UCAST_DST));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_UNKNOWN_MCAST_DST ==
MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_UNKNOWN_MCAST_DST));
EFX_STATIC_ASSERT((uint32_t)EFX_FILTER_MATCH_UNKNOWN_UCAST_DST ==
@@ -274,18 +278,47 @@ efx_mcdi_filter_op_add(
memcpy(MCDI_IN2(req, uint8_t, FILTER_OP_EXT_IN_DST_IP),
>efs_loc_host.eo_byte[0],
MC_CMD_FILTER_OP_EXT_IN_DST_IP_LEN);
+
+   /*
+* On Medford, filters for encapsulated packets match based on
+* the ether type and IP protocol in the outer frame.  In
+* addition we need to fill in the VNI or VSID type field.
+*/
+   switch (spec->efs_encap_type) {
+   case EFX_TUNNEL_PROTOCOL_NONE:
+   break;
+   case EFX_TUNNEL_PROTOCOL_VXLAN:
+   case EFX_TUNNEL_PROTOCOL_GENEVE:
+   MCDI_IN_POPULATE_DWORD_1(req,
+   FILTER_OP_EXT_IN_VNI_OR_VSID,
+   FILTER_OP_EXT_IN_VNI_TYPE,
+   spec->efs_encap_type == EFX_TUNNEL_PROTOCOL_VXLAN ?
+   MC_CMD_FILTER_OP_EXT_IN_VNI_TYPE_VXLAN :
+   MC_CMD_FILTER_OP_EXT_IN_VNI_TYPE_GENEVE);
+   break;
+   case EFX_TUNNEL_PROTOCOL_NVGRE:
+   MCDI_IN_POPULATE_DWORD_1(req,
+   FILTER_OP_EXT_IN_VNI_OR_VSID,
+   FILTER_OP_EXT_IN_VSID_TYPE,
+   MC_CMD_FILTER_OP_EXT_IN_VSID_TYPE_NVGRE);
+   break;
+   default:
+   EFSYS_ASSERT(0);
+   rc = EINVAL;
+   goto fail2;
+   }
}
 
efx_mcdi_execute(enp, );
 
if (req.emr_rc != 0) {
rc = req.emr_rc;
-   goto fail2;
+   goto fail3;
}
 
if (req.emr_out_length_used < MC_CMD_FILTER_OP_EXT_OUT_LEN) {
rc = EMSGSIZE;
-   goto fail3;
+   goto fail4;
}
 
handle->efh_lo = MCDI_OUT_DWORD(req, FILTER_OP_EXT_OUT_HANDLE_LO);
@@ -293,6 +326,8 @@ efx_mcdi_filter_op_add(
 
return (0);
 
+fail4:
+   EFSYS_PROBE(fail4);
 fail3:
EFSYS_PROBE(fail3);
 fail2:
@@ -392,6 +427,8 @@ ef10_filter_equal(
if (left->efs_ether_type != right->efs_ether_type)
return (B_FALSE);
if (left->efs_ip_proto != right->efs_ip_proto)
+   return (B_FALSE);
+   if (left->efs_encap_type != right->efs_encap_type)
return (B_FALSE);
 
return (B_TRUE);

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:03:09 2018
(r340802)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:03:20 2018
(r340803)
@@ -2230,6 +2230,7 @@ efx_tx_qdestroy(
 
 #defineEFX_IPPROTO_TCP 6
 #defineEFX_IPPROTO_UDP 17
+#defineEFX_IPPROTO_GRE 47
 
 /* Use RSS to spread across multiple queues */
 #defineEFX_FILTER_FLAG_RX_RSS  0x01
@@ -2248,6 +2249,10 @@ efx_tx_qdestroy(
 
 typedef unsigned int efx_filter_flags_t;
 
+/*
+ * Flags which specify the fields to match on. The values are the same as in 
the
+ * MC_CMD_FILTER_OP/MC_CMD_FILTER_OP_EXT commands.
+ */
 typedef enum 

svn commit: r340801 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:02:58 2018
New Revision: 340801
URL: https://svnweb.freebsd.org/changeset/base/340801

Log:
  sfxge(4): provide information about supported tunnels
  
  VXLAN/NVGRE (and Geneve) support is available on SFN8xxx with
  full-feature firmware variant running.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18071

Modified:
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/efx.h

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cFri Nov 23 07:50:56 2018
(r340800)
+++ head/sys/dev/sfxge/common/ef10_nic.cFri Nov 23 09:02:58 2018
(r340801)
@@ -1075,6 +1075,16 @@ ef10_get_datapath_caps(
encp->enc_mac_stats_40g_tx_size_bins =
CAP_FLAG2(flags2, MAC_STATS_40G_TX_SIZE_BINS) ? B_TRUE : B_FALSE;
 
+   /*
+* Check if firmware supports VXLAN and NVGRE tunnels.
+* The capability indicates Geneve protocol support as well.
+*/
+   if (CAP_FLAG(flags, VXLAN_NVGRE))
+   encp->enc_tunnel_encapsulations_supported =
+   (1u << EFX_TUNNEL_PROTOCOL_VXLAN) |
+   (1u << EFX_TUNNEL_PROTOCOL_GENEVE) |
+   (1u << EFX_TUNNEL_PROTOCOL_NVGRE);
+
 #undef CAP_FLAG
 #undef CAP_FLAG2
 

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Nov 23 07:50:56 2018
(r340800)
+++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 09:02:58 2018
(r340801)
@@ -1095,6 +1095,14 @@ efx_bist_stop(
 #defineEFX_FEATURE_FW_ASSISTED_TSO_V2  0x2000
 #defineEFX_FEATURE_PACKED_STREAM   0x4000
 
+typedef enum efx_tunnel_protocol_e {
+   EFX_TUNNEL_PROTOCOL_NONE = 0,
+   EFX_TUNNEL_PROTOCOL_VXLAN,
+   EFX_TUNNEL_PROTOCOL_GENEVE,
+   EFX_TUNNEL_PROTOCOL_NVGRE,
+   EFX_TUNNEL_NPROTOS
+} efx_tunnel_protocol_t;
+
 typedef struct efx_nic_cfg_s {
uint32_tenc_board_type;
uint32_tenc_phy_type;
@@ -1194,6 +1202,7 @@ typedef struct efx_nic_cfg_s {
boolean_t   enc_rx_var_packed_stream_supported;
boolean_t   enc_pm_and_rxdp_counters;
boolean_t   enc_mac_stats_40g_tx_size_bins;
+   uint32_tenc_tunnel_encapsulations_supported;
/* External port identifier */
uint8_t enc_external_port;
uint32_tenc_mcdi_max_payload_length;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340802 - head/sys/dev/sfxge/common

2018-11-23 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Nov 23 09:03:09 2018
New Revision: 340802
URL: https://svnweb.freebsd.org/changeset/base/340802

Log:
  sfxge(4): use proper MCDI command for encap filters
  
  MC_CMD_FILTER_OP_IN_EXT is needed to set filters for encapsulated
  packets.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18072

Modified:
  head/sys/dev/sfxge/common/ef10_filter.c

Modified: head/sys/dev/sfxge/common/ef10_filter.c
==
--- head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:02:58 2018
(r340801)
+++ head/sys/dev/sfxge/common/ef10_filter.c Fri Nov 23 09:03:09 2018
(r340802)
@@ -126,29 +126,29 @@ ef10_filter_init(
 
 #defineMATCH_MASK(match) (EFX_MASK32(match) << EFX_LOW_BIT(match))
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_REM_HOST ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_SRC_IP));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_SRC_IP));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_LOC_HOST ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_DST_IP));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_DST_IP));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_REM_MAC ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_SRC_MAC));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_SRC_MAC));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_REM_PORT ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_SRC_PORT));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_SRC_PORT));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_LOC_MAC ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_DST_MAC));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_DST_MAC));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_LOC_PORT ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_DST_PORT));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_DST_PORT));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_ETHER_TYPE ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_ETHER_TYPE));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_ETHER_TYPE));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_INNER_VID ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_INNER_VLAN));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_INNER_VLAN));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_OUTER_VID ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_OUTER_VLAN));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_OUTER_VLAN));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_IP_PROTO ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_IP_PROTO));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_IP_PROTO));
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_UNKNOWN_MCAST_DST ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_MCAST_DST));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_UNKNOWN_MCAST_DST));
EFX_STATIC_ASSERT((uint32_t)EFX_FILTER_MATCH_UNKNOWN_UCAST_DST ==
-   MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_UNKNOWN_UCAST_DST));
+   MATCH_MASK(MC_CMD_FILTER_OP_EXT_IN_MATCH_UNKNOWN_UCAST_DST));
 #undef MATCH_MASK
 
EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (ef10_filter_table_t), eftp);
@@ -189,27 +189,27 @@ efx_mcdi_filter_op_add(
__inout ef10_filter_handle_t *handle)
 {
efx_mcdi_req_t req;
-   uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN,
-   MC_CMD_FILTER_OP_OUT_LEN)];
+   uint8_t payload[MAX(MC_CMD_FILTER_OP_EXT_IN_LEN,
+   MC_CMD_FILTER_OP_EXT_OUT_LEN)];
efx_rc_t rc;
 
memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FILTER_OP;
req.emr_in_buf = payload;
-   req.emr_in_length = MC_CMD_FILTER_OP_IN_LEN;
+   req.emr_in_length = MC_CMD_FILTER_OP_EXT_IN_LEN;
req.emr_out_buf = payload;
-   req.emr_out_length = MC_CMD_FILTER_OP_OUT_LEN;
+   req.emr_out_length = MC_CMD_FILTER_OP_EXT_OUT_LEN;
 
switch (filter_op) {
case MC_CMD_FILTER_OP_IN_OP_REPLACE:
-   MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO,
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_HANDLE_LO,
handle->efh_lo);
-   MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI,
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_HANDLE_HI,
handle->efh_hi);
/* Fall through */
case MC_CMD_FILTER_OP_IN_OP_INSERT:
case MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE:
-   MCDI_IN_SET_DWORD(req, FILTER_OP_IN_OP, filter_op);
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_OP, filter_op);
break;
default:
EFSYS_ASSERT(0);
@@ -217,63 +217,63 @@ efx_mcdi_filter_op_add(
goto fail1;
}
 
-   MCDI_IN_SET_DWORD(req, FILTER_OP_IN_PORT_ID,
+   MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_PORT_ID,
EVB_PORT_ID_ASSIGNED);
-   MCDI_IN_SET_DWORD(req,