Re: svn commit: r322272 - head/sys/compat/linuxkpi/common/src

2021-01-07 Thread Hans Petter Selasky

Let's move the discussion over here:

https://reviews.freebsd.org/D28017

--HPS
___
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"


Re: svn commit: r322272 - head/sys/compat/linuxkpi/common/src

2021-01-07 Thread Hans Petter Selasky

On 1/6/21 9:44 PM, Ryan Stone wrote:

On Tue, Aug 8, 2017 at 3:36 PM Alexander Motin  wrote:


Author: mav
Date: Tue Aug  8 19:36:34 2017
New Revision: 322272
URL: https://svnweb.freebsd.org/changeset/base/322272

Log:
   Fix few issues of LinuxKPI workqueue.

   LinuxKPI workqueue wrappers reported "successful" cancellation for works
   already completed in normal way.  This change brings reported status and
   real cancellation fact into sync.  This required for drm-next operation.

   Reviewed by:  hselasky (earlier version)
   Sponsored by: iXsystems, Inc.
   Differential Revision:https://reviews.freebsd.org/D11904




@@ -266,13 +267,14 @@ linux_delayed_work_timer_fn(void *arg)
 [WORK_ST_IDLE] = WORK_ST_IDLE,  /* NOP */
 [WORK_ST_TIMER] = WORK_ST_TASK, /* start queueing task 
*/
 [WORK_ST_TASK] = WORK_ST_TASK,  /* NOP */
-   [WORK_ST_EXEC] = WORK_ST_TASK,  /* queue task another 
time */
-   [WORK_ST_CANCEL] = WORK_ST_IDLE,/* complete cancel */
+   [WORK_ST_EXEC] = WORK_ST_EXEC,  /* NOP */
+   [WORK_ST_CANCEL] = WORK_ST_TASK,/* failed to cancel */
 };
 struct delayed_work *dwork = arg;

 switch (linux_update_state(>work.state, states)) {
 case WORK_ST_TIMER:
+   case WORK_ST_CANCEL:
 linux_delayed_work_enqueue(dwork);
 break;
 default:


I believe that this hunk introduced a regression into workqueue.
Consider the following scenario:

1. A delayed_work struct in the WORK_ST_TIMER state.
2. Thread A calls mod_delayed_work()
3. Thread B (a callout thread) simultaneously calls
linux_delayed_work_timer_fn()

The following sequence of events is possible:

A: Call linux_cancel_delayed_work()
A: Change state from TIMER TO CANCEL
B: Change state from CANCEL to TASK
B: taskqueue_enqueue() the task
A: taskqueue_cancel() the task
A: Call linux_queue_delayed_work_on().  This is a no-op because the
state is WORK_ST_TASK.

As a result, the delayed_work struct will never be invoked.  This is
causing address resolution in ib_addr.c to stop permanently, as it
never tries to reschedule a task that it thinks is already scheduled.

Do you have a recommendation?  Should we unconditionally
taskqueue_enqueue() when in the WORK_ST_TASK state and
linux_queue_delayed_work_on() is called?  That is harmless for a
pending task but will break the deadlock if the race is lost.



Hi Ryan,

Do you have a patch to fix this?

--HPS
___
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"


Re: svn commit: r365787 - head/sys/fs/tmpfs

2021-01-05 Thread Hans Petter Selasky

On 1/1/21 7:44 PM, Alexey Dokuchaev wrote:

   __mtx_lock_sleep()
   tmpfs_free_node()
   tmpfs_fo_close()
   _fdrop()
   closef()
   fdescfree_fds()
   fdescfree()
   exit1()
   sigexit()
   postsig()
   ast()
   doreit_ast()


I'm seeing the same and I have a clue what is going on.

Are you absolutely sure doreit_ast() is the bottom of your stacktrace, 
or do you see ??'s in there?


--HPS
___
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: r368801 - head/sys/dev/usb/net

2020-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Dec 19 11:03:54 2020
New Revision: 368801
URL: https://svnweb.freebsd.org/changeset/base/368801

Log:
  Ensure a minimum packet length before creating a mbuf in if_ure.
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/net/if_ure.c

Modified: head/sys/dev/usb/net/if_ure.c
==
--- head/sys/dev/usb/net/if_ure.c   Sat Dec 19 11:03:04 2020
(r368800)
+++ head/sys/dev/usb/net/if_ure.c   Sat Dec 19 11:03:54 2020
(r368801)
@@ -711,7 +711,7 @@ ure_bulk_read_callback(struct usb_xfer *xfer, usb_erro
goto tr_setup;
}
 
-   if (len != 0)
+   if (len >= (ETHER_HDR_LEN + ETHER_CRC_LEN))
m = ure_makembuf(pc, off, len - ETHER_CRC_LEN);
else
m = 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: r368799 - head/sys/dev/usb/net

2020-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Dec 19 11:00:11 2020
New Revision: 368799
URL: https://svnweb.freebsd.org/changeset/base/368799

Log:
  Move SYSCTL_ADD_PROC() to unlocked context in if_ure to avoid lock order 
reversal.
  
  MFC after:1 week
  Reported by:  Mark Millard 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/net/if_ure.c

Modified: head/sys/dev/usb/net/if_ure.c
==
--- head/sys/dev/usb/net/if_ure.c   Sat Dec 19 10:31:25 2020
(r368798)
+++ head/sys/dev/usb/net/if_ure.c   Sat Dec 19 11:00:11 2020
(r368799)
@@ -959,8 +959,6 @@ static void
 ure_attach_post(struct usb_ether *ue)
 {
struct ure_softc *sc = uether_getsc(ue);
-   struct sysctl_ctx_list *sctx;
-   struct sysctl_oid *soid;
 
sc->sc_rxstarted = 0;
sc->sc_phyno = 0;
@@ -988,18 +986,13 @@ ure_attach_post(struct usb_ether *ue)
sc->sc_ue.ue_eaddr[0] &= ~0x01; /* unicast */
sc->sc_ue.ue_eaddr[0] |= 0x02;  /* locally administered */
}
-
-   sctx = device_get_sysctl_ctx(sc->sc_ue.ue_dev);
-   soid = device_get_sysctl_tree(sc->sc_ue.ue_dev);
-   SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "chipver",
-   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
-   ure_sysctl_chipver, "A",
-   "Return string with chip version.");
 }
 
 static int
 ure_attach_post_sub(struct usb_ether *ue)
 {
+   struct sysctl_ctx_list *sctx;
+   struct sysctl_oid *soid;
struct ure_softc *sc;
struct ifnet *ifp;
int error;
@@ -1032,6 +1025,13 @@ ure_attach_post_sub(struct usb_ether *ue)
uether_ifmedia_upd, ue->ue_methods->ue_mii_sts,
BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, 0);
mtx_unlock();
+
+   sctx = device_get_sysctl_ctx(sc->sc_ue.ue_dev);
+   soid = device_get_sysctl_tree(sc->sc_ue.ue_dev);
+   SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "chipver",
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
+   ure_sysctl_chipver, "A",
+   "Return string with chip version.");
 
return (error);
 }
___
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: r368664 - head/sys/dev/usb

2020-12-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec 15 15:36:41 2020
New Revision: 368664
URL: https://svnweb.freebsd.org/changeset/base/368664

Log:
  Improve handling of alternate settings in the USB stack.
  
  Move initialization of num_altsetting under USB_CFG_INIT, else
  there will be a page fault when enumerating USB devices.
  
  PR:   251856
  MFC after:1 week
  Submitted by: Ma, Horse 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Tue Dec 15 15:33:28 2020
(r368663)
+++ head/sys/dev/usb/usb_device.c   Tue Dec 15 15:36:41 2020
(r368664)
@@ -897,6 +897,9 @@ usb_config_parse(struct usb_device *udev, uint8_t ifac
/* initialise interface */
do_init = 1;
}
+   /* update number of alternate settings, if any */
+   if (iface_index == USB_IFACE_INDEX_ANY)
+   iface->num_altsetting = ips.iface_index_alt + 1;
} else
do_init = 0;
 
@@ -905,9 +908,6 @@ usb_config_parse(struct usb_device *udev, uint8_t ifac
/* update current number of endpoints */
ep_curr = ep_max;
}
-   /* update number of alternate settings, if any */
-   if (iface_index == USB_IFACE_INDEX_ANY)
-   iface->num_altsetting = ips.iface_index_alt + 1;
 
/* check for init */
if (do_init) {
___
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"


Re: svn commit: r368523 - head/sys/vm

2020-12-15 Thread Hans Petter Selasky

On 12/15/20 3:27 PM, Mark Johnston wrote:

I'm seeing the following panic:

panic("vm_wait in early boot")
vm_wait_domain()
kmem_alloc_contig_pages()
kmem_alloc_contig_domainset()
kmem_alloc_contig()
contigmalloc()
x86bios_alloc()
vesa_configure()
vesa_mod_event()
vesa_module_register_init()
mi_startup()

Is it on a NUMA system?  I see that the new logic won't work properly if
there are empty domains, so this suggests that we really do need a
special contig iterator as discussed in the review.


Yes, this is a numa system.

I just noticed, that before r368523 "flags" was updated by 
_vm_domainset_iter_policy_init() to always contain M_NOWAIT and that 
avoids the wait logic, but I think x86bios_alloc() doesn't get its 
memory then.


I'm not sure if x86bios_alloc() needs to be attached a bit later anyway?

--HPS
___
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"


Re: svn commit: r368523 - head/sys/vm

2020-12-15 Thread Hans Petter Selasky

On 12/10/20 9:44 PM, Bryan Drewery wrote:

Author: bdrewery
Date: Thu Dec 10 20:44:29 2020
New Revision: 368523
URL: https://svnweb.freebsd.org/changeset/base/368523

Log:
   contig allocs: Don't retry forever on M_WAITOK.
   
   This restores behavior from before domain iterators were added in

   r327895 and r327896.
   
   The vm_domainset_iter_policy() will do a vm_wait_doms() and then

   restart its iterator when M_WAITOK is set.  It will also force
   the containing loop to have M_NOWAIT.  So we get an unbounded
   retry loop rather than the intended bounded retries that
   kmem_alloc_contig_pages() already handles.
   
   This also restores M_WAITOK to the vmem_alloc() call in

   kmem_alloc_attr_domain() and kmem_alloc_contig_domain().
   
   Reviewed by:	markj, kib

   MFC after:   2 weeks
   Sponsored by:Dell EMC
   Differential Revision:   https://reviews.freebsd.org/D27507

Modified:
   head/sys/vm/vm_kern.c

Modified: head/sys/vm/vm_kern.c
==
--- head/sys/vm/vm_kern.c   Thu Dec 10 20:44:05 2020(r368522)
+++ head/sys/vm/vm_kern.c   Thu Dec 10 20:44:29 2020(r368523)
@@ -264,9 +264,15 @@ kmem_alloc_attr_domainset(struct domainset *ds, vm_siz
  {
struct vm_domainset_iter di;
vm_offset_t addr;
-   int domain;
+   int domain, iflags;
  
-	vm_domainset_iter_policy_init(, ds, , );

+   /*
+* Do not allow the domainset iterator to override wait flags.  The
+* contiguous memory allocator defines special semantics for M_WAITOK
+* that do not match the iterator's implementation.
+*/
+   iflags = (flags & ~M_WAITOK) | M_NOWAIT;
+   vm_domainset_iter_policy_init(, ds, , );
do {
addr = kmem_alloc_attr_domain(domain, size, flags, low, high,
memattr);
@@ -346,9 +352,15 @@ kmem_alloc_contig_domainset(struct domainset *ds, vm_s
  {
struct vm_domainset_iter di;
vm_offset_t addr;
-   int domain;
+   int domain, iflags;
  
-	vm_domainset_iter_policy_init(, ds, , );

+   /*
+* Do not allow the domainset iterator to override wait flags.  The
+* contiguous memory allocator defines special semantics for M_WAITOK
+* that do not match the iterator's implementation.
+*/
+   iflags = (flags & ~M_WAITOK) | M_NOWAIT;
+   vm_domainset_iter_policy_init(, ds, , );
do {
addr = kmem_alloc_contig_domain(domain, size, flags, low, high,
alignment, boundary, memattr);



Hi,

Should "iflags" also be passed to kmem_alloc_contig_domain() !?

I'm seeing the following panic:

panic("vm_wait in early boot")
vm_wait_domain()
kmem_alloc_contig_pages()
kmem_alloc_contig_domainset()
kmem_alloc_contig()
contigmalloc()
x86bios_alloc()
vesa_configure()
vesa_mod_event()
vesa_module_register_init()
mi_startup()

--HPS
___
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: r368659 - in head/sys: compat/linuxkpi/common/src dev/usb sys

2020-12-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec 15 12:05:07 2020
New Revision: 368659
URL: https://svnweb.freebsd.org/changeset/base/368659

Log:
  Improve handling of alternate settings in the USB stack.
  
  Allow setting the alternate interface number to fail when there is only
  one alternate setting present, to comply with the USB specification.
  
  Refactor how iface->num_altsetting is computed.
  
  Bump the __FreeBSD_version due to change of core USB structure.
  
  PR:   251856
  MFC after:1 week
  Submitted by: Ma, Horse 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/src/linux_usb.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usbdi.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/src/linux_usb.c
==
--- head/sys/compat/linuxkpi/common/src/linux_usb.c Tue Dec 15 11:51:17 
2020(r368658)
+++ head/sys/compat/linuxkpi/common/src/linux_usb.c Tue Dec 15 12:05:07 
2020(r368659)
@@ -931,17 +931,12 @@ usb_linux_create_usb_device(struct usb_device *udev, d
if (p_ui) {
p_ui->altsetting = p_uhi - 1;
p_ui->cur_altsetting = p_uhi - 
1;
-   p_ui->num_altsetting = 1;
p_ui->bsd_iface_index = 
iface_index;
p_ui->linux_udev = udev;
p_ui++;
}
iface_no_curr = iface_no;
iface_index++;
-   } else {
-   if (p_ui) {
-   (p_ui - 1)->num_altsetting++;
-   }
}
break;
 

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Tue Dec 15 11:51:17 2020
(r368658)
+++ head/sys/dev/usb/usb_device.c   Tue Dec 15 12:05:07 2020
(r368659)
@@ -2,7 +2,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2020 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -905,6 +905,10 @@ usb_config_parse(struct usb_device *udev, uint8_t ifac
/* update current number of endpoints */
ep_curr = ep_max;
}
+   /* update number of alternate settings, if any */
+   if (iface_index == USB_IFACE_INDEX_ANY)
+   iface->num_altsetting = ips.iface_index_alt + 1;
+
/* check for init */
if (do_init) {
/* setup the USB interface structure */

Modified: head/sys/dev/usb/usb_request.c
==
--- head/sys/dev/usb/usb_request.c  Tue Dec 15 11:51:17 2020
(r368658)
+++ head/sys/dev/usb/usb_request.c  Tue Dec 15 12:05:07 2020
(r368659)
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
  * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2020 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1436,6 +1436,7 @@ usbd_req_set_alt_interface_no(struct usb_device *udev,
 {
struct usb_interface *iface = usbd_get_iface(udev, iface_index);
struct usb_device_request req;
+   usb_error_t err;
 
if ((iface == NULL) || (iface->idesc == NULL))
return (USB_ERR_INVAL);
@@ -1447,7 +1448,17 @@ usbd_req_set_alt_interface_no(struct usb_device *udev,
req.wIndex[0] = iface->idesc->bInterfaceNumber;
req.wIndex[1] = 0;
USETW(req.wLength, 0);
-   return (usbd_do_request(udev, mtx, , 0));
+   err = usbd_do_request(udev, mtx, , 0);
+   if (err == USB_ERR_STALLED && iface->num_altsetting == 1) {
+   /*
+* The USB specification chapter 9.4.10 says that USB
+* devices having only one alternate setting are
+* allowed to STALL this request. Ignore this failure.
+*/
+   

svn commit: r368658 - head/sys/dev/usb

2020-12-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec 15 11:51:17 2020
New Revision: 368658
URL: https://svnweb.freebsd.org/changeset/base/368658

Log:
  Improve handling of alternate settings in the USB stack.
  
  Limit the number of alternate settings to 256.
  Else the alternate index variable may wrap around.
  
  PR:   251856
  MFC after:1 week
  Submitted by: Ma, Horse 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/usb_parse.c

Modified: head/sys/dev/usb/usb_parse.c
==
--- head/sys/dev/usb/usb_parse.cTue Dec 15 09:43:18 2020
(r368657)
+++ head/sys/dev/usb/usb_parse.cTue Dec 15 11:51:17 2020
(r368658)
@@ -2,7 +2,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2020 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -141,8 +141,20 @@ usb_idesc_foreach(struct usb_config_descriptor *cd,
break;
if ((id->bDescriptorType == UDESC_INTERFACE) &&
(id->bLength >= sizeof(*id))) {
-   if (ps->iface_no_last == id->bInterfaceNumber)
+   if (ps->iface_no_last == id->bInterfaceNumber) {
+   /*
+* Don't allow more than 256 alternate
+* settings to avoid overflowing the
+* alternate index which is a 8-bit
+* variable.
+*/
+   if (ps->iface_index_alt == 255) {
+   DPRINTF("Interface(%u) has more than 
256 alternate settings\n",
+   id->bInterfaceNumber);
+   continue;
+   }
new_iface = 0;
+   }
ps->iface_no_last = id->bInterfaceNumber;
break;
}
___
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: r368632 - head/lib/libusb

2020-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 11:56:16 2020
New Revision: 368632
URL: https://svnweb.freebsd.org/changeset/base/368632

Log:
  Be bug compatible with other operating systems by allowing non-sequential
  interface numbering for USB descriptors in userspace. Else certain USB
  control requests using the interface number, won't be recognized by the
  USB firmware.
  
  Refer to section 9.2.3 in the USB 2.0 specification:
  Interfaces are numbered from zero to one less than the number of concurrent 
interfaces
  supported by the configuration.
  
  PR:   251784
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/lib/libusb/libusb20_desc.c

Modified: head/lib/libusb/libusb20_desc.c
==
--- head/lib/libusb/libusb20_desc.c Mon Dec 14 11:09:07 2020
(r368631)
+++ head/lib/libusb/libusb20_desc.c Mon Dec 14 11:56:16 2020
(r368632)
@@ -81,9 +81,10 @@ libusb20_parse_config_desc(const void *config_desc)
if (ptr[1] != LIBUSB20_DT_CONFIG) {
return (NULL);  /* not config descriptor */
}
+
/*
-* The first "bInterfaceNumber" should never have the value 0xff.
-* Then it is corrupt.
+* The first "bInterfaceNumber" cannot start at 0x
+* because the field is 8-bit.
 */
niface_no_alt = 0;
nendpoint = 0;
@@ -206,12 +207,15 @@ libusb20_parse_config_desc(const void *config_desc)
if (libusb20_me_decode(ptr, ptr[0], _if->desc)) {
/* ignore */
}
-   /*
-* Sometimes USB devices have corrupt interface
-* descriptors and we need to overwrite the provided
-* interface number!
-*/
-   last_if->desc.bInterfaceNumber = niface - 1;
+
+   /* detect broken USB descriptors when USB debugging is 
enabled */
+   if (last_if->desc.bInterfaceNumber != (uint8_t)(niface 
- 1)) {
+   const char *str = getenv("LIBUSB_DEBUG");
+   if (str != NULL && str[0] != '\0' && str[0] != 
'0') {
+   printf("LIBUSB_DEBUG: 
bInterfaceNumber(%u) is not sequential(%u)\n",
+   last_if->desc.bInterfaceNumber, 
niface - 1);
+   }
+   }
last_if->extra.ptr = LIBUSB20_ADD_BYTES(ptr, ptr[0]);
last_if->extra.len = 0;
last_if->extra.type = LIBUSB20_ME_IS_RAW;
___
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: r368505 - stable/10/sbin/ifconfig

2020-12-10 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec 10 09:39:27 2020
New Revision: 368505
URL: https://svnweb.freebsd.org/changeset/base/368505

Log:
  Fix bug in ifconfig regarding VLAN creation.
  
  Detection of VLAN interface type must happen before detection of
  interface type by prefix. Else the following sequence of commands will
  try to create a LAGG interface instead of a VLAN interface, which
  accidentially works, because the data pointed to by the ifr_data
  pointer is not parsed by the VLAN create ioctl(2).
  
  How to reproduce:
  # ifconfig lagg0 create
  # ifconfig lagg0.256 create
  
  This is a direct commit.
  
  Differential Revision:https://reviews.freebsd.org/D27521
  Tested by:raul.mu...@custos.es
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/10/sbin/ifconfig/ifclone.c

Modified: stable/10/sbin/ifconfig/ifclone.c
==
--- stable/10/sbin/ifconfig/ifclone.c   Thu Dec 10 09:37:06 2020
(r368504)
+++ stable/10/sbin/ifconfig/ifclone.c   Thu Dec 10 09:39:27 2020
(r368505)
@@ -122,6 +122,7 @@ ifclonecreate(int s, void *arg)
struct ifreq ifr;
struct clone_defcb *dcp;
clone_callback_func *clone_cb = NULL;
+   const char *ifr_name = strchr(name, '.') ? "vlan" : name;
 
memset(, 0, sizeof(ifr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -129,7 +130,7 @@ ifclonecreate(int s, void *arg)
if (clone_cb == NULL) {
/* Try to find a default callback */
SLIST_FOREACH(dcp, _defcbh, next) {
-   if (strncmp(dcp->ifprefix, ifr.ifr_name,
+   if (strncmp(dcp->ifprefix, ifr_name,
strlen(dcp->ifprefix)) == 0) {
clone_cb = dcp->clone_cb;
break;
___
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: r368504 - stable/11/sbin/ifconfig

2020-12-10 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec 10 09:37:06 2020
New Revision: 368504
URL: https://svnweb.freebsd.org/changeset/base/368504

Log:
  Fix bug in ifconfig regarding VLAN creation.
  
  Detection of VLAN interface type must happen before detection of
  interface type by prefix. Else the following sequence of commands will
  try to create a LAGG interface instead of a VLAN interface, which
  accidentially works, because the data pointed to by the ifr_data
  pointer is not parsed by the VLAN create ioctl(2).
  
  How to reproduce:
  # ifconfig lagg0 create
  # ifconfig lagg0.256 create
  
  Differential Revision:https://reviews.freebsd.org/D27521
  Tested by:raul.mu...@custos.es
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sbin/ifconfig/ifclone.c

Modified: stable/11/sbin/ifconfig/ifclone.c
==
--- stable/11/sbin/ifconfig/ifclone.c   Thu Dec 10 09:31:05 2020
(r368503)
+++ stable/11/sbin/ifconfig/ifclone.c   Thu Dec 10 09:37:06 2020
(r368504)
@@ -122,6 +122,7 @@ ifclonecreate(int s, void *arg)
struct ifreq ifr;
struct clone_defcb *dcp;
clone_callback_func *clone_cb = NULL;
+   const char *ifr_name = strchr(name, '.') ? "vlan" : name;
 
memset(, 0, sizeof(ifr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -129,7 +130,7 @@ ifclonecreate(int s, void *arg)
if (clone_cb == NULL) {
/* Try to find a default callback */
SLIST_FOREACH(dcp, _defcbh, next) {
-   if (strncmp(dcp->ifprefix, ifr.ifr_name,
+   if (strncmp(dcp->ifprefix, ifr_name,
strlen(dcp->ifprefix)) == 0) {
clone_cb = dcp->clone_cb;
break;
___
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: r368502 - stable/12/sbin/ifconfig

2020-12-10 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec 10 09:30:09 2020
New Revision: 368502
URL: https://svnweb.freebsd.org/changeset/base/368502

Log:
  Fix bug in ifconfig preventing proper VLAN creation.
  
  Detection of VLAN interface type must happen before detection of
  interface type by prefix. Else the following sequence of commands will
  try to create a LAGG interface instead of a VLAN interface, which
  accidentially worked previously, because the data pointed to by the
  ifr_data pointer was not parsed by the VLAN create ioctl(2). This is a
  regression after r368229, because the VLAN creation now parses the
  ifr_data field.
  
  How to reproduce:
  # ifconfig lagg0 create
  # ifconfig lagg0.256 create
  
  This is a direct commit, until r366917, stacked VLANs has been MFC'ed.
  
  Differential Revision:https://reviews.freebsd.org/D27521
  Tested by:raul.mu...@custos.es
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sbin/ifconfig/ifclone.c

Modified: stable/12/sbin/ifconfig/ifclone.c
==
--- stable/12/sbin/ifconfig/ifclone.c   Thu Dec 10 08:48:03 2020
(r368501)
+++ stable/12/sbin/ifconfig/ifclone.c   Thu Dec 10 09:30:09 2020
(r368502)
@@ -124,6 +124,7 @@ ifclonecreate(int s, void *arg)
struct ifreq ifr;
struct clone_defcb *dcp;
clone_callback_func *clone_cb = NULL;
+   const char *ifr_name = strchr(name, '.') ? "vlan" : name;
 
memset(, 0, sizeof(ifr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -131,7 +132,7 @@ ifclonecreate(int s, void *arg)
if (clone_cb == NULL) {
/* Try to find a default callback */
SLIST_FOREACH(dcp, _defcbh, next) {
-   if (strncmp(dcp->ifprefix, ifr.ifr_name,
+   if (strncmp(dcp->ifprefix, ifr_name,
strlen(dcp->ifprefix)) == 0) {
clone_cb = dcp->clone_cb;
break;
___
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"


Re: svn commit: r368492 - head/sbin/ifconfig

2020-12-09 Thread Hans Petter Selasky

On 12/9/20 9:19 PM, Hans Petter Selasky wrote:

On 12/9/20 9:13 PM, Hans Petter Selasky wrote:

because the date pointed


because the data pointed
   ^^ spelling fix


Just a heads up: I plan on making this a separate direct-commit to 
12-stable tomorrow, because this change depends on, r366917, stacked 
VLANs, which I have no intention of MFC'ing.


The fix for 12-stable looks like this:


Index: sbin/ifconfig/ifclone.c
===
--- sbin/ifconfig/ifclone.c (revision 368297)
+++ sbin/ifconfig/ifclone.c (working copy)
@@ -124,6 +124,7 @@
struct ifreq ifr;
struct clone_defcb *dcp;
clone_callback_func *clone_cb = NULL;
+   const char *ifr_name = strchr(name, '.') ? "vlan" : name;
 
 	memset(, 0, sizeof(ifr));

(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -131,7 +132,7 @@
if (clone_cb == NULL) {
/* Try to find a default callback */
SLIST_FOREACH(dcp, _defcbh, next) {
-   if (strncmp(dcp->ifprefix, ifr.ifr_name,
+   if (strncmp(dcp->ifprefix, ifr_name,
strlen(dcp->ifprefix)) == 0) {
clone_cb = dcp->clone_cb;
break;


--HPS
___
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"


Re: svn commit: r368492 - head/sbin/ifconfig

2020-12-09 Thread Hans Petter Selasky

On 12/9/20 9:13 PM, Hans Petter Selasky wrote:

because the date pointed


because the data pointed
  ^^ spelling fix

--HPS
___
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: r368492 - head/sbin/ifconfig

2020-12-09 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Dec  9 20:13:12 2020
New Revision: 368492
URL: https://svnweb.freebsd.org/changeset/base/368492

Log:
  Fix bug in ifconfig preventing proper VLAN creation.
  
  Detection of interface type by filter must happen before detection of
  interface type by prefix. Else the following sequence of commands will
  try to create a LAGG interface instead of a VLAN interface, which
  accidentially worked previously, because the date pointed to by the
  ifr_data pointer was not parsed by VLAN create ioctl(2). This is a
  regression after r368229, because the VLAN creation now parses the
  ifr_data field.
  
  How to reproduce:
  # ifconfig lagg0 create
  # ifconfig lagg0.256 create
  
  Differential Revision:https://reviews.freebsd.org/D27521
  Reviewed by:  kib@ and kevans@
  Reported by:  raul.mu...@custos.es
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sbin/ifconfig/ifclone.c

Modified: head/sbin/ifconfig/ifclone.c
==
--- head/sbin/ifconfig/ifclone.cWed Dec  9 20:06:37 2020
(r368491)
+++ head/sbin/ifconfig/ifclone.cWed Dec  9 20:13:12 2020
(r368492)
@@ -128,32 +128,32 @@ ifclonecreate(int s, void *arg)
 {
struct ifreq ifr;
struct clone_defcb *dcp;
-   clone_callback_func *clone_cb = NULL;
 
memset(, 0, sizeof(ifr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
 
-   if (clone_cb == NULL) {
-   /* Try to find a default callback */
+   /* Try to find a default callback by filter */
+   SLIST_FOREACH(dcp, _defcbh, next) {
+   if (dcp->clone_mt == MT_FILTER &&
+   dcp->ifmatch(ifr.ifr_name) != 0)
+   break;
+   }
+
+   if (dcp == NULL) {
+   /* Try to find a default callback by prefix */
SLIST_FOREACH(dcp, _defcbh, next) {
-   if ((dcp->clone_mt == MT_PREFIX) &&
-   (strncmp(dcp->ifprefix, ifr.ifr_name,
-strlen(dcp->ifprefix)) == 0)) {
-   clone_cb = dcp->clone_cb;
+   if (dcp->clone_mt == MT_PREFIX &&
+   strncmp(dcp->ifprefix, ifr.ifr_name,
+   strlen(dcp->ifprefix)) == 0)
break;
-   }
-   if ((dcp->clone_mt == MT_FILTER) &&
- dcp->ifmatch(ifr.ifr_name)) {
-   clone_cb = dcp->clone_cb;
-   break;
-   }
}
}
-   if (clone_cb == NULL) {
+
+   if (dcp == NULL || dcp->clone_cb == NULL) {
/* NB: no parameters */
ioctl_ifcreate(s, );
} else {
-   clone_cb(s, );
+   dcp->clone_cb(s, );
}
 
/*
___
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: r368415 - head/stand/kshim

2020-12-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec  7 16:08:31 2020
New Revision: 368415
URL: https://svnweb.freebsd.org/changeset/base/368415

Log:
  Properly define the bool type in the BSD kernel shim.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.h

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Mon Dec  7 15:09:28 2020
(r368414)
+++ head/stand/kshim/bsd_kernel.h   Mon Dec  7 16:08:31 2020
(r368415)
@@ -274,7 +274,12 @@ typedef uint8_t *bus_space_handle_t;
 typedef int bus_dma_filter_t(void *, bus_addr_t);
 typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);
 
-typedef uint32_t bool;
+#ifndef __bool_true_false_are_defined
+#define__bool_true_false_are_defined
+typedef _Bool bool;
+#definetrue 1
+#definefalse 0
+#endif
 
 /* SYSINIT API */
 
___
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"


Re: svn commit: r368397 - in head: share/man/man4 sys/dev/mn

2020-12-07 Thread Hans Petter Selasky

On 12/7/20 11:44 AM, Hans Petter Selasky wrote:

On 12/6/20 10:34 PM, Ed Maste wrote:

+    gone_in_dev(dev, 13, "sync serial (T1/E1) driver");


Should be "self" instead of "dev" .



Ed: I just fixed it. Don't forget to include this when MFC'ing.

--HPS

___
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: r368409 - head/sys/dev/mn

2020-12-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec  7 11:18:51 2020
New Revision: 368409
URL: https://svnweb.freebsd.org/changeset/base/368409

Log:
  Fix compilation after r368397.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mn/if_mn.c

Modified: head/sys/dev/mn/if_mn.c
==
--- head/sys/dev/mn/if_mn.c Mon Dec  7 10:51:19 2020(r368408)
+++ head/sys/dev/mn/if_mn.c Mon Dec  7 11:18:51 2020(r368409)
@@ -1392,7 +1392,7 @@ mn_attach (device_t self)
default:
printf(" Rev 0x%x\n", sc->f54r->vstr);
}
-   gone_in_dev(dev, 13, "sync serial (T1/E1) driver");
+   gone_in_dev(self, 13, "sync serial (T1/E1) driver");
 
if (ng_make_node_common(, >node) != 0) {
printf("ng_make_node_common failed\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: r368408 - head/stand/kshim

2020-12-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec  7 10:51:19 2020
New Revision: 368408
URL: https://svnweb.freebsd.org/changeset/base/368408

Log:
  Add missing busdma prototypes for load and unload and implement dummy sync
  function for kernel bootloader shim code.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.c
  head/stand/kshim/bsd_kernel.h

Modified: head/stand/kshim/bsd_kernel.c
==
--- head/stand/kshim/bsd_kernel.c   Mon Dec  7 10:21:01 2020
(r368407)
+++ head/stand/kshim/bsd_kernel.c   Mon Dec  7 10:51:19 2020
(r368408)
@@ -92,6 +92,13 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, 
 }
 
 void
+bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, int flags)
+{
+   /* Assuming coherent memory */
+   __asm__ __volatile__("": : :"memory");
+}
+
+void
 bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Mon Dec  7 10:21:01 2020
(r368407)
+++ head/stand/kshim/bsd_kernel.h   Mon Dec  7 10:51:19 2020
(r368408)
@@ -669,6 +669,11 @@ extern int delay(unsigned int);
 #defineBUS_DMA_BUS30x40
 #defineBUS_DMA_BUS40x80
 
+#defineBUS_DMASYNC_PREREAD 0x01
+#defineBUS_DMASYNC_POSTREAD0x02
+#defineBUS_DMASYNC_PREWRITE0x04
+#defineBUS_DMASYNC_POSTWRITE   0x08
+
 typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
 
 int
@@ -679,9 +684,14 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
   bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
   void *lockfuncarg, bus_dma_tag_t *dmat);
 
-int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
-bus_dmamap_t *mapp);
-void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
-int bus_dma_tag_destroy(bus_dma_tag_t dmat);
+int bus_dmamem_alloc(bus_dma_tag_t, void** vaddr, int flags, bus_dmamap_t *);
+void bus_dmamem_free(bus_dma_tag_t, void *vaddr, bus_dmamap_t);
+int bus_dma_tag_destroy(bus_dma_tag_t);
+
+int bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *buf,
+bus_size_t buflen, bus_dmamap_callback_t *,
+void *callback_arg, int flags);
+void bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
+void bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, int flags);
 
 #endif /* _BSD_KERNEL_H_ */
___
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"


Re: svn commit: r368397 - in head: share/man/man4 sys/dev/mn

2020-12-07 Thread Hans Petter Selasky

On 12/6/20 10:34 PM, Ed Maste wrote:

+   gone_in_dev(dev, 13, "sync serial (T1/E1) driver");
  


Should be "self" instead of "dev" .

--HPS
___
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: r368407 - head/stand/kshim

2020-12-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec  7 10:21:01 2020
New Revision: 368407
URL: https://svnweb.freebsd.org/changeset/base/368407

Log:
  Tidy up code a bit. Add missing section comments.
  No functional change.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.c

Modified: head/stand/kshim/bsd_kernel.c
==
--- head/stand/kshim/bsd_kernel.c   Mon Dec  7 09:48:06 2020
(r368406)
+++ head/stand/kshim/bsd_kernel.c   Mon Dec  7 10:21:01 2020
(r368407)
@@ -30,23 +30,14 @@ struct usb_process usb_process[USB_PROC_MAX];
 
 static device_t usb_pci_root;
 
-/**
- * Implementation of mutex API
- **/
-
-struct mtx Giant;
 int (*bus_alloc_resource_any_cb)(struct resource *res, device_t dev,
 int type, int *rid, unsigned int flags);
 int (*ofw_bus_status_ok_cb)(device_t dev);
 int (*ofw_bus_is_compatible_cb)(device_t dev, char *name);
 
-static void
-mtx_system_init(void *arg)
-{
-   mtx_init(, "Giant", NULL, MTX_DEF | MTX_RECURSE);
-}
-SYSINIT(mtx_system_init, SI_SUB_LOCK, SI_ORDER_MIDDLE, mtx_system_init, NULL);
-
+/**
+ * Implementation of busdma API
+ **/
 int
 bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
   bus_size_t boundary, bus_addr_t lowaddr,
@@ -115,6 +106,10 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
return (0);
 }
 
+/**
+ * Implementation of resource management API
+ **/
+
 struct resource *
 bus_alloc_resource_any(device_t dev, int type, int *rid, unsigned int flags)
 {
@@ -254,6 +249,19 @@ ofw_bus_is_compatible(device_t dev, char *name)
 
return ((*ofw_bus_is_compatible_cb)(dev, name));
 }
+
+/**
+ * Implementation of mutex API
+ **/
+
+struct mtx Giant;
+
+static void
+mtx_system_init(void *arg)
+{
+   mtx_init(, "Giant", NULL, MTX_DEF | MTX_RECURSE);
+}
+SYSINIT(mtx_system_init, SI_SUB_LOCK, SI_ORDER_MIDDLE, mtx_system_init, NULL);
 
 void
 mtx_init(struct mtx *mtx, const char *name, const char *type, int opt)
___
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: r368406 - head/sys/compat/linuxkpi/common/include/linux

2020-12-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec  7 09:48:06 2020
New Revision: 368406
URL: https://svnweb.freebsd.org/changeset/base/368406

Log:
  Prefer using the MIN() function macro over the min() inline function
  in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD
  min() is a static inline function clamping its arguments to
  "unsigned int".
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h
  head/sys/compat/linuxkpi/common/include/linux/scatterlist.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon Dec  7 
09:21:06 2020(r368405)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon Dec  7 
09:48:06 2020(r368406)
@@ -360,7 +360,7 @@ linux_reg_op(unsigned long *bitmap, int pos, int order
 index = pos / BITS_PER_LONG;
 offset = pos - (index * BITS_PER_LONG);
 nlongs_reg = BITS_TO_LONGS(nbits_reg);
-nbitsinlong = min(nbits_reg,  BITS_PER_LONG);
+nbitsinlong = MIN(nbits_reg,  BITS_PER_LONG);
 
 mask = (1UL << (nbitsinlong - 1));
 mask += mask - 1;

Modified: head/sys/compat/linuxkpi/common/include/linux/scatterlist.h
==
--- head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Mon Dec  7 
09:21:06 2020(r368405)
+++ head/sys/compat/linuxkpi/common/include/linux/scatterlist.h Mon Dec  7 
09:48:06 2020(r368406)
@@ -343,7 +343,7 @@ __sg_alloc_table_from_pages(struct sg_table *sgt,
}
 
seg_size = ((j - cur) << PAGE_SHIFT) - off;
-   sg_set_page(s, pages[cur], min(size, seg_size), off);
+   sg_set_page(s, pages[cur], MIN(size, seg_size), off);
size -= seg_size;
off = 0;
cur = j;
___
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: r368405 - head/sys/sys

2020-12-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec  7 09:21:06 2020
New Revision: 368405
URL: https://svnweb.freebsd.org/changeset/base/368405

Log:
  Allow sys/refcount.h to be used by standalone builds.
  No functional change.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/sys/refcount.h

Modified: head/sys/sys/refcount.h
==
--- head/sys/sys/refcount.h Mon Dec  7 04:45:29 2020(r368404)
+++ head/sys/sys/refcount.h Mon Dec  7 09:21:06 2020(r368405)
@@ -32,7 +32,7 @@
 
 #include 
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 #include 
 #else
 #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: r368353 - head/sys/netinet6

2020-12-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec  4 21:51:47 2020
New Revision: 368353
URL: https://svnweb.freebsd.org/changeset/base/368353

Log:
  Expose nonstandard IPv6 kernel definitions to standalone builds.
  No functional change.
  
  Reviewed by:  bz@
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/netinet6/in6.h

Modified: head/sys/netinet6/in6.h
==
--- head/sys/netinet6/in6.h Fri Dec  4 21:34:48 2020(r368352)
+++ head/sys/netinet6/in6.h Fri Dec  4 21:51:47 2020(r368353)
@@ -103,7 +103,7 @@ struct in6_addr {
 };
 
 #define s6_addr   __u6_addr.__u6_addr8
-#ifdef _KERNEL /* XXX nonstandard */
+#if defined(_KERNEL) || defined(_STANDALONE) /* XXX nonstandard */
 #define s6_addr8  __u6_addr.__u6_addr8
 #define s6_addr16 __u6_addr.__u6_addr16
 #define s6_addr32 __u6_addr.__u6_addr32
___
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: r368341 - head/stand/kshim

2020-12-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec  4 16:51:59 2020
New Revision: 368341
URL: https://svnweb.freebsd.org/changeset/base/368341

Log:
  Fix mis-spelled macro in the kernel shim.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.h

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Fri Dec  4 16:24:44 2020
(r368340)
+++ head/stand/kshim/bsd_kernel.h   Fri Dec  4 16:51:59 2020
(r368341)
@@ -217,7 +217,7 @@ typedef unsigned long long uint64_t;
 #else
 typedef unsigned long uint64_t;
 #endif
-#define_INT16_T_DECLARED
+#define_INT64_T_DECLARED
 #ifndef __LP64__
 typedef signed long long int64_t;
 #else
___
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"


Re: svn commit: r368329 - head/stand/kshim

2020-12-04 Thread Hans Petter Selasky

On 12/4/20 5:31 PM, Warner Losh wrote:

Hi Alexander,

I'm not sure how that definition will work together with existing code,
mixing uint64_t, unsigned long, and unsigned long long. Will this cause
more compiler warnings? This also will affect user-space and ports.


I think for the boot loader context, this suggestion will be completely
fine. Since this file is only used there, it should be identical to your
changes in that context.


Hi,

Does this mean that all uintXX_t types should go this way? I like 
symmetry. Or only uint64_t?


The reason for changing this the way I did are expectations in the 
current code. Right now, uint64_t _must_ be defined exactly like 
unsigned long for amd64, else I get silly warnings like this:


sys/compat/linuxkpi/common/include/asm/atomic64.h:140:38: error: 
incompatible
  pointer types passing 'int64_t *' (aka 'long long *') to 
parameter of type 'u_long *'

  (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
if (atomic_fcmpset_64(>counter, , new))

--HPS
___
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"


Re: svn commit: r368329 - head/stand/kshim

2020-12-04 Thread Hans Petter Selasky

On 12/4/20 4:59 PM, Alexander Richardson wrote:

On Fri, 4 Dec 2020 at 14:51, Hans Petter Selasky  wrote:


Author: hselasky
Date: Fri Dec  4 14:50:55 2020
New Revision: 368329
URL: https://svnweb.freebsd.org/changeset/base/368329

Log:
   Fix definition of int64_t and uint64_t when long is 64-bit. This gets the 
kernel
   shim code in line with the rest of the kernel, sys/x86/include/_types.h.

   MFC after:1 week
   Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
   head/stand/kshim/bsd_kernel.h

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Fri Dec  4 14:09:12 2020
(r368328)
+++ head/stand/kshim/bsd_kernel.h   Fri Dec  4 14:50:55 2020
(r368329)
@@ -208,9 +208,17 @@ typedef unsigned int uint32_t;
  #define_INT32_T_DECLARED
  typedef signed int int32_t;
  #define_UINT64_T_DECLARED
+#ifndef __LP64__
  typedef unsigned long long uint64_t;
+#else
+typedef unsigned long uint64_t;
+#endif
  #define_INT16_T_DECLARED
+#ifndef __LP64__
  typedef signed long long int64_t;
+#else
+typedef signed long int64_t;
+#endif

  typedef uint16_t uid_t;
  typedef uint16_t gid_t;


Since we no longer support ancient compilers, could we simplify this
and just use
typedef __UINT64_TYPE__ uint64_t;
typedef __INT64_TYPE__ int64_t;
?

This will work across all architectures and ABIs, and appears to work
starting with GCC 4.5.3 and Clang 3.5:
https://godbolt.org/z/TWavfb


Hi Alexander,

I'm not sure how that definition will work together with existing code, 
mixing uint64_t, unsigned long, and unsigned long long. Will this cause 
more compiler warnings? This also will affect user-space and ports.


Maybe Konstantin, CC'ed, has some input on this?

--HPS

___
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: r368336 - head/sys/compat/linuxkpi/common/include/linux

2020-12-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec  4 15:50:44 2020
New Revision: 368336
URL: https://svnweb.freebsd.org/changeset/base/368336

Log:
  Allow the rbtree header file in the LinuxKPI to be used in standalone code.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/rbtree.h

Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h
==
--- head/sys/compat/linuxkpi/common/include/linux/rbtree.h  Fri Dec  4 
15:46:48 2020(r368335)
+++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h  Fri Dec  4 
15:50:44 2020(r368336)
@@ -31,7 +31,10 @@
 #ifndef_LINUX_RBTREE_H_
 #define_LINUX_RBTREE_H_
 
+#ifndef _STANDALONE
 #include 
+#endif
+
 #include 
 
 struct rb_node {
___
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: r368335 - head/sys/compat/linuxkpi/common/include/linux

2020-12-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec  4 15:46:48 2020
New Revision: 368335
URL: https://svnweb.freebsd.org/changeset/base/368335

Log:
  Allow the list header file in the LinuxKPI to be used in standalone code.
  Some style and spelling nits while at it.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/list.h

Modified: head/sys/compat/linuxkpi/common/include/linux/list.h
==
--- head/sys/compat/linuxkpi/common/include/linux/list.hFri Dec  4 
15:23:43 2020(r368334)
+++ head/sys/compat/linuxkpi/common/include/linux/list.hFri Dec  4 
15:46:48 2020(r368335)
@@ -31,8 +31,9 @@
 #ifndef _LINUX_LIST_H_
 #define _LINUX_LIST_H_
 
+#ifndef _STANDALONE
 /*
- * Since LIST_HEAD conflicts with the linux definition we must include any
+ * Since LIST_HEAD conflicts with the Linux definition we must include any
  * FreeBSD header which requires it here so it is resolved with the correct
  * definition prior to the undef.
  */
@@ -69,10 +70,12 @@
 #include 
 #include 
 #include 
+#endif
 
 #ifndef prefetch
 #defineprefetch(x)
 #endif
+
 #define LINUX_LIST_HEAD_INIT(name) { &(name), &(name) }
 
 #define LINUX_LIST_HEAD(name) \
___
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: r368330 - head/stand/kshim

2020-12-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec  4 14:52:41 2020
New Revision: 368330
URL: https://svnweb.freebsd.org/changeset/base/368330

Log:
  Add more macros, types and prototypes for building kernel code into 
bootloaders.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.h

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Fri Dec  4 14:50:55 2020
(r368329)
+++ head/stand/kshim/bsd_kernel.h   Fri Dec  4 14:52:41 2020
(r368330)
@@ -38,6 +38,7 @@
 #include 
 #include 
 
+#defineoffsetof(type, field) __builtin_offsetof(type, field)
 #definehowmany(x, y)   (((x)+((y)-1))/(y))
 #definenitems(x)   (sizeof((x)) / sizeof((x)[0]))
 #defineisalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 
'Z'))
@@ -77,6 +78,7 @@ struct sysctl_req {
 #defineEVENTHANDLER_DECLARE(...)
 #defineEVENTHANDLER_INVOKE(...)
 #defineKASSERT(...)
+#defineCTASSERT(x) _Static_assert(x, "compile-time assertion failed")
 #defineSCHEDULER_STOPPED(x) (0)
 #definePI_SWI(...) (0)
 #defineUNIQ_NAME(x) x
@@ -119,6 +121,8 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs),\
 #definehz 1000
 #undef PAGE_SIZE
 #definePAGE_SIZE 4096
+#undef PAGE_SHIFT
+#definePAGE_SHIFT 12
 #undef MIN
 #defineMIN(a,b) (((a) < (b)) ? (a) : (b))
 #undef MAX
@@ -227,10 +231,21 @@ typedef uint16_t mode_t;
 typedef uint8_t *caddr_t;
 #define_UINTPTR_T_DECLARED
 typedef unsigned long uintptr_t;
+#define_UINTMAX_T_DECLARED
+typedef unsigned long uintmax_t;
+typedef unsigned long vm_paddr_t;
 
 #define_SIZE_T_DECLARED
 typedef unsigned long size_t;
-typedef unsigned long u_long;
+#define_SSIZE_T_DECLARED
+typedef signed long ssize_t;
+#define_OFF_T_DECLARED
+typedef unsigned long off_t;
+
+typedef unsigned char   u_char;
+typedef unsigned short  u_short;
+typedef unsigned intu_int;
+typedef unsigned long   u_long;
 #endif
 
 typedef unsigned long bus_addr_t;
@@ -491,6 +506,7 @@ voidmodule_register(void *);
 
 void   *memset(void *, int, size_t len);
 void   *memcpy(void *, const void *, size_t len);
+intmemcmp(const void *, const void *, size_t len);
 intprintf(const char *,...) __printflike(1, 2);
 intsnprintf(char *restrict str, size_t size, const char *restrict 
format,...) __printflike(3, 4);
 size_t strlen(const char *s);
___
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: r368329 - head/stand/kshim

2020-12-04 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec  4 14:50:55 2020
New Revision: 368329
URL: https://svnweb.freebsd.org/changeset/base/368329

Log:
  Fix definition of int64_t and uint64_t when long is 64-bit. This gets the 
kernel
  shim code in line with the rest of the kernel, sys/x86/include/_types.h.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.h

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Fri Dec  4 14:09:12 2020
(r368328)
+++ head/stand/kshim/bsd_kernel.h   Fri Dec  4 14:50:55 2020
(r368329)
@@ -208,9 +208,17 @@ typedef unsigned int uint32_t;
 #define_INT32_T_DECLARED
 typedef signed int int32_t;
 #define_UINT64_T_DECLARED
+#ifndef __LP64__
 typedef unsigned long long uint64_t;
+#else
+typedef unsigned long uint64_t;
+#endif
 #define_INT16_T_DECLARED
+#ifndef __LP64__
 typedef signed long long int64_t;
+#else
+typedef signed long int64_t;
+#endif
 
 typedef uint16_t uid_t;
 typedef uint16_t gid_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: r368298 - stable/11/sbin/ifconfig

2020-12-03 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec  3 10:41:06 2020
New Revision: 368298
URL: https://svnweb.freebsd.org/changeset/base/368298

Log:
  MFC r368058:
  Ensure consistent error messages from ifconfig(8).
  
  If multiple threads are invoking "ifconfig XXX create" a race may occur
  which can lead to two different error messages for the same error.
  
  a) ifconfig: SIOCIFCREATE2: File exists
  b) ifconfig: interface XXX already exists
  
  This patch ensures ifconfig prints the same error code
  for the same case.
  
  Reviewed by:  imp@ and kib@
  Differential Revision:https://reviews.freebsd.org/D27380
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sbin/ifconfig/ifclone.c
  stable/11/sbin/ifconfig/ifconfig.c
  stable/11/sbin/ifconfig/ifconfig.h
  stable/11/sbin/ifconfig/ifieee80211.c
  stable/11/sbin/ifconfig/ifvlan.c
  stable/11/sbin/ifconfig/ifvxlan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ifconfig/ifclone.c
==
--- stable/11/sbin/ifconfig/ifclone.c   Thu Dec  3 10:32:54 2020
(r368297)
+++ stable/11/sbin/ifconfig/ifclone.c   Thu Dec  3 10:41:06 2020
(r368298)
@@ -138,8 +138,7 @@ ifclonecreate(int s, void *arg)
}
if (clone_cb == NULL) {
/* NB: no parameters */
-   if (ioctl(s, SIOCIFCREATE2, ) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, );
} else {
clone_cb(s, );
}

Modified: stable/11/sbin/ifconfig/ifconfig.c
==
--- stable/11/sbin/ifconfig/ifconfig.c  Thu Dec  3 10:32:54 2020
(r368297)
+++ stable/11/sbin/ifconfig/ifconfig.c  Thu Dec  3 10:41:06 2020
(r368298)
@@ -185,6 +185,19 @@ usage(void)
exit(1);
 }
 
+void
+ioctl_ifcreate(int s, struct ifreq *ifr)
+{
+   if (ioctl(s, SIOCIFCREATE2, ifr) < 0) {
+   switch (errno) {
+   case EEXIST:
+   errx(1, "interface %s already exists", ifr->ifr_name);
+   default:
+   err(1, "SIOCIFCREATE2");
+   }
+   }
+}
+
 #define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0])
 
 static int

Modified: stable/11/sbin/ifconfig/ifconfig.h
==
--- stable/11/sbin/ifconfig/ifconfig.h  Thu Dec  3 10:32:54 2020
(r368297)
+++ stable/11/sbin/ifconfig/ifconfig.h  Thu Dec  3 10:41:06 2020
(r368298)
@@ -157,3 +157,4 @@ struct ifmediareq *ifmedia_getstate(int s);
 
 void print_vhid(const struct ifaddrs *, const char *);
 
+void ioctl_ifcreate(int s, struct ifreq *);

Modified: stable/11/sbin/ifconfig/ifieee80211.c
==
--- stable/11/sbin/ifconfig/ifieee80211.c   Thu Dec  3 10:32:54 2020
(r368297)
+++ stable/11/sbin/ifconfig/ifieee80211.c   Thu Dec  3 10:41:06 2020
(r368298)
@@ -5233,8 +5233,7 @@ wlan_create(int s, struct ifreq *ifr)
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
errx(1, "no bssid specified for WDS (use wlanbssid)");
ifr->ifr_data = (caddr_t) 
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 
/* XXX preserve original name for ifclonecreate(). */
strlcpy(orig_name, name, sizeof(orig_name));

Modified: stable/11/sbin/ifconfig/ifvlan.c
==
--- stable/11/sbin/ifconfig/ifvlan.cThu Dec  3 10:32:54 2020
(r368297)
+++ stable/11/sbin/ifconfig/ifvlan.cThu Dec  3 10:41:06 2020
(r368298)
@@ -105,8 +105,7 @@ vlan_create(int s, struct ifreq *ifr)
errx(1, "must specify a parent device for vlan create");
ifr->ifr_data = (caddr_t) 
}
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 }
 
 static void

Modified: stable/11/sbin/ifconfig/ifvxlan.c
==
--- stable/11/sbin/ifconfig/ifvxlan.c   Thu Dec  3 10:32:54 2020
(r368297)
+++ stable/11/sbin/ifconfig/ifvxlan.c   Thu Dec  3 10:41:06 2020
(r368298)
@@ -191,8 +191,7 @@ vxlan_create(int s, struct ifreq *ifr)
vxlan_check_params();
 
ifr->ifr_data = (caddr_t) 
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 }
 
 static
___
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: r368297 - stable/12/sbin/ifconfig

2020-12-03 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Dec  3 10:32:54 2020
New Revision: 368297
URL: https://svnweb.freebsd.org/changeset/base/368297

Log:
  MFC r368058:
  Ensure consistent error messages from ifconfig(8).
  
  If multiple threads are invoking "ifconfig XXX create" a race may occur
  which can lead to two different error messages for the same error.
  
  a) ifconfig: SIOCIFCREATE2: File exists
  b) ifconfig: interface XXX already exists
  
  This patch ensures ifconfig prints the same error code
  for the same case.
  
  Reviewed by:  imp@ and kib@
  Differential Revision:https://reviews.freebsd.org/D27380
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sbin/ifconfig/ifclone.c
  stable/12/sbin/ifconfig/ifconfig.c
  stable/12/sbin/ifconfig/ifconfig.h
  stable/12/sbin/ifconfig/ifieee80211.c
  stable/12/sbin/ifconfig/iflagg.c
  stable/12/sbin/ifconfig/ifvlan.c
  stable/12/sbin/ifconfig/ifvxlan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ifconfig/ifclone.c
==
--- stable/12/sbin/ifconfig/ifclone.c   Thu Dec  3 08:30:29 2020
(r368296)
+++ stable/12/sbin/ifconfig/ifclone.c   Thu Dec  3 10:32:54 2020
(r368297)
@@ -140,8 +140,7 @@ ifclonecreate(int s, void *arg)
}
if (clone_cb == NULL) {
/* NB: no parameters */
-   if (ioctl(s, SIOCIFCREATE2, ) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, );
} else {
clone_cb(s, );
}

Modified: stable/12/sbin/ifconfig/ifconfig.c
==
--- stable/12/sbin/ifconfig/ifconfig.c  Thu Dec  3 08:30:29 2020
(r368296)
+++ stable/12/sbin/ifconfig/ifconfig.c  Thu Dec  3 10:32:54 2020
(r368297)
@@ -198,6 +198,19 @@ usage(void)
exit(1);
 }
 
+void
+ioctl_ifcreate(int s, struct ifreq *ifr)
+{
+   if (ioctl(s, SIOCIFCREATE2, ifr) < 0) {
+   switch (errno) {
+   case EEXIST:
+   errx(1, "interface %s already exists", ifr->ifr_name);
+   default:
+   err(1, "SIOCIFCREATE2");
+   }
+   }
+}
+
 #define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0])
 
 static int

Modified: stable/12/sbin/ifconfig/ifconfig.h
==
--- stable/12/sbin/ifconfig/ifconfig.h  Thu Dec  3 08:30:29 2020
(r368296)
+++ stable/12/sbin/ifconfig/ifconfig.h  Thu Dec  3 10:32:54 2020
(r368297)
@@ -158,3 +158,4 @@ struct ifmediareq *ifmedia_getstate(int s);
 
 void print_vhid(const struct ifaddrs *, const char *);
 
+void ioctl_ifcreate(int s, struct ifreq *);

Modified: stable/12/sbin/ifconfig/ifieee80211.c
==
--- stable/12/sbin/ifconfig/ifieee80211.c   Thu Dec  3 08:30:29 2020
(r368296)
+++ stable/12/sbin/ifconfig/ifieee80211.c   Thu Dec  3 10:32:54 2020
(r368297)
@@ -5758,8 +5758,7 @@ wlan_create(int s, struct ifreq *ifr)
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
errx(1, "no bssid specified for WDS (use wlanbssid)");
ifr->ifr_data = (caddr_t) 
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 
/* XXX preserve original name for ifclonecreate(). */
strlcpy(orig_name, name, sizeof(orig_name));

Modified: stable/12/sbin/ifconfig/iflagg.c
==
--- stable/12/sbin/ifconfig/iflagg.cThu Dec  3 08:30:29 2020
(r368296)
+++ stable/12/sbin/ifconfig/iflagg.cThu Dec  3 10:32:54 2020
(r368297)
@@ -322,8 +322,7 @@ static void
 lagg_create(int s, struct ifreq *ifr)
 {
ifr->ifr_data = (caddr_t) 
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 }
 
 static struct cmd lagg_cmds[] = {

Modified: stable/12/sbin/ifconfig/ifvlan.c
==
--- stable/12/sbin/ifconfig/ifvlan.cThu Dec  3 08:30:29 2020
(r368296)
+++ stable/12/sbin/ifconfig/ifvlan.cThu Dec  3 10:32:54 2020
(r368297)
@@ -107,8 +107,7 @@ vlan_create(int s, struct ifreq *ifr)
errx(1, "must specify a parent device for vlan create");
ifr->ifr_data = (caddr_t) 
}
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 }
 
 static void

Modified: stable/12/sbin/ifconfig/ifvxlan.c
==
--- stable/12/sbin/ifconfig/ifvxlan.c   Thu Dec  3 08:30:29 2020
(r368296)
+++ 

svn commit: r368229 - in stable/12: sbin/ifconfig share/man/man4 sys/conf sys/net

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:58:14 2020
New Revision: 368229
URL: https://svnweb.freebsd.org/changeset/base/368229

Log:
  MFC r366933 and r366934:
  Add support for IP over infiniband, IPoIB, to lagg(4). Currently only
  the failover protocol is supported due to limitations in the IPoIB
  architecture. Refer to the lagg(4) manual page for how to configure
  and use this new feature. A new network interface type,
  IFT_INFINIBANDLAG, has been added, similar to the existing
  IFT_IEEE8023ADLAG .
  
  ifconfig(8) has been updated to accept a new laggtype argument when
  creating lagg(4) network interfaces. This new argument is used to
  distinguish between ethernet and infiniband type of lagg(4) network
  interface. The laggtype argument is optional and defaults to
  ethernet. The lagg(4) command line syntax is backwards compatible.
  
  Differential Revision:https://reviews.freebsd.org/D26254
  Reviewed by:  melifaro@
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sbin/ifconfig/ifconfig.8
  stable/12/sbin/ifconfig/iflagg.c
  stable/12/share/man/man4/lagg.4
  stable/12/sys/conf/files
  stable/12/sys/net/ieee8023ad_lacp.c
  stable/12/sys/net/if_ethersubr.c
  stable/12/sys/net/if_infiniband.c
  stable/12/sys/net/if_lagg.c
  stable/12/sys/net/if_lagg.h
  stable/12/sys/net/if_types.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ifconfig/ifconfig.8
==
--- stable/12/sbin/ifconfig/ifconfig.8  Tue Dec  1 13:47:16 2020
(r368228)
+++ stable/12/sbin/ifconfig/ifconfig.8  Tue Dec  1 13:58:14 2020
(r368229)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd November 1, 2020
+.Dd December 1, 2020
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2429,6 +2429,12 @@ Set to 0 to disable.
 .Pp
 The following parameters are specific to lagg interfaces:
 .Bl -tag -width indent
+.It Cm laggtype Ar type
+When creating a lagg interface the type can be specified as either
+.Cm ethernet
+or
+.Cm infiniband .
+If not specified ethernet is the default lagg type.
 .It Cm laggport Ar interface
 Add the interface named by
 .Ar interface

Modified: stable/12/sbin/ifconfig/iflagg.c
==
--- stable/12/sbin/ifconfig/iflagg.cTue Dec  1 13:47:16 2020
(r368228)
+++ stable/12/sbin/ifconfig/iflagg.cTue Dec  1 13:58:14 2020
(r368229)
@@ -30,8 +30,12 @@ static const char rcsid[] =
 
 #include "ifconfig.h"
 
-char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */
+static struct iflaggparam params = {
+   .lagg_type = LAGG_TYPE_DEFAULT,
+};
 
+static char lacpbuf[120];  /* LACP peer '[(a,a,a),(p,p,p)]' */
+
 static void
 setlaggport(const char *val, int d, int s, const struct afswtch *afp)
 {
@@ -299,7 +303,31 @@ lagg_status(int s)
}
 }
 
+static
+DECL_CMD_FUNC(setlaggtype, arg, d)
+{
+   static const struct lagg_types lt[] = LAGG_TYPES;
+   int i;
+
+   for (i = 0; i < nitems(lt); i++) {
+   if (strcmp(arg, lt[i].lt_name) == 0) {
+   params.lagg_type = lt[i].lt_value;
+   return;
+   }
+   }
+   errx(1, "invalid lagg type: %s", arg);
+}
+
+static void
+lagg_create(int s, struct ifreq *ifr)
+{
+   ifr->ifr_data = (caddr_t) 
+   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
+   err(1, "SIOCIFCREATE2");
+}
+
 static struct cmd lagg_cmds[] = {
+   DEF_CLONE_CMD_ARG("laggtype",   setlaggtype),
DEF_CMD_ARG("laggport", setlaggport),
DEF_CMD_ARG("-laggport",unsetlaggport),
DEF_CMD_ARG("laggproto",setlaggproto),
@@ -331,4 +359,5 @@ lagg_ctor(void)
for (i = 0; i < nitems(lagg_cmds);  i++)
cmd_register(_cmds[i]);
af_register(_lagg);
+   clone_setdefcallback("lagg", lagg_create);
 }

Modified: stable/12/share/man/man4/lagg.4
==
--- stable/12/share/man/man4/lagg.4 Tue Dec  1 13:47:16 2020
(r368228)
+++ stable/12/share/man/man4/lagg.4 Tue Dec  1 13:58:14 2020
(r368229)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 18, 2017
+.Dd October 21, 2020
 .Dt LAGG 4
 .Os
 .Sh NAME
@@ -192,6 +192,15 @@ device will be used:
 .Pp
 (Note the mac address of the wireless device is forced to match the wired
 device as a workaround.)
+.Pp
+The following example shows how to create an infiniband failover interface.
+.Bd -literal -offset indent
+# ifconfig ib0 up
+# ifconfig ib1 up
+# ifconfig lagg0 create laggtype infiniband
+# ifconfig lagg0 laggproto failover laggport ib0 laggport ib1 \e
+   1.1.1.1 netmask 255.255.255.0
+.Ed
 .Sh SEE ALSO
 .Xr ng_one2many 4 ,
 .Xr ifconfig 8 ,

Modified: stable/12/sys/conf/files

svn commit: r368228 - in stable/12/sys: kern sys

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:47:16 2020
New Revision: 368228
URL: https://svnweb.freebsd.org/changeset/base/368228

Log:
  MFC r366931:
  Implement mbuf hashing routines for IP over infiniband, IPoIB.
  No functional change intended.
  
  Differential Revision:https://reviews.freebsd.org/D26254
  Reviewed by:  melifaro@
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/kern/uipc_mbufhash.c
  stable/12/sys/sys/mbuf.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/uipc_mbufhash.c
==
--- stable/12/sys/kern/uipc_mbufhash.c  Tue Dec  1 13:44:33 2020
(r368227)
+++ stable/12/sys/kern/uipc_mbufhash.c  Tue Dec  1 13:47:16 2020
(r368228)
@@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #if defined(INET) || defined(INET6)
 #include 
@@ -42,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 static const void *
-m_ether_tcpip_hash_gethdr(const struct mbuf *m, const u_int off,
+m_common_hash_gethdr(const struct mbuf *m, const u_int off,
 const u_int len, void *buf)
 {
 
@@ -65,9 +66,19 @@ m_ether_tcpip_hash_init(void)
 }
 
 uint32_t
-m_ether_tcpip_hash(const uint32_t flags, const struct mbuf *m,
-const uint32_t key)
+m_infiniband_tcpip_hash_init(void)
 {
+   uint32_t seed;
+
+   seed = arc4random();
+   return (fnv_32_buf(, sizeof(seed), FNV1_32_INIT));
+}
+
+static inline uint32_t
+m_tcpip_hash(const uint32_t flags, const struct mbuf *m,
+uint32_t p, int off, const uint16_t etype)
+{
+#if defined(INET) || defined(INET6)
union {
 #ifdef INET
struct ip ip;
@@ -75,49 +86,19 @@ m_ether_tcpip_hash(const uint32_t flags, const struct 
 #ifdef INET6
struct ip6_hdr ip6;
 #endif
-   struct ether_vlan_header vlan;
uint32_t port;
} buf;
-   const struct ether_header *eh;
-   const struct ether_vlan_header *vlan;
 #ifdef INET
const struct ip *ip;
 #endif
 #ifdef INET6
const struct ip6_hdr *ip6;
 #endif
-   uint32_t p;
-   int off;
-   uint16_t etype;
-
-   p = key;
-   off = sizeof(*eh);
-   if (m->m_len < off)
-   goto done;
-   eh = mtod(m, struct ether_header *);
-   etype = ntohs(eh->ether_type);
-   if (flags & MBUF_HASHFLAG_L2) {
-   p = fnv_32_buf(>ether_shost, ETHER_ADDR_LEN, p);
-   p = fnv_32_buf(>ether_dhost, ETHER_ADDR_LEN, p);
-   }
-   /* Special handling for encapsulating VLAN frames */
-   if ((m->m_flags & M_VLANTAG) && (flags & MBUF_HASHFLAG_L2)) {
-   p = fnv_32_buf(>m_pkthdr.ether_vtag,
-   sizeof(m->m_pkthdr.ether_vtag), p);
-   } else if (etype == ETHERTYPE_VLAN) {
-   vlan = m_ether_tcpip_hash_gethdr(m, off, sizeof(*vlan), );
-   if (vlan == NULL)
-   goto done;
-
-   if (flags & MBUF_HASHFLAG_L2)
-   p = fnv_32_buf(>evl_tag, sizeof(vlan->evl_tag), 
p);
-   etype = ntohs(vlan->evl_proto);
-   off += sizeof(*vlan) - sizeof(*eh);
-   }
+#endif
switch (etype) {
 #ifdef INET
case ETHERTYPE_IP:
-   ip = m_ether_tcpip_hash_gethdr(m, off, sizeof(*ip), );
+   ip = m_common_hash_gethdr(m, off, sizeof(*ip), );
if (ip == NULL)
break;
if (flags & MBUF_HASHFLAG_L3) {
@@ -136,7 +117,7 @@ m_ether_tcpip_hash(const uint32_t flags, const struct 
if (iphlen < sizeof(*ip))
break;
off += iphlen;
-   ports = m_ether_tcpip_hash_gethdr(m,
+   ports = m_common_hash_gethdr(m,
off, sizeof(*ports), );
if (ports == NULL)
break;
@@ -150,7 +131,7 @@ m_ether_tcpip_hash(const uint32_t flags, const struct 
 #endif
 #ifdef INET6
case ETHERTYPE_IPV6:
-   ip6 = m_ether_tcpip_hash_gethdr(m, off, sizeof(*ip6), );
+   ip6 = m_common_hash_gethdr(m, off, sizeof(*ip6), );
if (ip6 == NULL)
break;
if (flags & MBUF_HASHFLAG_L3) {
@@ -169,6 +150,62 @@ m_ether_tcpip_hash(const uint32_t flags, const struct 
default:
break;
}
-done:
return (p);
+}
+
+uint32_t
+m_ether_tcpip_hash(const uint32_t flags, const struct mbuf *m,
+uint32_t p)
+{
+   union {
+   struct ether_vlan_header vlan;
+   } buf;
+   const struct ether_header *eh;
+   const struct ether_vlan_header *vlan;
+   int off;
+   uint16_t etype;
+
+   off = sizeof(*eh);
+   if (m->m_len < off)
+   return 

svn commit: r368227 - in stable/12/sys: conf modules modules/if_infiniband net ofed/drivers/infiniband/ulp/ipoib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:44:33 2020
New Revision: 368227
URL: https://svnweb.freebsd.org/changeset/base/368227

Log:
  MFC r366930, r366936, r366993 and r366994:
  Factor out generic IP over infiniband, IPoIB, definitions and code
  into net/if_infiniband.c and net/infiniband.h . No functional change
  intended.
  
  Differential Revision:https://reviews.freebsd.org/D26254
  Reviewed by:  melifaro@
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Added:
  stable/12/sys/modules/if_infiniband/
 - copied from r366930, head/sys/modules/if_infiniband/
  stable/12/sys/net/if_infiniband.c
 - copied, changed from r366930, head/sys/net/if_infiniband.c
  stable/12/sys/net/infiniband.h
 - copied, changed from r366930, head/sys/net/infiniband.h
Modified:
  stable/12/sys/conf/files
  stable/12/sys/modules/Makefile
  stable/12/sys/modules/if_infiniband/Makefile
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
  stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesTue Dec  1 13:10:25 2020(r368226)
+++ stable/12/sys/conf/filesTue Dec  1 13:44:33 2020(r368227)
@@ -4578,6 +4578,7 @@ compat/lindebugfs/lindebugfs.c
optional lindebugfs \
compile-with "${LINUXKPI_C}"
 
 # OpenFabrics Enterprise Distribution (Infiniband)
+net/if_infiniband.coptional ofed
 ofed/drivers/infiniband/core/ib_addr.c optional ofed   \
compile-with "${OFED_C}"
 ofed/drivers/infiniband/core/ib_agent.coptional ofed   
\

Modified: stable/12/sys/modules/Makefile
==
--- stable/12/sys/modules/Makefile  Tue Dec  1 13:10:25 2020
(r368226)
+++ stable/12/sys/modules/Makefile  Tue Dec  1 13:44:33 2020
(r368227)
@@ -171,6 +171,7 @@ SUBDIR= \
${_if_gif} \
${_if_gre} \
${_if_me} \
+   if_infiniband \
if_lagg \
${_if_ndis} \
${_if_stf} \

Modified: stable/12/sys/modules/if_infiniband/Makefile
==
--- head/sys/modules/if_infiniband/Makefile Thu Oct 22 09:09:53 2020
(r366930)
+++ stable/12/sys/modules/if_infiniband/MakefileTue Dec  1 13:44:33 
2020(r368227)
@@ -4,6 +4,8 @@
 
 KMOD=  if_infiniband
 SRCS=  if_infiniband.c \
+   device_if.h \
+   bus_if.h \
opt_inet.h \
opt_inet6.h
 

Copied and modified: stable/12/sys/net/if_infiniband.c (from r366930, 
head/sys/net/if_infiniband.c)
==
--- head/sys/net/if_infiniband.cThu Oct 22 09:09:53 2020
(r366930, copy source)
+++ stable/12/sys/net/if_infiniband.c   Tue Dec  1 13:44:33 2020
(r368227)
@@ -29,30 +29,30 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include 
 #include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
 
-#include 
-#include 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
-#include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-
 #include 
 #include 
 
@@ -60,8 +60,8 @@ __FBSDID("$FreeBSD$");
 
 #ifdef INET
 static inline void
-infiniband_ipv4_multicast_map(uint32_t addr,
-const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv4_multicast_map(
+uint32_t addr, const uint8_t *broadcast, uint8_t *buf)
 {
uint8_t scope;
 
@@ -93,8 +93,8 @@ infiniband_ipv4_multicast_map(uint32_t addr,
 
 #ifdef INET6
 static inline void
-infiniband_ipv6_multicast_map(const struct in6_addr *addr,
-const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv6_multicast_map(
+const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf)
 {
uint8_t scope;
 
@@ -122,7 +122,7 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb
 {
struct infiniband_header *ibh;
struct ether_header eh;
-  
+
if (mb->m_len < sizeof(*ibh))
return;
 
@@ -155,8 +155,6 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c
uint16_t type;
bool is_gw;
 
-   NET_EPOCH_ASSERT();
-
is_gw = ((ro != NULL) && (ro->ro_flags & RT_HAS_GW) != 0);
 
 #ifdef MAC
@@ -192,7 +190,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c
if (error) {
if (error == EWOULDBLOCK)
error = 0;
-  

svn commit: r368226 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:10:25 2020
New Revision: 368226
URL: https://svnweb.freebsd.org/changeset/base/368226

Log:
  MFC r367719:
  Make mlx5_cmd_exec_cb() a safe API in mlx5core.
  
  APIs that have deferred callbacks should have some kind of cleanup
  function that callers can use to fence the callbacks. Otherwise things
  like module unloading can lead to dangling function pointers, or worse.
  
  The IB MR code is the only place that calls this function and had a
  really poor attempt at creating this fence. Provide a good version in
  the core code as future patches will add more places that need this
  fence.
  
  Linux commit:
  e355477ed9e4f401e3931043df97325d38552d54
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/mlx5/driver.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_mr.c
  stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib.h
  stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/driver.h
==
--- stable/11/sys/dev/mlx5/driver.h Tue Dec  1 13:09:04 2020
(r368225)
+++ stable/11/sys/dev/mlx5/driver.h Tue Dec  1 13:10:25 2020
(r368226)
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -925,11 +926,30 @@ void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
 void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
 void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome);
 int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type);
+
+struct mlx5_async_ctx {
+   struct mlx5_core_dev *dev;
+   atomic_t num_inflight;
+   struct wait_queue_head wait;
+};
+
+struct mlx5_async_work;
+
+typedef void (*mlx5_async_cbk_t)(int status, struct mlx5_async_work *context);
+
+struct mlx5_async_work {
+   struct mlx5_async_ctx *ctx;
+   mlx5_async_cbk_t user_callback;
+};
+
+void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+struct mlx5_async_ctx *ctx);
+void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx);
+int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
+void *out, int out_size, mlx5_async_cbk_t callback,
+struct mlx5_async_work *work);
 int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
  int out_size);
-int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-void *out, int out_size, mlx5_cmd_cbk_t callback,
-void *context);
 int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,
  void *out, int out_size);
 int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
@@ -964,9 +984,10 @@ void mlx5_init_mr_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
 struct mlx5_core_mr *mkey,
-u32 *in, int inlen,
-u32 *out, int outlen,
-mlx5_cmd_cbk_t callback, void *context);
+struct mlx5_async_ctx *async_ctx, u32 *in,
+int inlen, u32 *out, int outlen,
+mlx5_async_cbk_t callback,
+struct mlx5_async_work *context);
 int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
  struct mlx5_core_mr *mr,
  u32 *in, int inlen);

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec  1 13:09:04 2020
(r368225)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec  1 13:10:25 2020
(r368226)
@@ -1345,11 +1345,57 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in,
 }
 EXPORT_SYMBOL(mlx5_cmd_exec);
 
-int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-void *out, int out_size, mlx5_cmd_cbk_t callback,
-void *context)
+void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+struct mlx5_async_ctx *ctx)
 {
-   return cmd_exec_helper(dev, in, in_size, out, out_size, callback, 
context, false);
+   ctx->dev = dev;
+   /* Starts at 1 to avoid doing wake_up if we are not cleaning up */
+   atomic_set(>num_inflight, 1);
+   init_waitqueue_head(>wait);
+}
+EXPORT_SYMBOL(mlx5_cmd_init_async_ctx);
+
+/**
+ * mlx5_cmd_cleanup_async_ctx - Clean up an async_ctx
+ * @ctx: The ctx to clean
+ *
+ * Upon return all callbacks given to mlx5_cmd_exec_cb() have been called. The
+ * caller must ensure that mlx5_cmd_exec_cb() is not called during 

svn commit: r368225 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:09:04 2020
New Revision: 368225
URL: https://svnweb.freebsd.org/changeset/base/368225

Log:
  MFC r367719:
  Make mlx5_cmd_exec_cb() a safe API in mlx5core.
  
  APIs that have deferred callbacks should have some kind of cleanup
  function that callers can use to fence the callbacks. Otherwise things
  like module unloading can lead to dangling function pointers, or worse.
  
  The IB MR code is the only place that calls this function and had a
  really poor attempt at creating this fence. Provide a good version in
  the core code as future patches will add more places that need this
  fence.
  
  Linux commit:
  e355477ed9e4f401e3931043df97325d38552d54
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/mlx5/driver.h
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_mr.c
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/driver.h
==
--- stable/12/sys/dev/mlx5/driver.h Tue Dec  1 13:06:26 2020
(r368224)
+++ stable/12/sys/dev/mlx5/driver.h Tue Dec  1 13:09:04 2020
(r368225)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -947,11 +948,30 @@ void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
 void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
 void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome);
 int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type);
+
+struct mlx5_async_ctx {
+   struct mlx5_core_dev *dev;
+   atomic_t num_inflight;
+   struct wait_queue_head wait;
+};
+
+struct mlx5_async_work;
+
+typedef void (*mlx5_async_cbk_t)(int status, struct mlx5_async_work *context);
+
+struct mlx5_async_work {
+   struct mlx5_async_ctx *ctx;
+   mlx5_async_cbk_t user_callback;
+};
+
+void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+struct mlx5_async_ctx *ctx);
+void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx);
+int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
+void *out, int out_size, mlx5_async_cbk_t callback,
+struct mlx5_async_work *work);
 int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
  int out_size);
-int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-void *out, int out_size, mlx5_cmd_cbk_t callback,
-void *context);
 int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,
  void *out, int out_size);
 int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
@@ -986,9 +1006,10 @@ void mlx5_init_mr_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
 struct mlx5_core_mr *mkey,
-u32 *in, int inlen,
-u32 *out, int outlen,
-mlx5_cmd_cbk_t callback, void *context);
+struct mlx5_async_ctx *async_ctx, u32 *in,
+int inlen, u32 *out, int outlen,
+mlx5_async_cbk_t callback,
+struct mlx5_async_work *context);
 int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
  struct mlx5_core_mr *mr,
  u32 *in, int inlen);

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec  1 13:06:26 2020
(r368224)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Tue Dec  1 13:09:04 2020
(r368225)
@@ -1345,11 +1345,57 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in,
 }
 EXPORT_SYMBOL(mlx5_cmd_exec);
 
-int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-void *out, int out_size, mlx5_cmd_cbk_t callback,
-void *context)
+void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+struct mlx5_async_ctx *ctx)
 {
-   return cmd_exec_helper(dev, in, in_size, out, out_size, callback, 
context, false);
+   ctx->dev = dev;
+   /* Starts at 1 to avoid doing wake_up if we are not cleaning up */
+   atomic_set(>num_inflight, 1);
+   init_waitqueue_head(>wait);
+}
+EXPORT_SYMBOL(mlx5_cmd_init_async_ctx);
+
+/**
+ * mlx5_cmd_cleanup_async_ctx - Clean up an async_ctx
+ * @ctx: The ctx to clean
+ *
+ * Upon return all callbacks given to mlx5_cmd_exec_cb() have been called. The
+ * caller must ensure that mlx5_cmd_exec_cb() is not called during 

svn commit: r368224 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:06:26 2020
New Revision: 368224
URL: https://svnweb.freebsd.org/changeset/base/368224

Log:
  MFC r367718:
  Report EQE data upon CQ completion in mlx5core.
  
  Report EQE data upon CQ completion to let upper layers use this data.
  
  Linux commit:
  4e0e2ea1886afe8c001971ff767f6670312a9b04
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/mlx5/cq.h
  stable/12/sys/dev/mlx5/driver.h
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  stable/12/sys/dev/mlx5/mlx5_en/en.h
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/cq.h
==
--- stable/12/sys/dev/mlx5/cq.h Tue Dec  1 13:03:09 2020(r368223)
+++ stable/12/sys/dev/mlx5/cq.h Tue Dec  1 13:06:26 2020(r368224)
@@ -32,7 +32,7 @@
 #include 
 #include 
 
-
+struct mlx5_eqe;
 struct mlx5_core_cq {
u32 cqn;
int cqe_sz;
@@ -40,7 +40,7 @@ struct mlx5_core_cq {
__be32 *arm_db;
unsignedvector;
int irqn;
-   void (*comp)(struct mlx5_core_cq *);
+   void (*comp)(struct mlx5_core_cq *, struct mlx5_eqe *);
void (*event)   (struct mlx5_core_cq *, int);
struct mlx5_uar*uar;
u32 cons_index;

Modified: stable/12/sys/dev/mlx5/driver.h
==
--- stable/12/sys/dev/mlx5/driver.h Tue Dec  1 13:03:09 2020
(r368223)
+++ stable/12/sys/dev/mlx5/driver.h Tue Dec  1 13:06:26 2020
(r368224)
@@ -1021,7 +1021,7 @@ void mlx5_unregister_debugfs(void);
 int mlx5_eq_init(struct mlx5_core_dev *dev);
 void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
 void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
-void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
+void mlx5_cq_completion(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
 void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
 struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 13:03:09 2020
(r368223)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 13:06:26 2020
(r368224)
@@ -56,13 +56,16 @@ mlx5_cq_table_write_unlock(struct mlx5_cq_table *table
NET_EPOCH_WAIT();
 }
 
-void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn)
+void mlx5_cq_completion(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe)
 {
struct mlx5_cq_table *table = >priv.cq_table;
struct mlx5_core_cq *cq;
struct epoch_tracker et;
+   u32 cqn;
bool do_lock;
 
+   cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xff;
+
NET_EPOCH_ENTER_ET(et);
 
do_lock = atomic_read(>writercount) != 0;
@@ -79,7 +82,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32
 
if (likely(cq != NULL)) {
++cq->arm_sn;
-   cq->comp(cq);
+   cq->comp(cq, eqe);
} else {
mlx5_core_warn(dev,
"Completion event for bogus CQ 0x%x\n", cqn);

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c  Tue Dec  1 13:03:09 2020
(r368223)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c  Tue Dec  1 13:06:26 2020
(r368224)
@@ -246,8 +246,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru
  eq->eqn, eqe_type_str(eqe->type));
switch (eqe->type) {
case MLX5_EVENT_TYPE_COMP:
-   cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xff;
-   mlx5_cq_completion(dev, cqn);
+   mlx5_cq_completion(dev, eqe);
break;
 
case MLX5_EVENT_TYPE_PATH_MIG:

Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/12/sys/dev/mlx5/mlx5_en/en.h Tue Dec  1 13:03:09 2020
(r368223)
+++ stable/12/sys/dev/mlx5/mlx5_en/en.h Tue Dec  1 13:06:26 2020
(r368224)
@@ -147,7 +147,7 @@ MALLOC_DECLARE(M_MLX5EN);
 struct 

svn commit: r368223 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 13:03:09 2020
New Revision: 368223
URL: https://svnweb.freebsd.org/changeset/base/368223

Log:
  MFC r357294:
  Widen EPOCH(9) usage in mlx5en(4).
  
  Make completion event path mostly lockless using EPOCH(9).
  
  Implement a mechanism using EPOCH(9) which allows us to make
  the callback path for completion events mostly lockless.
  
  Simplify draining callback events using epoch_wait().
  
  While at it make sure all receive completion callbacks are
  covered by the network EPOCH(9), because this is required
  when calling if_input() and ether_input() after r357012.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/cq.h
  stable/12/sys/dev/mlx5/driver.h
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/cq.h
==
--- stable/12/sys/dev/mlx5/cq.h Tue Dec  1 12:52:15 2020(r368222)
+++ stable/12/sys/dev/mlx5/cq.h Tue Dec  1 13:03:09 2020(r368223)
@@ -38,8 +38,6 @@ struct mlx5_core_cq {
int cqe_sz;
__be32 *set_ci_db;
__be32 *arm_db;
-   atomic_trefcount;
-   struct completion   free;
unsignedvector;
int irqn;
void (*comp)(struct mlx5_core_cq *);

Modified: stable/12/sys/dev/mlx5/driver.h
==
--- stable/12/sys/dev/mlx5/driver.h Tue Dec  1 12:52:15 2020
(r368222)
+++ stable/12/sys/dev/mlx5/driver.h Tue Dec  1 13:03:09 2020
(r368223)
@@ -515,21 +515,17 @@ struct mlx5_core_health {
struct workqueue_struct*wq_cmd;
 };
 
-#ifdef RATELIMIT
-#defineMLX5_CQ_LINEAR_ARRAY_SIZE   (128 * 1024)
-#else
 #defineMLX5_CQ_LINEAR_ARRAY_SIZE   1024
-#endif
 
 struct mlx5_cq_linear_array_entry {
-   spinlock_t  lock;
struct mlx5_core_cq * volatile cq;
 };
 
 struct mlx5_cq_table {
/* protect radix tree
 */
-   spinlock_t  lock;
+   spinlock_t  writerlock;
+   atomic_twritercount;
struct radix_tree_root  tree;
struct mlx5_cq_linear_array_entry 
linear_array[MLX5_CQ_LINEAR_ARRAY_SIZE];
 };

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 12:52:15 2020
(r368222)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 13:03:09 2020
(r368223)
@@ -33,72 +33,92 @@
 #include 
 #include "mlx5_core.h"
 
+#include 
+#include 
+
+static void
+mlx5_cq_table_write_lock(struct mlx5_cq_table *table)
+{
+
+   atomic_inc(>writercount);
+   /* make sure all see the updated writercount */
+   NET_EPOCH_WAIT();
+   spin_lock(>writerlock);
+}
+
+static void
+mlx5_cq_table_write_unlock(struct mlx5_cq_table *table)
+{
+
+   spin_unlock(>writerlock);
+   atomic_dec(>writercount);
+   /* drain all pending CQ callers */
+   NET_EPOCH_WAIT();
+}
+
 void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn)
 {
-   struct mlx5_core_cq *cq;
struct mlx5_cq_table *table = >priv.cq_table;
+   struct mlx5_core_cq *cq;
+   struct epoch_tracker et;
+   bool do_lock;
 
-   if (cqn < MLX5_CQ_LINEAR_ARRAY_SIZE) {
-   struct mlx5_cq_linear_array_entry *entry;
+   NET_EPOCH_ENTER_ET(et);
 
-   entry = >linear_array[cqn];
-   spin_lock(>lock);
-   cq = entry->cq;
-   if (cq == NULL) {
-   mlx5_core_warn(dev,
-   "Completion event for bogus CQ 0x%x\n", cqn);
-   } else {
-   ++cq->arm_sn;
-   cq->comp(cq);
-   }
-   spin_unlock(>lock);
-   return;
-   }
+   do_lock = atomic_read(>writercount) != 0;
+   if (unlikely(do_lock))
+   spin_lock(>writerlock);
 
-   spin_lock(>lock);
-   cq = radix_tree_lookup(>tree, cqn);
-   if (likely(cq))
-   atomic_inc(>refcount);
-   spin_unlock(>lock);
+   if (likely(cqn < MLX5_CQ_LINEAR_ARRAY_SIZE))
+   cq = table->linear_array[cqn].cq;
+   else
+   cq = radix_tree_lookup(>tree, cqn);
 
-   if (!cq) {
-   mlx5_core_warn(dev, "Completion event for bogus CQ 0x%x\n", 
cqn);
-   return;
+   if (unlikely(do_lock))
+   spin_unlock(>writerlock);
+
+   if (likely(cq != NULL)) {
+   ++cq->arm_sn;
+   cq->comp(cq);
+   } else {
+   mlx5_core_warn(dev,
+   "Completion 

svn commit: r368222 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:52:15 2020
New Revision: 368222
URL: https://svnweb.freebsd.org/changeset/base/368222

Log:
  MFC r367717:
  Enhance the mlx5_core_create_cq() function in mlx5core.
  
  Enhance mlx5_core_create_cq() to get the command out buffer from the
  callers to let them use the output.
  
  Linux commit:
  38164b771947be9baf06e78ffdfb650f8f3e908e
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/mlx5/cq.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/cq.h
==
--- stable/11/sys/dev/mlx5/cq.h Tue Dec  1 12:51:35 2020(r368221)
+++ stable/11/sys/dev/mlx5/cq.h Tue Dec  1 12:52:15 2020(r368222)
@@ -157,7 +157,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq
 int mlx5_init_cq_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-   u32 *in, int inlen);
+   u32 *in, int inlen, u32 *out, int outlen);
 int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
 int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
   u32 *out, int outlen);

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 12:51:35 2020
(r368221)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 12:52:15 2020
(r368222)
@@ -100,16 +100,16 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn,
 
 
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-   u32 *in, int inlen)
+   u32 *in, int inlen, u32 *out, int outlen)
 {
struct mlx5_cq_table *table = >priv.cq_table;
-   u32 out[MLX5_ST_SZ_DW(create_cq_out)] = {0};
u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {0};
u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)] = {0};
int err;
 
+   memset(out, 0, outlen);
MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ);
-   err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
+   err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
if (err)
return err;
 

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Tue Dec  1 12:51:35 
2020(r368221)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Tue Dec  1 12:52:15 
2020(r368222)
@@ -1863,6 +1863,7 @@ static int
 mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix)
 {
struct mlx5_core_cq *mcq = >mcq;
+   u32 out[MLX5_ST_SZ_DW(create_cq_out)];
void *in;
void *cqc;
int inlen;
@@ -1891,7 +1892,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_p
PAGE_SHIFT);
MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma);
 
-   err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen);
+   err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen, out, 
sizeof(out));
 
kvfree(in);
 

Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
==
--- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec  1 12:51:35 2020
(r368221)
+++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec  1 12:52:15 2020
(r368222)
@@ -905,6 +905,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
int entries = attr->cqe;
int vector = attr->comp_vector;
struct mlx5_ib_dev *dev = to_mdev(ibdev);
+   u32 out[MLX5_ST_SZ_DW(create_cq_out)];
struct mlx5_ib_cq *cq;
int uninitialized_var(index);
int uninitialized_var(inlen);
@@ -969,7 +970,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
if (cq->create_flags & IB_CQ_FLAGS_IGNORE_OVERRUN)
MLX5_SET(cqc, cqc, oi, 1);
 
-   err = mlx5_core_create_cq(dev->mdev, >mcq, cqb, inlen);
+   err = mlx5_core_create_cq(dev->mdev, >mcq, cqb, inlen, out, 
sizeof(out));
if (err)
goto err_cqb;
 
___
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: r368221 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:51:35 2020
New Revision: 368221
URL: https://svnweb.freebsd.org/changeset/base/368221

Log:
  MFC r367717:
  Enhance the mlx5_core_create_cq() function in mlx5core.
  
  Enhance mlx5_core_create_cq() to get the command out buffer from the
  callers to let them use the output.
  
  Linux commit:
  38164b771947be9baf06e78ffdfb650f8f3e908e
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/mlx5/cq.h
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/cq.h
==
--- stable/12/sys/dev/mlx5/cq.h Tue Dec  1 12:45:47 2020(r368220)
+++ stable/12/sys/dev/mlx5/cq.h Tue Dec  1 12:51:35 2020(r368221)
@@ -157,7 +157,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq
 int mlx5_init_cq_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-   u32 *in, int inlen);
+   u32 *in, int inlen, u32 *out, int outlen);
 int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
 int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
   u32 *out, int outlen);

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 12:45:47 2020
(r368220)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cq.c  Tue Dec  1 12:51:35 2020
(r368221)
@@ -100,16 +100,16 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn,
 
 
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-   u32 *in, int inlen)
+   u32 *in, int inlen, u32 *out, int outlen)
 {
struct mlx5_cq_table *table = >priv.cq_table;
-   u32 out[MLX5_ST_SZ_DW(create_cq_out)] = {0};
u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {0};
u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)] = {0};
int err;
 
+   memset(out, 0, outlen);
MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ);
-   err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
+   err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
if (err)
return err;
 

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Tue Dec  1 12:45:47 
2020(r368220)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Tue Dec  1 12:51:35 
2020(r368221)
@@ -1978,6 +1978,7 @@ static int
 mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix)
 {
struct mlx5_core_cq *mcq = >mcq;
+   u32 out[MLX5_ST_SZ_DW(create_cq_out)];
void *in;
void *cqc;
int inlen;
@@ -2006,7 +2007,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_p
PAGE_SHIFT);
MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma);
 
-   err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen);
+   err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen, out, 
sizeof(out));
 
kvfree(in);
 

Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
==
--- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec  1 12:45:47 2020
(r368220)
+++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Tue Dec  1 12:51:35 2020
(r368221)
@@ -905,6 +905,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
int entries = attr->cqe;
int vector = attr->comp_vector;
struct mlx5_ib_dev *dev = to_mdev(ibdev);
+   u32 out[MLX5_ST_SZ_DW(create_cq_out)];
struct mlx5_ib_cq *cq;
int uninitialized_var(index);
int uninitialized_var(inlen);
@@ -969,7 +970,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
if (cq->create_flags & IB_CQ_FLAGS_IGNORE_OVERRUN)
MLX5_SET(cqc, cqc, oi, 1);
 
-   err = mlx5_core_create_cq(dev->mdev, >mcq, cqb, inlen);
+   err = mlx5_core_create_cq(dev->mdev, >mcq, cqb, inlen, out, 
sizeof(out));
if (err)
goto err_cqb;
 
___
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: r368220 - in stable/11/sys/dev/mlx5: . mlx5_core

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:45:47 2020
New Revision: 368220
URL: https://svnweb.freebsd.org/changeset/base/368220

Log:
  MFC r367716:
  Use mlx5core to create/destroy all Dynamically Connected Targets, DCTs.
  
  To prevent a hardware memory leak when a DEVX DCT object is destroyed
  without calling drain DCT before, (e.g. under cleanup flow), need to
  manage its creation and destruction via mlx5 core.
  
  Linux commit:
  c5ae1954c47d3fd8815bd5a592aba18702c93f33
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c
  stable/11/sys/dev/mlx5/qp.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c
==
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c  Tue Dec  1 12:45:07 2020
(r368219)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_qp.c  Tue Dec  1 12:45:47 2020
(r368220)
@@ -349,19 +349,18 @@ EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc);
 
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 struct mlx5_core_dct *dct,
-u32 *in)
+u32 *in, int inlen,
+u32 *out, int outlen)
 {
struct mlx5_qp_table *table = >priv.qp_table;
-   u32 out[MLX5_ST_SZ_DW(create_dct_out)]   = {0};
u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
u32 din[MLX5_ST_SZ_DW(destroy_dct_in)]   = {0};
-   int inlen = MLX5_ST_SZ_BYTES(create_dct_in);
int err;
 
init_completion(>drained);
MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT);
 
-   err = mlx5_cmd_exec(dev, in, inlen, , sizeof(out));
+   err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
if (err) {
mlx5_core_warn(dev, "create DCT failed, ret %d", err);
return err;
@@ -387,7 +386,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 err_cmd:
MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
MLX5_SET(destroy_dct_in, din, dctn, dct->dctn);
-   mlx5_cmd_exec(dev, , sizeof(din), , sizeof(dout));
+   mlx5_cmd_exec(dev, , sizeof(din), dout, sizeof(dout));
 
return err;
 }

Modified: stable/11/sys/dev/mlx5/qp.h
==
--- stable/11/sys/dev/mlx5/qp.h Tue Dec  1 12:45:07 2020(r368219)
+++ stable/11/sys/dev/mlx5/qp.h Tue Dec  1 12:45:47 2020(r368220)
@@ -586,7 +586,8 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u3
 int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 struct mlx5_core_dct *dct,
-u32 *in);
+u32 *in, int inlen,
+u32 *out, int outlen);
 int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
  struct mlx5_core_dct *dct);
 int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
___
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: r368219 - in stable/12/sys/dev/mlx5: . mlx5_core

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:45:07 2020
New Revision: 368219
URL: https://svnweb.freebsd.org/changeset/base/368219

Log:
  MFC r367716:
  Use mlx5core to create/destroy all Dynamically Connected Targets, DCTs.
  
  To prevent a hardware memory leak when a DEVX DCT object is destroyed
  without calling drain DCT before, (e.g. under cleanup flow), need to
  manage its creation and destruction via mlx5 core.
  
  Linux commit:
  c5ae1954c47d3fd8815bd5a592aba18702c93f33
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c
  stable/12/sys/dev/mlx5/qp.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c
==
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c  Tue Dec  1 12:43:56 2020
(r368218)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_qp.c  Tue Dec  1 12:45:07 2020
(r368219)
@@ -349,19 +349,18 @@ EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc);
 
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 struct mlx5_core_dct *dct,
-u32 *in)
+u32 *in, int inlen,
+u32 *out, int outlen)
 {
struct mlx5_qp_table *table = >priv.qp_table;
-   u32 out[MLX5_ST_SZ_DW(create_dct_out)]   = {0};
u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
u32 din[MLX5_ST_SZ_DW(destroy_dct_in)]   = {0};
-   int inlen = MLX5_ST_SZ_BYTES(create_dct_in);
int err;
 
init_completion(>drained);
MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT);
 
-   err = mlx5_cmd_exec(dev, in, inlen, , sizeof(out));
+   err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
if (err) {
mlx5_core_warn(dev, "create DCT failed, ret %d", err);
return err;
@@ -387,7 +386,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 err_cmd:
MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
MLX5_SET(destroy_dct_in, din, dctn, dct->dctn);
-   mlx5_cmd_exec(dev, , sizeof(din), , sizeof(dout));
+   mlx5_cmd_exec(dev, , sizeof(din), dout, sizeof(dout));
 
return err;
 }

Modified: stable/12/sys/dev/mlx5/qp.h
==
--- stable/12/sys/dev/mlx5/qp.h Tue Dec  1 12:43:56 2020(r368218)
+++ stable/12/sys/dev/mlx5/qp.h Tue Dec  1 12:45:07 2020(r368219)
@@ -586,7 +586,8 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u3
 int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 struct mlx5_core_dct *dct,
-u32 *in);
+u32 *in, int inlen,
+u32 *out, int outlen);
 int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
  struct mlx5_core_dct *dct);
 int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
___
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: r368218 - stable/11/sys/dev/mlx5/mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:43:56 2020
New Revision: 368218
URL: https://svnweb.freebsd.org/changeset/base/368218

Log:
  MFC r367715:
  Fix error handling order in create_kernel_qp in mlx5ib.
  
  Make sure order of cleanup is exactly the opposite of initialization.
  
  Linux commit:
  f4044dac63e952ac1137b6df02b233d37696e2f5
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c
==
--- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec  1 12:43:22 2020
(r368217)
+++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec  1 12:43:56 2020
(r368218)
@@ -987,12 +987,12 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev,
return 0;
 
 err_wrid:
-   mlx5_db_free(dev->mdev, >db);
kfree(qp->sq.wqe_head);
kfree(qp->sq.w_list);
kfree(qp->sq.wrid);
kfree(qp->sq.wr_data);
kfree(qp->rq.wrid);
+   mlx5_db_free(dev->mdev, >db);
 
 err_free:
kvfree(*in);
@@ -1007,12 +1007,12 @@ err_uuar:
 
 static void destroy_qp_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp)
 {
-   mlx5_db_free(dev->mdev, >db);
kfree(qp->sq.wqe_head);
kfree(qp->sq.w_list);
kfree(qp->sq.wrid);
kfree(qp->sq.wr_data);
kfree(qp->rq.wrid);
+   mlx5_db_free(dev->mdev, >db);
mlx5_buf_free(dev->mdev, >buf);
free_uuar(>mdev->priv.uuari, qp->bf->uuarn);
 }
___
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: r368217 - stable/12/sys/dev/mlx5/mlx5_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:43:22 2020
New Revision: 368217
URL: https://svnweb.freebsd.org/changeset/base/368217

Log:
  MFC r367715:
  Fix error handling order in create_kernel_qp in mlx5ib.
  
  Make sure order of cleanup is exactly the opposite of initialization.
  
  Linux commit:
  f4044dac63e952ac1137b6df02b233d37696e2f5
  
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c
==
--- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec  1 12:42:23 2020
(r368216)
+++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Dec  1 12:43:22 2020
(r368217)
@@ -987,12 +987,12 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev,
return 0;
 
 err_wrid:
-   mlx5_db_free(dev->mdev, >db);
kfree(qp->sq.wqe_head);
kfree(qp->sq.w_list);
kfree(qp->sq.wrid);
kfree(qp->sq.wr_data);
kfree(qp->rq.wrid);
+   mlx5_db_free(dev->mdev, >db);
 
 err_free:
kvfree(*in);
@@ -1007,12 +1007,12 @@ err_uuar:
 
 static void destroy_qp_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp)
 {
-   mlx5_db_free(dev->mdev, >db);
kfree(qp->sq.wqe_head);
kfree(qp->sq.w_list);
kfree(qp->sq.wrid);
kfree(qp->sq.wr_data);
kfree(qp->rq.wrid);
+   mlx5_db_free(dev->mdev, >db);
mlx5_buf_free(dev->mdev, >buf);
free_uuar(>mdev->priv.uuari, qp->bf->uuarn);
 }
___
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: r368216 - stable/11/sys/dev/mlx4/mlx4_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:42:23 2020
New Revision: 368216
URL: https://svnweb.freebsd.org/changeset/base/368216

Log:
  MFC r367555:
  Include GID type when deleting GIDs from HW table under RoCE in mlx4ib.
  Refer to the Linux commit mentioned below for a more detailed description.
  
  Linux commit:
  a18177925c252da7801149abe217c05b80884798
  
  Requested by: Isilon
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c   Tue Dec  1 12:41:25 
2020(r368215)
+++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c   Tue Dec  1 12:42:23 
2020(r368216)
@@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device,
if (!gids) {
ret = -ENOMEM;
} else {
-   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++)
-   memcpy([i].gid, 
_gid_table->gids[i].gid, sizeof(union ib_gid));
+   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) {
+   memcpy([i].gid,
+  _gid_table->gids[i].gid,
+  sizeof(union ib_gid));
+   gids[i].gid_type =
+   port_gid_table->gids[i].gid_type;
+   }
}
}
spin_unlock_bh(>lock);
___
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: r368215 - stable/12/sys/dev/mlx4/mlx4_ib

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:41:25 2020
New Revision: 368215
URL: https://svnweb.freebsd.org/changeset/base/368215

Log:
  MFC r367555:
  Include GID type when deleting GIDs from HW table under RoCE in mlx4ib.
  Refer to the Linux commit mentioned below for a more detailed description.
  
  Linux commit:
  a18177925c252da7801149abe217c05b80884798
  
  Requested by: Isilon
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c   Tue Dec  1 12:39:16 
2020(r368214)
+++ stable/12/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c   Tue Dec  1 12:41:25 
2020(r368215)
@@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device,
if (!gids) {
ret = -ENOMEM;
} else {
-   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++)
-   memcpy([i].gid, 
_gid_table->gids[i].gid, sizeof(union ib_gid));
+   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) {
+   memcpy([i].gid,
+  _gid_table->gids[i].gid,
+  sizeof(union ib_gid));
+   gids[i].gid_type =
+   port_gid_table->gids[i].gid_type;
+   }
}
}
spin_unlock_bh(>lock);
___
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: r368214 - in stable/11/sys/dev/usb: . quirk

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:39:16 2020
New Revision: 368214
URL: https://svnweb.freebsd.org/changeset/base/368214

Log:
  MFC r367622:
  Add more USB quirks.
  
  PR:   230038
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/usb/quirk/usb_quirk.c
  stable/11/sys/dev/usb/usbdevs
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Dec  1 12:38:28 2020
(r368213)
+++ stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Dec  1 12:39:16 2020
(r368214)
@@ -207,7 +207,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(FREECOM, DVD, 0x, 0x, UQ_MSC_FORCE_PROTO_SCSI),
USB_QUIRK(FUJIPHOTO, MASS0100, 0x, 0x, UQ_MSC_FORCE_WIRE_CBI_I,
UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, 
UQ_MSC_NO_SYNC_CACHE),
+   USB_QUIRK(GARMIN, DAKOTA20, 0x, 0x, UQ_MSC_NO_INQUIRY),
USB_QUIRK(GARMIN, FORERUNNER230, 0x, 0x, UQ_MSC_NO_INQUIRY),
+   USB_QUIRK(GARMIN, GPSMAP62S, 0x, 0x, UQ_MSC_NO_INQUIRY),
USB_QUIRK(GENESYS, GL641USB2IDE, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE),

Modified: stable/11/sys/dev/usb/usbdevs
==
--- stable/11/sys/dev/usb/usbdevs   Tue Dec  1 12:38:28 2020
(r368213)
+++ stable/11/sys/dev/usb/usbdevs   Tue Dec  1 12:39:16 2020
(r368214)
@@ -2180,7 +2180,9 @@ product FUJITSU AH_F401U  0x105b  AH-F401U Air H device
 product FUJITSUSIEMENS SCR 0x0009  Fujitsu-Siemens SCR USB Reader
 
 /* Garmin products */
+product GARMIN DAKOTA200x23c0  Dakota 20
 product GARMIN FORERUNNER230   0x086d  ForeRunner 230
+product GARMIN GPSMAP62S   0x2459  GPSMAP 62s
 product GARMIN IQUE_3600   0x0004  iQue 3600
 
 /* Gemalto products */
___
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: r368213 - in stable/12/sys/dev/usb: . quirk

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:38:28 2020
New Revision: 368213
URL: https://svnweb.freebsd.org/changeset/base/368213

Log:
  MFC r367622:
  Add more USB quirks.
  
  PR:   230038
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/usb/quirk/usb_quirk.c
  stable/12/sys/dev/usb/usbdevs
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Dec  1 12:37:11 2020
(r368212)
+++ stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Dec  1 12:38:28 2020
(r368213)
@@ -237,7 +237,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(FREECOM, DVD, 0x, 0x, UQ_MSC_FORCE_PROTO_SCSI),
USB_QUIRK(FUJIPHOTO, MASS0100, 0x, 0x, UQ_MSC_FORCE_WIRE_CBI_I,
UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, 
UQ_MSC_NO_SYNC_CACHE),
+   USB_QUIRK(GARMIN, DAKOTA20, 0x, 0x, UQ_MSC_NO_INQUIRY),
USB_QUIRK(GARMIN, FORERUNNER230, 0x, 0x, UQ_MSC_NO_INQUIRY),
+   USB_QUIRK(GARMIN, GPSMAP62S, 0x, 0x, UQ_MSC_NO_INQUIRY),
USB_QUIRK(GENESYS, GL641USB2IDE, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE),

Modified: stable/12/sys/dev/usb/usbdevs
==
--- stable/12/sys/dev/usb/usbdevs   Tue Dec  1 12:37:11 2020
(r368212)
+++ stable/12/sys/dev/usb/usbdevs   Tue Dec  1 12:38:28 2020
(r368213)
@@ -2254,7 +2254,9 @@ product FUJITSU AH_F401U  0x105b  AH-F401U Air H device
 product FUJITSUSIEMENS SCR 0x0009  Fujitsu-Siemens SCR USB Reader
 
 /* Garmin products */
+product GARMIN DAKOTA200x23c0  Dakota 20
 product GARMIN FORERUNNER230   0x086d  ForeRunner 230
+product GARMIN GPSMAP62S   0x2459  GPSMAP 62s
 product GARMIN IQUE_3600   0x0004  iQue 3600
 
 /* Gemalto products */
___
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: r368212 - stable/11/sys/dev/sound/usb

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:37:11 2020
New Revision: 368212
URL: https://svnweb.freebsd.org/changeset/base/368212

Log:
  MFC r367615:
  Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the
  the HID volume keys support in the USB audio driver.
  
  While at it re-organize the USB audio sysctls a bit.
  
  Differential Revision:https://reviews.freebsd.org/D27180
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/sound/usb/uaudio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/sound/usb/uaudio.c
==
--- stable/11/sys/dev/sound/usb/uaudio.cTue Dec  1 12:36:21 2020
(r368211)
+++ stable/11/sys/dev/sound/usb/uaudio.cTue Dec  1 12:37:11 2020
(r368212)
@@ -96,14 +96,11 @@ static int uaudio_default_rate = 0; /* use rate 
list 
 static int uaudio_default_bits = 32;
 static int uaudio_default_channels = 0;/* use default */
 static int uaudio_buffer_ms = 8;
+static bool uaudio_handle_hid = true;
 
-#ifdef USB_DEBUG
-static int uaudio_debug;
-
 static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio");
-
-SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
-_debug, 0, "uaudio debug level");
+SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN,
+_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN,
 _default_rate, 0, "uaudio default sample rate");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN,
@@ -134,6 +131,12 @@ uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS)
 SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN,
 0, sizeof(int), uaudio_buffer_ms_sysctl, "I",
 "uaudio buffering delay from 2ms to 8ms");
+
+#ifdef USB_DEBUG
+static int uaudio_debug;
+
+SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
+_debug, 0, "uaudio debug level");
 #else
 #defineuaudio_debug 0
 #endif
@@ -1118,10 +1121,12 @@ uaudio_attach(device_t dev)
goto detach;
}
 
-   if (uaudio_hid_probe(sc, uaa) == 0) {
-   device_printf(dev, "HID volume keys found.\n");
-   } else {
-   device_printf(dev, "No HID volume keys found.\n");
+   if (uaudio_handle_hid) {
+   if (uaudio_hid_probe(sc, uaa) == 0) {
+   device_printf(dev, "HID volume keys found.\n");
+   } else {
+   device_printf(dev, "No HID volume keys found.\n");
+   }
}
 
/* reload all mixer settings */
___
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: r368211 - stable/12/sys/dev/sound/usb

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:36:21 2020
New Revision: 368211
URL: https://svnweb.freebsd.org/changeset/base/368211

Log:
  MFC r367615:
  Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the
  the HID volume keys support in the USB audio driver.
  
  While at it re-organize the USB audio sysctls a bit.
  
  Differential Revision:https://reviews.freebsd.org/D27180
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/sound/usb/uaudio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/usb/uaudio.c
==
--- stable/12/sys/dev/sound/usb/uaudio.cTue Dec  1 12:33:39 2020
(r368210)
+++ stable/12/sys/dev/sound/usb/uaudio.cTue Dec  1 12:36:21 2020
(r368211)
@@ -98,14 +98,11 @@ static int uaudio_default_rate = 0; /* use rate 
list 
 static int uaudio_default_bits = 32;
 static int uaudio_default_channels = 0;/* use default */
 static int uaudio_buffer_ms = 8;
+static bool uaudio_handle_hid = true;
 
-#ifdef USB_DEBUG
-static int uaudio_debug;
-
 static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio");
-
-SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
-_debug, 0, "uaudio debug level");
+SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN,
+_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN,
 _default_rate, 0, "uaudio default sample rate");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN,
@@ -136,6 +133,12 @@ uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS)
 SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN,
 0, sizeof(int), uaudio_buffer_ms_sysctl, "I",
 "uaudio buffering delay from 2ms to 8ms");
+
+#ifdef USB_DEBUG
+static int uaudio_debug;
+
+SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
+_debug, 0, "uaudio debug level");
 #else
 #defineuaudio_debug 0
 #endif
@@ -1120,10 +1123,12 @@ uaudio_attach(device_t dev)
goto detach;
}
 
-   if (uaudio_hid_probe(sc, uaa) == 0) {
-   device_printf(dev, "HID volume keys found.\n");
-   } else {
-   device_printf(dev, "No HID volume keys found.\n");
+   if (uaudio_handle_hid) {
+   if (uaudio_hid_probe(sc, uaa) == 0) {
+   device_printf(dev, "HID volume keys found.\n");
+   } else {
+   device_printf(dev, "No HID volume keys found.\n");
+   }
}
 
/* reload all mixer settings */
___
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: r368210 - stable/11/sys/dev/usb/controller

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:33:39 2020
New Revision: 368210
URL: https://svnweb.freebsd.org/changeset/base/368210

Log:
  MFC r367614:
  When doing a USB alternate setting on an USB interface we need to
  re-configure the XHCI endpoint context.
  
  Differential Revision:https://reviews.freebsd.org/D27174
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/usb/controller/xhci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/controller/xhci.c
==
--- stable/11/sys/dev/usb/controller/xhci.c Tue Dec  1 12:32:35 2020
(r368209)
+++ stable/11/sys/dev/usb/controller/xhci.c Tue Dec  1 12:33:39 2020
(r368210)
@@ -4049,6 +4049,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
 struct usb_endpoint *ep)
 {
struct xhci_endpoint_ext *pepext;
+   struct xhci_softc *sc;
+   uint8_t index;
+   uint8_t epno;
 
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n",
ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode);
@@ -4065,6 +4068,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
USB_BUS_LOCK(udev->bus);
pepext->trb_halted = 1;
pepext->trb_running = 0;
+
+   /*
+* When doing an alternate setting, except for control
+* endpoints, we need to re-configure the XHCI endpoint
+* context:
+*/
+   if ((edesc->bEndpointAddress & UE_ADDR) != 0) {
+   sc = XHCI_BUS2SC(udev->bus);
+   index = udev->controller_slot_id;
+   epno = XHCI_EPNO2EPID(edesc->bEndpointAddress);
+   sc->sc_hw.devs[index].ep_configured &= ~(1U << epno);
+   }
USB_BUS_UNLOCK(udev->bus);
 }
 
___
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: r368209 - stable/12/sys/dev/usb/controller

2020-12-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Dec  1 12:32:35 2020
New Revision: 368209
URL: https://svnweb.freebsd.org/changeset/base/368209

Log:
  MFC r367614:
  When doing a USB alternate setting on an USB interface we need to
  re-configure the XHCI endpoint context.
  
  Differential Revision:https://reviews.freebsd.org/D27174
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/usb/controller/xhci.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/controller/xhci.c
==
--- stable/12/sys/dev/usb/controller/xhci.c Tue Dec  1 10:39:42 2020
(r368208)
+++ stable/12/sys/dev/usb/controller/xhci.c Tue Dec  1 12:32:35 2020
(r368209)
@@ -4049,6 +4049,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
 struct usb_endpoint *ep)
 {
struct xhci_endpoint_ext *pepext;
+   struct xhci_softc *sc;
+   uint8_t index;
+   uint8_t epno;
 
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n",
ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode);
@@ -4065,6 +4068,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
USB_BUS_LOCK(udev->bus);
pepext->trb_halted = 1;
pepext->trb_running = 0;
+
+   /*
+* When doing an alternate setting, except for control
+* endpoints, we need to re-configure the XHCI endpoint
+* context:
+*/
+   if ((edesc->bEndpointAddress & UE_ADDR) != 0) {
+   sc = XHCI_BUS2SC(udev->bus);
+   index = udev->controller_slot_id;
+   epno = XHCI_EPNO2EPID(edesc->bEndpointAddress);
+   sc->sc_hw.devs[index].ep_configured &= ~(1U << epno);
+   }
USB_BUS_UNLOCK(udev->bus);
 }
 
___
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"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Hans Petter Selasky

On 12/1/20 12:26 PM, Mateusz Guzik wrote:

Does this fix it for you?https://people.freebsd.org/~mjg/poll.diff


Will take some time to reproduce. Testing right now.

--HPS
___
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"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Hans Petter Selasky

On 12/1/20 12:06 PM, Mateusz Guzik wrote:

I see what the bug is, will think about the right fix.

Is this reproducible for you?


Yes, I have a crash dump.

--HPS

___
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"


Re: svn commit: r367714 - head/sys/kern

2020-12-01 Thread Hans Petter Selasky

On 11/16/20 4:12 AM, Mateusz Guzik wrote:

Author: mjg
Date: Mon Nov 16 03:12:21 2020
New Revision: 367714
URL: https://svnweb.freebsd.org/changeset/base/367714

Log:
   select: call seltdfini on process and thread exit
   
   Since thread_zone is marked NOFREE the thread_fini callback is never

   executed, meaning memory allocated by seltdinit is never released.
   
   Adding the call to thread_dtor is not sufficient as exiting processes

   cache the main thread.

Modified:
   head/sys/kern/kern_exit.c
   head/sys/kern/kern_thread.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Mon Nov 16 03:09:18 2020(r367713)
+++ head/sys/kern/kern_exit.c   Mon Nov 16 03:12:21 2020(r367714)
@@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo)
PROC_UNLOCK(p);
  
  	umtx_thread_exit(td);

+   seltdfini(td);
  
  	/*

 * Reset any sigio structures pointing to us as a result of

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Mon Nov 16 03:09:18 2020(r367713)
+++ head/sys/kern/kern_thread.c Mon Nov 16 03:12:21 2020(r367714)
@@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int flags)
audit_thread_alloc(td);
  #endif
umtx_thread_alloc(td);
+   MPASS(td->td_sel == NULL);
return (0);
  }
  
@@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg)

osd_thread_exit(td);
td_softdep_cleanup(td);
MPASS(td->td_su == NULL);
+   seltdfini(td);
  }
  
  /*

@@ -405,7 +407,7 @@ thread_fini(void *mem, int size)
turnstile_free(td->td_turnstile);
sleepq_free(td->td_sleepqueue);
umtx_thread_fini(td);
-   seltdfini(td);
+   MPASS(td->td_sel == NULL);
  }
  
  /*


Hi,

The following panic() has been observed after this change:

panic: Assertion mtx_unowned(m) failed at /usr/src/sys/kern/kern_mutex:1181
cpuid = 6

panic()
_mtx_destroy()
seltdfini()
exit1()
postsig()
ast()
doreti_ast()

--HPS

___
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"


Re: svn commit: r366917 - in head: sbin/ifconfig sys/net tests/sys/net

2020-11-30 Thread Hans Petter Selasky

On 10/21/20 11:28 PM, Alexander V. Chernikov wrote:

Author: melifaro
Date: Wed Oct 21 21:28:20 2020
New Revision: 366917
URL: https://svnweb.freebsd.org/changeset/base/366917

Log:
   Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).
   
   802.1ad interfaces are created with ifconfig using the "vlanproto" parameter.

   Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN
   (id #5) over a physical Ethernet interface (em0).
   
   ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up

   ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24
   
   VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly

   supported. VLAN_HWTAGGING is only partially supported, as there is
   currently no IFCAP_VLAN_* denoting the possibility to set the VLAN
   EtherType to anything else than 0x8100 (802.1ad uses 0x88A8).
   
   Submitted by:	Olivier Piras

   Sponsored by:RG Nets
   Differential Revision:   https://reviews.freebsd.org/D26436



Hi Alexander,

Any vlan ending in . is now treated the same regardless of network 
device:


Try this sequence of commands starting in any order
ifconfig vlan create
ifconfig igb0. create
ifconfig igb1. create

You'll quickly see that only the first command you pick succeeds. The 
subsequent ones will fail.  must be the same number, for example 5.


I'm not sure exactly where the problem is yet, but investigation shows 
that ifc_name2unit would return EINVAL on igb0. . Now it returns 0 
(success) and puts  into the *unit argument.



diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index a55ce9c3005..7f96757e12c 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -582,9 +582,8 @@ ifc_name2unit(const char *name, int *unit)
int cutoff = INT_MAX / 10;
int cutlim = INT_MAX % 10;
 
-   if ((cp = strrchr(name, '.')) == NULL)

-   cp = name;
-   for (; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++);
+   for (cp = name; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++)
+   ;
if (*cp == '\0') {
*unit = -1;
} else if (cp[0] == '0' && cp[1] != '\0') {


The chunk above is not a fix. Can you have a look at this. Should be 
easy to reproduce!


Rolling back the kernel only to r366916 gives me:

ifconfig igb1.11 create
ifconfig: SIOCIFCREATE2: Invalid argument

Rolling back ifconfig to r366916 aswell, gives me the expected result again:

/usr/obj/usr/img/freebsd/amd64.amd64/sbin/ifconfig/ifconfig igb1.11 create
/usr/obj/usr/img/freebsd/amd64.amd64/sbin/ifconfig/ifconfig vlan11 create

--HPS
___
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"


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Hans Petter Selasky

On 11/30/20 2:44 PM, Bjoern A. Zeeb wrote:

On 30 Nov 2020, at 9:27, Emmanuel Vadot wrote:


On Mon, 30 Nov 2020 01:13:12 +
"Bjoern A. Zeeb"  wrote:


On 29 Nov 2020, at 19:38, Matt Macy wrote:


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  Reviewed by:    gre...@freebsd.org
  MFC after:    1 month
  Sponsored by:    Rubicon LLC, (Netgate)
  Differential Revision:    https://reviews.freebsd.org/D26137

Added:
  head/sbin/ifconfig/ifwg.c   (contents, props changed)
  head/sys/dev/if_wg/
  head/sys/dev/if_wg/include/
  head/sys/dev/if_wg/include/crypto/blake2s.h   (contents, props
changed)
  head/sys/dev/if_wg/include/crypto/curve25519.h   (contents, props
changed)
  head/sys/dev/if_wg/include/crypto/zinc.h   (contents, props changed)
  head/sys/dev/if_wg/include/sys/
  head/sys/dev/if_wg/include/sys/if_wg_session.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/if_wg_session_vars.h   (contents,
props changed)
  head/sys/dev/if_wg/include/sys/simd-x86_64.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/support.h   (contents, props changed)
  head/sys/dev/if_wg/include/sys/wg_cookie.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/wg_module.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/wg_noise.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/blake2s.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/chacha20.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/chacha20poly1305.h   (contents,
props changed)
  head/sys/dev/if_wg/include/zinc/curve25519.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/poly1305.h   (contents, props
changed)
  head/sys/dev/if_wg/module/
  head/sys/dev/if_wg/module/blake2s.c   (contents, props changed)
  head/sys/dev/if_wg/module/blake2s.h   (contents, props changed)
  head/sys/dev/if_wg/module/chacha20-x86_64.S   (contents, props
changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S
(contents, props changed)
  
head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S

  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h   (contents,
props changed)
  head/sys/dev/if_wg/module/curve25519.c   (contents, props changed)
  head/sys/dev/if_wg/module/if_wg_session.c   (contents, props
changed)
  head/sys/dev/if_wg/module/module.c   (contents, props changed)
  head/sys/dev/if_wg/module/poly1305-x86_64.S   (contents, props
changed)
  head/sys/dev/if_wg/module/wg_cookie.c   (contents, props changed)
  head/sys/dev/if_wg/module/wg_noise.c   (contents, 

svn commit: r368182 - head/sys/compat/linuxkpi/common/include/linux

2020-11-30 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 30 09:47:53 2020
New Revision: 368182
URL: https://svnweb.freebsd.org/changeset/base/368182

Log:
  Use function macro for sema_init() in the LinuxKPI to limit macro expansion 
scope.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/semaphore.h

Modified: head/sys/compat/linuxkpi/common/include/linux/semaphore.h
==
--- head/sys/compat/linuxkpi/common/include/linux/semaphore.h   Mon Nov 30 
09:45:44 2020(r368181)
+++ head/sys/compat/linuxkpi/common/include/linux/semaphore.h   Mon Nov 30 
09:47:53 2020(r368182)
@@ -65,6 +65,6 @@ init_MUTEX(struct semaphore *sem)
sema_init(>sema, 1, "lnxsema");
 }
 
-#definesema_init   linux_sema_init
+#definesema_init(...)  linux_sema_init(__VA_ARGS__)
 
 #endif /* _LINUX_SEMAPHORE_H_ */
___
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: r368058 - head/sbin/ifconfig

2020-11-26 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov 26 16:36:50 2020
New Revision: 368058
URL: https://svnweb.freebsd.org/changeset/base/368058

Log:
  Ensure consistent error messages from ifconfig(8).
  
  If multiple threads are invoking "ifconfig XXX create" a race may occur
  which can lead to two different error messages for the same error.
  
  a) ifconfig: SIOCIFCREATE2: File exists
  b) ifconfig: interface XXX already exists
  
  This patch ensures ifconfig prints the same error code
  for the same case.
  
  Reviewed by:  imp@ and kib@
  Differential Revision:https://reviews.freebsd.org/D27380
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sbin/ifconfig/ifclone.c
  head/sbin/ifconfig/ifconfig.c
  head/sbin/ifconfig/ifconfig.h
  head/sbin/ifconfig/ifieee80211.c
  head/sbin/ifconfig/iflagg.c
  head/sbin/ifconfig/ifvlan.c
  head/sbin/ifconfig/ifvxlan.c

Modified: head/sbin/ifconfig/ifclone.c
==
--- head/sbin/ifconfig/ifclone.cThu Nov 26 14:57:30 2020
(r368057)
+++ head/sbin/ifconfig/ifclone.cThu Nov 26 16:36:50 2020
(r368058)
@@ -151,8 +151,7 @@ ifclonecreate(int s, void *arg)
}
if (clone_cb == NULL) {
/* NB: no parameters */
-   if (ioctl(s, SIOCIFCREATE2, ) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, );
} else {
clone_cb(s, );
}

Modified: head/sbin/ifconfig/ifconfig.c
==
--- head/sbin/ifconfig/ifconfig.c   Thu Nov 26 14:57:30 2020
(r368057)
+++ head/sbin/ifconfig/ifconfig.c   Thu Nov 26 16:36:50 2020
(r368058)
@@ -198,6 +198,19 @@ usage(void)
exit(1);
 }
 
+void
+ioctl_ifcreate(int s, struct ifreq *ifr)
+{
+   if (ioctl(s, SIOCIFCREATE2, ifr) < 0) {
+   switch (errno) {
+   case EEXIST:
+   errx(1, "interface %s already exists", ifr->ifr_name);
+   default:
+   err(1, "SIOCIFCREATE2");
+   }
+   }
+}
+
 #define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0])
 
 static int

Modified: head/sbin/ifconfig/ifconfig.h
==
--- head/sbin/ifconfig/ifconfig.h   Thu Nov 26 14:57:30 2020
(r368057)
+++ head/sbin/ifconfig/ifconfig.h   Thu Nov 26 16:36:50 2020
(r368058)
@@ -160,3 +160,4 @@ struct ifmediareq *ifmedia_getstate(int s);
 
 void print_vhid(const struct ifaddrs *, const char *);
 
+void ioctl_ifcreate(int s, struct ifreq *);

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cThu Nov 26 14:57:30 2020
(r368057)
+++ head/sbin/ifconfig/ifieee80211.cThu Nov 26 16:36:50 2020
(r368058)
@@ -5758,8 +5758,7 @@ wlan_create(int s, struct ifreq *ifr)
memcmp(params.icp_bssid, zerobssid, sizeof(zerobssid)) == 0)
errx(1, "no bssid specified for WDS (use wlanbssid)");
ifr->ifr_data = (caddr_t) 
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 
/* XXX preserve original name for ifclonecreate(). */
strlcpy(orig_name, name, sizeof(orig_name));

Modified: head/sbin/ifconfig/iflagg.c
==
--- head/sbin/ifconfig/iflagg.c Thu Nov 26 14:57:30 2020(r368057)
+++ head/sbin/ifconfig/iflagg.c Thu Nov 26 16:36:50 2020(r368058)
@@ -324,8 +324,7 @@ static void
 lagg_create(int s, struct ifreq *ifr)
 {
ifr->ifr_data = (caddr_t) 
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 }
 
 static struct cmd lagg_cmds[] = {

Modified: head/sbin/ifconfig/ifvlan.c
==
--- head/sbin/ifconfig/ifvlan.c Thu Nov 26 14:57:30 2020(r368057)
+++ head/sbin/ifconfig/ifvlan.c Thu Nov 26 16:36:50 2020(r368058)
@@ -162,8 +162,7 @@ vlan_create(int s, struct ifreq *ifr)
errx(1, "must specify a parent device for vlan create");
ifr->ifr_data = (caddr_t) 
}
-   if (ioctl(s, SIOCIFCREATE2, ifr) < 0)
-   err(1, "SIOCIFCREATE2");
+   ioctl_ifcreate(s, ifr);
 }
 
 static void

Modified: head/sbin/ifconfig/ifvxlan.c
==
--- head/sbin/ifconfig/ifvxlan.cThu Nov 26 14:57:30 2020
(r368057)
+++ head/sbin/ifconfig/ifvxlan.cThu Nov 26 16:36:50 2020
(r368058)
@@ -191,8 +191,7 @@ vxlan_create(int s, struct ifreq *ifr)
vxlan_check_params();

svn commit: r367981 - head/sys/dev/mlx5/mlx5_en

2020-11-24 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 24 13:07:59 2020
New Revision: 367981
URL: https://svnweb.freebsd.org/changeset/base/367981

Log:
  Remove erradic assert after SVN r367149 in mlx5en(4).
  
  The ratelimit tags may be shared, especially for unlimited TLS
  traffic, and then the refcount is allowed to be greater than one
  when freeing the send tag.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c  Tue Nov 24 06:42:32 2020
(r367980)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c  Tue Nov 24 13:07:59 2020
(r367981)
@@ -466,7 +466,6 @@ mlx5e_tls_snd_tag_free(struct m_snd_tag *pmt)
container_of(pmt, struct mlx5e_tls_tag, tag);
struct mlx5e_priv *priv;
 
-   MPASS(ptag->rl_tag->refcount == 1);
m_snd_tag_rele(ptag->rl_tag);
 
MLX5E_TLS_TAG_LOCK(ptag);
___
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: r367789 - in head/sys/compat/linuxkpi/common/include: asm linux

2020-11-18 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Nov 18 13:47:11 2020
New Revision: 367789
URL: https://svnweb.freebsd.org/changeset/base/367789

Log:
  Allow LinuxKPI types to be used in bootloaders, by checking for the
  _STANDALONE definition.
  
  No functional change intended.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/asm/types.h
  head/sys/compat/linuxkpi/common/include/linux/types.h

Modified: head/sys/compat/linuxkpi/common/include/asm/types.h
==
--- head/sys/compat/linuxkpi/common/include/asm/types.h Wed Nov 18 13:45:32 
2020(r367788)
+++ head/sys/compat/linuxkpi/common/include/asm/types.h Wed Nov 18 13:47:11 
2020(r367789)
@@ -31,7 +31,7 @@
 #ifndef_ASM_TYPES_H_
 #define_ASM_TYPES_H_
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 
 #include 
 
@@ -59,6 +59,6 @@ typedef vm_paddr_t dma64_addr_t;
 
 typedef unsigned short umode_t;
 
-#endif /* _KERNEL */
+#endif /* _KERNEL || _STANDALONE */
 
 #endif /* _ASM_TYPES_H_ */

Modified: head/sys/compat/linuxkpi/common/include/linux/types.h
==
--- head/sys/compat/linuxkpi/common/include/linux/types.h   Wed Nov 18 
13:45:32 2020(r367788)
+++ head/sys/compat/linuxkpi/common/include/linux/types.h   Wed Nov 18 
13:47:11 2020(r367789)
@@ -57,8 +57,10 @@ typedef uint16_t __aligned_u16 __aligned(sizeof(uint16
 typedef uint32_t __aligned_u32 __aligned(sizeof(uint32_t));
 typedef uint64_t __aligned_u64 __aligned(sizeof(uint64_t));
 
+#ifdef _KERNEL
 typedef unsigned short ushort;
 typedef unsigned intuint;
+#endif
 typedef unsigned long ulong;
 typedef unsigned gfp_t;
 typedef off_t loff_t;
@@ -67,7 +69,7 @@ typedef uint16_t __bitwise__ __sum16;
 typedef unsigned long pgoff_t;
 typedef unsigned __poll_t;
 
-typedef u64 phys_addr_t;
+typedef uint64_t phys_addr_t;
 
 typedef size_t __kernel_size_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: r367788 - head/sys/modules/linuxkpi

2020-11-18 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Nov 18 13:45:32 2020
New Revision: 367788
URL: https://svnweb.freebsd.org/changeset/base/367788

Log:
  Add missing header file when building the LinuxKPI module separately.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/modules/linuxkpi/Makefile

Modified: head/sys/modules/linuxkpi/Makefile
==
--- head/sys/modules/linuxkpi/Makefile  Wed Nov 18 13:22:22 2020
(r367787)
+++ head/sys/modules/linuxkpi/Makefile  Wed Nov 18 13:45:32 2020
(r367788)
@@ -25,7 +25,7 @@ SRCS= linux_compat.c \
 
 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
 ${MACHINE_CPUARCH} == "i386"
-SRCS+= opt_acpi.h linux_acpi.c
+SRCS+= opt_acpi.h acpi_if.h linux_acpi.c
 .endif
 
 SRCS+= ${LINUXKPI_GENSRCS}
___
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: r367787 - in head: stand/kshim sys/dev/usb

2020-11-18 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Nov 18 13:22:22 2020
New Revision: 367787
URL: https://svnweb.freebsd.org/changeset/base/367787

Log:
  Fix build of USB bootloader code by adding checks for _STANDALONE being 
defined.
  Currently the USB bootloader code is not part of buildworld.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/stand/kshim/bsd_kernel.h
  head/sys/dev/usb/usb.h
  head/sys/dev/usb/usb_pf.h
  head/sys/dev/usb/usbdi.h
  head/sys/dev/usb/usbhid.h

Modified: head/stand/kshim/bsd_kernel.h
==
--- head/stand/kshim/bsd_kernel.h   Wed Nov 18 09:00:05 2020
(r367786)
+++ head/stand/kshim/bsd_kernel.h   Wed Nov 18 13:22:22 2020
(r367787)
@@ -27,9 +27,12 @@
 #ifndef _BSD_KERNEL_H_
 #define_BSD_KERNEL_H_
 
-#define_KERNEL
+#if !defined(_STANDALONE)
+#error "_STANDALONE is not defined!"
+#endif
+
 #undef __FreeBSD_version
-#define__FreeBSD_version 110
+#define__FreeBSD_version 130
 
 #include 
 #include 

Modified: head/sys/dev/usb/usb.h
==
--- head/sys/dev/usb/usb.h  Wed Nov 18 09:00:05 2020(r367786)
+++ head/sys/dev/usb/usb.h  Wed Nov 18 13:22:22 2020(r367787)
@@ -41,7 +41,7 @@
 #ifndef _USB_STANDARD_H_
 #define_USB_STANDARD_H_
 
-#if defined(_KERNEL)
+#if defined(_KERNEL) || defined(_STANDALONE)
 #ifndef USB_GLOBAL_INCLUDE_FILE
 #include "opt_usb.h"
 #endif
@@ -57,7 +57,7 @@ SYSCTL_DECL(_hw_usb);
 
 MALLOC_DECLARE(M_USB);
 MALLOC_DECLARE(M_USBDEV);
-#endif /* _KERNEL */
+#endif /* _KERNEL || _STANDALONE */
 
 #ifndef USB_GLOBAL_INCLUDE_FILE
 #include 

Modified: head/sys/dev/usb/usb_pf.h
==
--- head/sys/dev/usb/usb_pf.h   Wed Nov 18 09:00:05 2020(r367786)
+++ head/sys/dev/usb/usb_pf.h   Wed Nov 18 13:22:22 2020(r367787)
@@ -113,10 +113,10 @@ extern uint8_t usbpf_framehdr_size_ok[
 #defineUSBPF_XFERTAP_SUBMIT0
 #defineUSBPF_XFERTAP_DONE  1
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 void   usbpf_attach(struct usb_bus *);
 void   usbpf_detach(struct usb_bus *);
 void   usbpf_xfertap(struct usb_xfer *, int);
-#endif
+#endif /* _KERNEL || _STANDALONE */
+#endif /* _DEV_USB_PF_H */
 
-#endif

Modified: head/sys/dev/usb/usbdi.h
==
--- head/sys/dev/usb/usbdi.hWed Nov 18 09:00:05 2020(r367786)
+++ head/sys/dev/usb/usbdi.hWed Nov 18 13:22:22 2020(r367787)
@@ -88,7 +88,7 @@ typedef enum {/* keep in sync with usb_errstr_table *
 #defineUSB_NO_TIMEOUT 0
 #defineUSB_DEFAULT_TIMEOUT 5000/* 5000 ms = 5 seconds */
 
-#if defined(_KERNEL)
+#if defined(_KERNEL) || defined(_STANDALONE)
 /* typedefs */
 
 typedef void (usb_callback_t)(struct usb_xfer *, usb_error_t);
@@ -709,5 +709,5 @@ void*usb_fifo_softc(struct usb_fifo *fifo);
 void   usb_fifo_set_close_zlp(struct usb_fifo *, uint8_t);
 void   usb_fifo_set_write_defrag(struct usb_fifo *, uint8_t);
 void   usb_fifo_free(struct usb_fifo *f);
-#endif /* _KERNEL */
-#endif /* _USB_USBDI_H_ */
+#endif /* _KERNEL || _STANDALONE */
+#endif /* _USB_USBDI_H_ */

Modified: head/sys/dev/usb/usbhid.h
==
--- head/sys/dev/usb/usbhid.h   Wed Nov 18 09:00:05 2020(r367786)
+++ head/sys/dev/usb/usbhid.h   Wed Nov 18 13:22:22 2020(r367787)
@@ -205,7 +205,7 @@ struct usb_hid_descriptor {
 #defineHUM_INCH0x13
 #defineHUM_DEGREE  0x14
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 struct usb_config_descriptor;
 
 enum hid_kind {
@@ -274,5 +274,5 @@ usb_error_t usbd_req_get_hid_desc(struct usb_device *u
 int32_thid_item_resolution(struct hid_item *hi);
 inthid_is_mouse(const void *d_ptr, uint16_t d_len);
 inthid_is_keyboard(const void *d_ptr, uint16_t d_len);
-#endif /* _KERNEL */
-#endif /* _USB_HID_H_ */
+#endif /* _KERNEL || _STANDALONE */
+#endif /* _USB_HID_H_ */
___
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: r367719 - in head/sys/dev/mlx5: . mlx5_core mlx5_ib

2020-11-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 16 10:15:03 2020
New Revision: 367719
URL: https://svnweb.freebsd.org/changeset/base/367719

Log:
  Make mlx5_cmd_exec_cb() a safe API in mlx5core.
  
  APIs that have deferred callbacks should have some kind of cleanup
  function that callers can use to fence the callbacks. Otherwise things
  like module unloading can lead to dangling function pointers, or worse.
  
  The IB MR code is the only place that calls this function and had a
  really poor attempt at creating this fence. Provide a good version in
  the core code as future patches will add more places that need this
  fence.
  
  Linux commit:
  e355477ed9e4f401e3931043df97325d38552d54
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  head/sys/dev/mlx5/mlx5_core/mlx5_mr.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Mon Nov 16 10:10:53 2020(r367718)
+++ head/sys/dev/mlx5/driver.h  Mon Nov 16 10:15:03 2020(r367719)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -947,11 +948,30 @@ void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
 void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
 void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome);
 int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type);
+
+struct mlx5_async_ctx {
+   struct mlx5_core_dev *dev;
+   atomic_t num_inflight;
+   struct wait_queue_head wait;
+};
+
+struct mlx5_async_work;
+
+typedef void (*mlx5_async_cbk_t)(int status, struct mlx5_async_work *context);
+
+struct mlx5_async_work {
+   struct mlx5_async_ctx *ctx;
+   mlx5_async_cbk_t user_callback;
+};
+
+void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+struct mlx5_async_ctx *ctx);
+void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx);
+int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
+void *out, int out_size, mlx5_async_cbk_t callback,
+struct mlx5_async_work *work);
 int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
  int out_size);
-int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-void *out, int out_size, mlx5_cmd_cbk_t callback,
-void *context);
 int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size,
  void *out, int out_size);
 int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
@@ -986,9 +1006,10 @@ void mlx5_init_mr_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
 struct mlx5_core_mr *mkey,
-u32 *in, int inlen,
-u32 *out, int outlen,
-mlx5_cmd_cbk_t callback, void *context);
+struct mlx5_async_ctx *async_ctx, u32 *in,
+int inlen, u32 *out, int outlen,
+mlx5_async_cbk_t callback,
+struct mlx5_async_work *context);
 int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
  struct mlx5_core_mr *mr,
  u32 *in, int inlen);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Mon Nov 16 10:10:53 2020
(r367718)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c  Mon Nov 16 10:15:03 2020
(r367719)
@@ -1353,11 +1353,57 @@ int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in,
 }
 EXPORT_SYMBOL(mlx5_cmd_exec);
 
-int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-void *out, int out_size, mlx5_cmd_cbk_t callback,
-void *context)
+void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+struct mlx5_async_ctx *ctx)
 {
-   return cmd_exec_helper(dev, in, in_size, out, out_size, callback, 
context, false);
+   ctx->dev = dev;
+   /* Starts at 1 to avoid doing wake_up if we are not cleaning up */
+   atomic_set(>num_inflight, 1);
+   init_waitqueue_head(>wait);
+}
+EXPORT_SYMBOL(mlx5_cmd_init_async_ctx);
+
+/**
+ * mlx5_cmd_cleanup_async_ctx - Clean up an async_ctx
+ * @ctx: The ctx to clean
+ *
+ * Upon return all callbacks given to mlx5_cmd_exec_cb() have been called. The
+ * caller must ensure that mlx5_cmd_exec_cb() is not called during or after
+ * the call mlx5_cleanup_async_ctx().
+ */
+void mlx5_cmd_cleanup_async_ctx(struct 

svn commit: r367718 - in head/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib

2020-11-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 16 10:10:53 2020
New Revision: 367718
URL: https://svnweb.freebsd.org/changeset/base/367718

Log:
  Report EQE data upon CQ completion in mlx5core.
  
  Report EQE data upon CQ completion to let upper layers use this data.
  
  Linux commit:
  4e0e2ea1886afe8c001971ff767f6670312a9b04
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/cq.h
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  head/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c

Modified: head/sys/dev/mlx5/cq.h
==
--- head/sys/dev/mlx5/cq.h  Mon Nov 16 10:06:10 2020(r367717)
+++ head/sys/dev/mlx5/cq.h  Mon Nov 16 10:10:53 2020(r367718)
@@ -32,7 +32,7 @@
 #include 
 #include 
 
-
+struct mlx5_eqe;
 struct mlx5_core_cq {
u32 cqn;
int cqe_sz;
@@ -40,7 +40,7 @@ struct mlx5_core_cq {
__be32 *arm_db;
unsignedvector;
int irqn;
-   void (*comp)(struct mlx5_core_cq *);
+   void (*comp)(struct mlx5_core_cq *, struct mlx5_eqe *);
void (*event)   (struct mlx5_core_cq *, int);
struct mlx5_uar*uar;
u32 cons_index;

Modified: head/sys/dev/mlx5/driver.h
==
--- head/sys/dev/mlx5/driver.h  Mon Nov 16 10:06:10 2020(r367717)
+++ head/sys/dev/mlx5/driver.h  Mon Nov 16 10:10:53 2020(r367718)
@@ -1021,7 +1021,7 @@ void mlx5_unregister_debugfs(void);
 int mlx5_eq_init(struct mlx5_core_dev *dev);
 void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
 void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
-void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
+void mlx5_cq_completion(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe);
 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
 void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
 struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   Mon Nov 16 10:06:10 2020
(r367717)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   Mon Nov 16 10:10:53 2020
(r367718)
@@ -55,13 +55,16 @@ mlx5_cq_table_write_unlock(struct mlx5_cq_table *table
NET_EPOCH_WAIT();
 }
 
-void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn)
+void mlx5_cq_completion(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe)
 {
struct mlx5_cq_table *table = >priv.cq_table;
struct mlx5_core_cq *cq;
struct epoch_tracker et;
+   u32 cqn;
bool do_lock;
 
+   cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xff;
+
NET_EPOCH_ENTER(et);
 
do_lock = atomic_read(>writercount) != 0;
@@ -78,7 +81,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32
 
if (likely(cq != NULL)) {
++cq->arm_sn;
-   cq->comp(cq);
+   cq->comp(cq, eqe);
} else {
mlx5_core_warn(dev,
"Completion event for bogus CQ 0x%x\n", cqn);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c   Mon Nov 16 10:06:10 2020
(r367717)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c   Mon Nov 16 10:10:53 2020
(r367718)
@@ -246,8 +246,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru
  eq->eqn, eqe_type_str(eqe->type));
switch (eqe->type) {
case MLX5_EVENT_TYPE_COMP:
-   cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xff;
-   mlx5_cq_completion(dev, cqn);
+   mlx5_cq_completion(dev, eqe);
break;
 
case MLX5_EVENT_TYPE_PATH_MIG:

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Mon Nov 16 10:06:10 2020
(r367717)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Mon Nov 16 10:10:53 2020
(r367718)
@@ -149,7 +149,7 @@ MALLOC_DECLARE(M_MLX5EN);
 struct mlx5_core_dev;
 struct mlx5e_cq;
 
-typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *);
+typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *, struct 

svn commit: r367717 - in head/sys/dev/mlx5: . mlx5_core mlx5_en mlx5_ib

2020-11-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 16 10:06:10 2020
New Revision: 367717
URL: https://svnweb.freebsd.org/changeset/base/367717

Log:
  Enhance the mlx5_core_create_cq() function in mlx5core.
  
  Enhance mlx5_core_create_cq() to get the command out buffer from the
  callers to let them use the output.
  
  Linux commit:
  38164b771947be9baf06e78ffdfb650f8f3e908e
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/cq.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c

Modified: head/sys/dev/mlx5/cq.h
==
--- head/sys/dev/mlx5/cq.h  Mon Nov 16 10:03:18 2020(r367716)
+++ head/sys/dev/mlx5/cq.h  Mon Nov 16 10:06:10 2020(r367717)
@@ -155,7 +155,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq
 int mlx5_init_cq_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-   u32 *in, int inlen);
+   u32 *in, int inlen, u32 *out, int outlen);
 int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
 int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
   u32 *out, int outlen);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   Mon Nov 16 10:03:18 2020
(r367716)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   Mon Nov 16 10:06:10 2020
(r367717)
@@ -119,16 +119,16 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn,
 }
 
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-   u32 *in, int inlen)
+   u32 *in, int inlen, u32 *out, int outlen)
 {
struct mlx5_cq_table *table = >priv.cq_table;
-   u32 out[MLX5_ST_SZ_DW(create_cq_out)] = {0};
u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {0};
u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)] = {0};
int err;
 
+   memset(out, 0, outlen);
MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ);
-   err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
+   err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
if (err)
return err;
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Nov 16 10:03:18 2020
(r367716)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Nov 16 10:06:10 2020
(r367717)
@@ -1989,6 +1989,7 @@ static int
 mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix)
 {
struct mlx5_core_cq *mcq = >mcq;
+   u32 out[MLX5_ST_SZ_DW(create_cq_out)];
void *in;
void *cqc;
int inlen;
@@ -2017,7 +2018,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_p
PAGE_SHIFT);
MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma);
 
-   err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen);
+   err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen, out, 
sizeof(out));
 
kvfree(in);
 

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c  Mon Nov 16 10:03:18 2020
(r367716)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c  Mon Nov 16 10:06:10 2020
(r367717)
@@ -905,6 +905,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
int entries = attr->cqe;
int vector = attr->comp_vector;
struct mlx5_ib_dev *dev = to_mdev(ibdev);
+   u32 out[MLX5_ST_SZ_DW(create_cq_out)];
struct mlx5_ib_cq *cq;
int uninitialized_var(index);
int uninitialized_var(inlen);
@@ -969,7 +970,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
if (cq->create_flags & IB_CQ_FLAGS_IGNORE_OVERRUN)
MLX5_SET(cqc, cqc, oi, 1);
 
-   err = mlx5_core_create_cq(dev->mdev, >mcq, cqb, inlen);
+   err = mlx5_core_create_cq(dev->mdev, >mcq, cqb, inlen, out, 
sizeof(out));
if (err)
goto err_cqb;
 
___
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: r367716 - in head/sys/dev/mlx5: . mlx5_core

2020-11-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 16 10:03:18 2020
New Revision: 367716
URL: https://svnweb.freebsd.org/changeset/base/367716

Log:
  Use mlx5core to create/destroy all Dynamically Connected Targets, DCTs.
  
  To prevent a hardware memory leak when a DEVX DCT object is destroyed
  without calling drain DCT before, (e.g. under cleanup flow), need to
  manage its creation and destruction via mlx5 core.
  
  Linux commit:
  c5ae1954c47d3fd8815bd5a592aba18702c93f33
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_qp.c
  head/sys/dev/mlx5/qp.h

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_qp.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_qp.c   Mon Nov 16 10:00:21 2020
(r367715)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_qp.c   Mon Nov 16 10:03:18 2020
(r367716)
@@ -349,19 +349,18 @@ EXPORT_SYMBOL_GPL(mlx5_core_xrcd_dealloc);
 
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 struct mlx5_core_dct *dct,
-u32 *in)
+u32 *in, int inlen,
+u32 *out, int outlen)
 {
struct mlx5_qp_table *table = >priv.qp_table;
-   u32 out[MLX5_ST_SZ_DW(create_dct_out)]   = {0};
u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
u32 din[MLX5_ST_SZ_DW(destroy_dct_in)]   = {0};
-   int inlen = MLX5_ST_SZ_BYTES(create_dct_in);
int err;
 
init_completion(>drained);
MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT);
 
-   err = mlx5_cmd_exec(dev, in, inlen, , sizeof(out));
+   err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
if (err) {
mlx5_core_warn(dev, "create DCT failed, ret %d", err);
return err;
@@ -387,7 +386,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 err_cmd:
MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
MLX5_SET(destroy_dct_in, din, dctn, dct->dctn);
-   mlx5_cmd_exec(dev, , sizeof(din), , sizeof(dout));
+   mlx5_cmd_exec(dev, , sizeof(din), dout, sizeof(dout));
 
return err;
 }

Modified: head/sys/dev/mlx5/qp.h
==
--- head/sys/dev/mlx5/qp.h  Mon Nov 16 10:00:21 2020(r367715)
+++ head/sys/dev/mlx5/qp.h  Mon Nov 16 10:03:18 2020(r367716)
@@ -586,7 +586,8 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u3
 int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 struct mlx5_core_dct *dct,
-u32 *in);
+u32 *in, int inlen,
+u32 *out, int outlen);
 int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
  struct mlx5_core_dct *dct);
 int mlx5_core_create_rq_tracked(struct mlx5_core_dev *dev, u32 *in, int inlen,
___
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: r367715 - head/sys/dev/mlx5/mlx5_ib

2020-11-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 16 10:00:21 2020
New Revision: 367715
URL: https://svnweb.freebsd.org/changeset/base/367715

Log:
  Fix error handling order in create_kernel_qp in mlx5ib.
  
  Make sure order of cleanup is exactly the opposite of initialization.
  
  Linux commit:
  f4044dac63e952ac1137b6df02b233d37696e2f5
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c
==
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c  Mon Nov 16 03:12:21 2020
(r367714)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c  Mon Nov 16 10:00:21 2020
(r367715)
@@ -987,12 +987,12 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev,
return 0;
 
 err_wrid:
-   mlx5_db_free(dev->mdev, >db);
kfree(qp->sq.wqe_head);
kfree(qp->sq.w_list);
kfree(qp->sq.wrid);
kfree(qp->sq.wr_data);
kfree(qp->rq.wrid);
+   mlx5_db_free(dev->mdev, >db);
 
 err_free:
kvfree(*in);
@@ -1007,12 +1007,12 @@ err_uuar:
 
 static void destroy_qp_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp)
 {
-   mlx5_db_free(dev->mdev, >db);
kfree(qp->sq.wqe_head);
kfree(qp->sq.w_list);
kfree(qp->sq.wrid);
kfree(qp->sq.wr_data);
kfree(qp->rq.wrid);
+   mlx5_db_free(dev->mdev, >db);
mlx5_buf_free(dev->mdev, >buf);
free_uuar(>mdev->priv.uuari, qp->bf->uuarn);
 }
___
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"


Re: svn commit: r367566 - stable/12/sys/compat/linuxkpi/common/include/linux

2020-11-16 Thread Hans Petter Selasky

On 11/16/20 9:56 AM, Niclas Zeising wrote:

On 2020-11-10 14:36, Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Nov 10 13:36:07 2020
New Revision: 367566
URL: https://svnweb.freebsd.org/changeset/base/367566

Log:
   MFC r366751:
   Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.


There are reports that this broke drm-fbsd12.0-kmod in stable.  See 
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251163 for details.

Can you have a look?


I'll update the port.

Thank you!

--HPS

___
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: r367622 - in head/sys/dev/usb: . quirk

2020-11-12 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov 12 18:24:37 2020
New Revision: 367622
URL: https://svnweb.freebsd.org/changeset/base/367622

Log:
  Add more USB quirks.
  
  PR:   230038
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Thu Nov 12 17:28:29 2020
(r367621)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Thu Nov 12 18:24:37 2020
(r367622)
@@ -240,7 +240,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(FREECOM, DVD, 0x, 0x, UQ_MSC_FORCE_PROTO_SCSI),
USB_QUIRK(FUJIPHOTO, MASS0100, 0x, 0x, UQ_MSC_FORCE_WIRE_CBI_I,
UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, 
UQ_MSC_NO_SYNC_CACHE),
+   USB_QUIRK(GARMIN, DAKOTA20, 0x, 0x, UQ_MSC_NO_INQUIRY),
USB_QUIRK(GARMIN, FORERUNNER230, 0x, 0x, UQ_MSC_NO_INQUIRY),
+   USB_QUIRK(GARMIN, GPSMAP62S, 0x, 0x, UQ_MSC_NO_INQUIRY),
USB_QUIRK(GENESYS, GL641USB2IDE, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsThu Nov 12 17:28:29 2020(r367621)
+++ head/sys/dev/usb/usbdevsThu Nov 12 18:24:37 2020(r367622)
@@ -2253,7 +2253,9 @@ product FUJITSU AH_F401U  0x105b  AH-F401U Air H device
 product FUJITSUSIEMENS SCR 0x0009  Fujitsu-Siemens SCR USB Reader
 
 /* Garmin products */
+product GARMIN DAKOTA200x23c0  Dakota 20
 product GARMIN FORERUNNER230   0x086d  ForeRunner 230
+product GARMIN GPSMAP62S   0x2459  GPSMAP 62s
 product GARMIN IQUE_3600   0x0004  iQue 3600
 
 /* Gemalto products */
___
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: r367615 - head/sys/dev/sound/usb

2020-11-12 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov 12 09:26:01 2020
New Revision: 367615
URL: https://svnweb.freebsd.org/changeset/base/367615

Log:
  Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the
  the HID volume keys support in the USB audio driver.
  
  While at it re-organize the USB audio sysctls a bit.
  
  Differential Revision:https://reviews.freebsd.org/D27180
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Thu Nov 12 09:15:07 2020
(r367614)
+++ head/sys/dev/sound/usb/uaudio.c Thu Nov 12 09:26:01 2020
(r367615)
@@ -98,15 +98,12 @@ static int uaudio_default_rate = 0; /* use rate 
list 
 static int uaudio_default_bits = 32;
 static int uaudio_default_channels = 0;/* use default */
 static int uaudio_buffer_ms = 8;
+static bool uaudio_handle_hid = true;
 
-#ifdef USB_DEBUG
-static int uaudio_debug;
-
 static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
 "USB uaudio");
-
-SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
-_debug, 0, "uaudio debug level");
+SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN,
+_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN,
 _default_rate, 0, "uaudio default sample rate");
 SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN,
@@ -138,6 +135,12 @@ SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms,
 CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int),
 uaudio_buffer_ms_sysctl, "I",
 "uaudio buffering delay from 2ms to 8ms");
+
+#ifdef USB_DEBUG
+static int uaudio_debug;
+
+SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
+_debug, 0, "uaudio debug level");
 #else
 #defineuaudio_debug 0
 #endif
@@ -1116,10 +1119,12 @@ uaudio_attach(device_t dev)
goto detach;
}
 
-   if (uaudio_hid_probe(sc, uaa) == 0) {
-   device_printf(dev, "HID volume keys found.\n");
-   } else {
-   device_printf(dev, "No HID volume keys found.\n");
+   if (uaudio_handle_hid) {
+   if (uaudio_hid_probe(sc, uaa) == 0) {
+   device_printf(dev, "HID volume keys found.\n");
+   } else {
+   device_printf(dev, "No HID volume keys found.\n");
+   }
}
 
/* reload all mixer settings */
___
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: r367614 - head/sys/dev/usb/controller

2020-11-12 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov 12 09:15:07 2020
New Revision: 367614
URL: https://svnweb.freebsd.org/changeset/base/367614

Log:
  When doing a USB alternate setting on an USB interface we need to
  re-configure the XHCI endpoint context.
  
  Differential Revision:https://reviews.freebsd.org/D27174
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/controller/xhci.c

Modified: head/sys/dev/usb/controller/xhci.c
==
--- head/sys/dev/usb/controller/xhci.c  Thu Nov 12 02:52:01 2020
(r367613)
+++ head/sys/dev/usb/controller/xhci.c  Thu Nov 12 09:15:07 2020
(r367614)
@@ -4020,6 +4020,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
 struct usb_endpoint *ep)
 {
struct xhci_endpoint_ext *pepext;
+   struct xhci_softc *sc;
+   uint8_t index;
+   uint8_t epno;
 
DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n",
ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode);
@@ -4036,6 +4039,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
USB_BUS_LOCK(udev->bus);
pepext->trb_halted = 1;
pepext->trb_running = 0;
+
+   /*
+* When doing an alternate setting, except for control
+* endpoints, we need to re-configure the XHCI endpoint
+* context:
+*/
+   if ((edesc->bEndpointAddress & UE_ADDR) != 0) {
+   sc = XHCI_BUS2SC(udev->bus);
+   index = udev->controller_slot_id;
+   epno = XHCI_EPNO2EPID(edesc->bEndpointAddress);
+   sc->sc_hw.devs[index].ep_configured &= ~(1U << epno);
+   }
USB_BUS_UNLOCK(udev->bus);
 }
 
___
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"


Re: svn commit: r367588 - in head/sys: kern sys

2020-11-11 Thread Hans Petter Selasky

On 11/11/20 2:44 PM, Mark Johnston wrote:

+#defineSIGIO_ASSERT_LOCKED(type) mtx_assert(_lock, MA_OWNED)
  


Minor nit: "type" argument can be removed from macro.

--HPS
___
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: r367566 - stable/12/sys/compat/linuxkpi/common/include/linux

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:36:07 2020
New Revision: 367566
URL: https://svnweb.freebsd.org/changeset/base/367566

Log:
  MFC r366751:
  Remove ifdefs around IS_ALIGNED() definition in the LinuxKPI.
  
  Discussed with:   manu@
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Nov 10 
13:33:39 2020(r367565)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Nov 10 
13:36:07 2020(r367566)
@@ -135,10 +135,7 @@ extern const volatile int lkpi_build_bug_on_zero;
 #defineALIGN(x, y) roundup2((x), (y))
 #undef PTR_ALIGN
 #definePTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), 
(a)))
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 5
-/* Moved from linuxkpi_gplv2 */
 #defineIS_ALIGNED(x, a)(((x) & ((__typeof(x))(a) - 1)) == 0)
-#endif
 #defineDIV_ROUND_UP(x, n)  howmany(x, n)
 #define__KERNEL_DIV_ROUND_UP(x, n) howmany(x, n)
 #defineDIV_ROUND_UP_ULL(x, n)  DIV_ROUND_UP((unsigned long long)(x), 
(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: r367565 - in stable/11/sys/dev/usb: . quirk

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:33:39 2020
New Revision: 367565
URL: https://svnweb.freebsd.org/changeset/base/367565

Log:
  MFC r366806:
  Add new USB quirk.
  
  PR:   250422
  Submitted by: vidwer+fbsdb...@gmail.com
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/usb/quirk/usb_quirk.c
  stable/11/sys/dev/usb/usbdevs
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:32:50 2020
(r367564)
+++ stable/11/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:33:39 2020
(r367565)
@@ -191,6 +191,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
USB_QUIRK(CYPRESS, XX6830XX, 0x, 0x, UQ_MSC_NO_GETMAXLUN,
UQ_MSC_NO_SYNC_CACHE),
+   USB_QUIRK(EMTEC, DANEELEC4GB, 0x, 0x, UQ_MSC_NO_SYNC_CACHE),
USB_QUIRK(DESKNOTE, UCR_61S2B, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI),
USB_QUIRK(DMI, CFSM_RW, 0x, 0x, UQ_MSC_FORCE_PROTO_SCSI,

Modified: stable/11/sys/dev/usb/usbdevs
==
--- stable/11/sys/dev/usb/usbdevs   Tue Nov 10 13:32:50 2020
(r367564)
+++ stable/11/sys/dev/usb/usbdevs   Tue Nov 10 13:33:39 2020
(r367565)
@@ -1811,6 +1811,7 @@ product ELV USBI2C0xe00f  USB-I2C 
interface
 product EMS DUAL_SHOOTER   0x0003  PSX gun controller converter
 
 /* Emtec products */
+product EMTEC DANEELEC4GB  0x1e20 USB DISK Pro PMAP
 product EMTEC RUF2PS   0x2240 Flash Drive
 
 /* Encore products */
___
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: r367564 - in stable/12/sys/dev/usb: . quirk

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:32:50 2020
New Revision: 367564
URL: https://svnweb.freebsd.org/changeset/base/367564

Log:
  MFC r366806:
  Add new USB quirk.
  
  PR:   250422
  Submitted by: vidwer+fbsdb...@gmail.com
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/usb/quirk/usb_quirk.c
  stable/12/sys/dev/usb/usbdevs
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:31:01 2020
(r367563)
+++ stable/12/sys/dev/usb/quirk/usb_quirk.c Tue Nov 10 13:32:50 2020
(r367564)
@@ -221,6 +221,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
USB_QUIRK(CYPRESS, XX6830XX, 0x, 0x, UQ_MSC_NO_GETMAXLUN,
UQ_MSC_NO_SYNC_CACHE),
+   USB_QUIRK(EMTEC, DANEELEC4GB, 0x, 0x, UQ_MSC_NO_SYNC_CACHE),
USB_QUIRK(DESKNOTE, UCR_61S2B, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
UQ_MSC_FORCE_PROTO_SCSI),
USB_QUIRK(DMI, CFSM_RW, 0x, 0x, UQ_MSC_FORCE_PROTO_SCSI,

Modified: stable/12/sys/dev/usb/usbdevs
==
--- stable/12/sys/dev/usb/usbdevs   Tue Nov 10 13:31:01 2020
(r367563)
+++ stable/12/sys/dev/usb/usbdevs   Tue Nov 10 13:32:50 2020
(r367564)
@@ -1885,6 +1885,7 @@ product ELV USBI2C0xe00f  USB-I2C 
interface
 product EMS DUAL_SHOOTER   0x0003  PSX gun controller converter
 
 /* Emtec products */
+product EMTEC DANEELEC4GB  0x1e20 USB DISK Pro PMAP
 product EMTEC RUF2PS   0x2240 Flash Drive
 
 /* Encore products */
___
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: r367563 - stable/11/sys/ofed/drivers/infiniband/core

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:31:01 2020
New Revision: 367563
URL: https://svnweb.freebsd.org/changeset/base/367563

Log:
  MFC r367269:
  Fix for referencing file via its vnode in ibore.
  
  Use the native vnode lookup functions, instead of going via the LinuxKPI,
  because the file referenced is typically created outside the LinuxKPI, and
  the LinuxKPI's fdget() can only resolve file descriptor numbers which
  were created by itself.
  
  The vnode pointer is used as an identifier to identify XRCD handles which
  are sharing resources.
  
  This patch fixes the so-called XRCD support in ibcore for FreeBSD.
  Refer to ibv_open_xrcd(3) for more information how the file descriptor
  argument is used.
  
  Reviewed by:  kib@
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c
==
--- stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c  Tue Nov 10 
13:22:52 2020(r367562)
+++ stable/11/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c  Tue Nov 10 
13:31:01 2020(r367563)
@@ -666,11 +666,11 @@ err_put:
 struct xrcd_table_entry {
struct rb_node  node;
struct ib_xrcd *xrcd;
-   struct inode   *inode;
+   struct vnode   *vnode;
 };
 
 static int xrcd_table_insert(struct ib_uverbs_device *dev,
-   struct inode *inode,
+   struct vnode *vnode,
struct ib_xrcd *xrcd)
 {
struct xrcd_table_entry *entry, *scan;
@@ -682,15 +682,15 @@ static int xrcd_table_insert(struct ib_uverbs_device *
return -ENOMEM;
 
entry->xrcd  = xrcd;
-   entry->inode = inode;
+   entry->vnode = vnode;
 
while (*p) {
parent = *p;
scan = rb_entry(parent, struct xrcd_table_entry, node);
 
-   if (inode < scan->inode) {
+   if ((uintptr_t)vnode < (uintptr_t)scan->vnode) {
p = &(*p)->rb_left;
-   } else if (inode > scan->inode) {
+   } else if ((uintptr_t)vnode > (uintptr_t)scan->vnode) {
p = &(*p)->rb_right;
} else {
kfree(entry);
@@ -700,12 +700,12 @@ static int xrcd_table_insert(struct ib_uverbs_device *
 
rb_link_node(>node, parent, p);
rb_insert_color(>node, >xrcd_tree);
-   igrab(inode);
+   vrefact(vnode);
return 0;
 }
 
 static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev,
- struct inode *inode)
+ struct vnode *vnode)
 {
struct xrcd_table_entry *entry;
struct rb_node *p = dev->xrcd_tree.rb_node;
@@ -713,9 +713,9 @@ static struct xrcd_table_entry *xrcd_table_search(stru
while (p) {
entry = rb_entry(p, struct xrcd_table_entry, node);
 
-   if (inode < entry->inode)
+   if ((uintptr_t)vnode < (uintptr_t)entry->vnode)
p = p->rb_left;
-   else if (inode > entry->inode)
+   else if ((uintptr_t)vnode > (uintptr_t)entry->vnode)
p = p->rb_right;
else
return entry;
@@ -724,11 +724,11 @@ static struct xrcd_table_entry *xrcd_table_search(stru
return NULL;
 }
 
-static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode 
*inode)
+static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct vnode 
*vnode)
 {
struct xrcd_table_entry *entry;
 
-   entry = xrcd_table_search(dev, inode);
+   entry = xrcd_table_search(dev, vnode);
if (!entry)
return NULL;
 
@@ -736,13 +736,13 @@ static struct ib_xrcd *find_xrcd(struct ib_uverbs_devi
 }
 
 static void xrcd_table_delete(struct ib_uverbs_device *dev,
- struct inode *inode)
+ struct vnode *vnode)
 {
struct xrcd_table_entry *entry;
 
-   entry = xrcd_table_search(dev, inode);
+   entry = xrcd_table_search(dev, vnode);
if (entry) {
-   iput(inode);
+   vrele(vnode);
rb_erase(>node, >xrcd_tree);
kfree(entry);
}
@@ -758,8 +758,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil
struct ib_udata udata;
struct ib_uxrcd_object *obj;
struct ib_xrcd *xrcd = NULL;
-   struct fd   f = {NULL};
-   struct inode   *inode = NULL;
+   struct vnode   *vnode = NULL;
int ret = 0;
int   

svn commit: r367562 - stable/12/sys/ofed/drivers/infiniband/core

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:22:52 2020
New Revision: 367562
URL: https://svnweb.freebsd.org/changeset/base/367562

Log:
  MFC r367269:
  Fix for referencing file via its vnode in ibore.
  
  Use the native vnode lookup functions, instead of going via the LinuxKPI,
  because the file referenced is typically created outside the LinuxKPI, and
  the LinuxKPI's fdget() can only resolve file descriptor numbers which
  were created by itself.
  
  The vnode pointer is used as an identifier to identify XRCD handles which
  are sharing resources.
  
  This patch fixes the so-called XRCD support in ibcore for FreeBSD.
  Refer to ibv_open_xrcd(3) for more information how the file descriptor
  argument is used.
  
  Reviewed by:  kib@
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c
==
--- stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c  Tue Nov 10 
13:21:02 2020(r367561)
+++ stable/12/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c  Tue Nov 10 
13:22:52 2020(r367562)
@@ -666,11 +666,11 @@ err_put:
 struct xrcd_table_entry {
struct rb_node  node;
struct ib_xrcd *xrcd;
-   struct inode   *inode;
+   struct vnode   *vnode;
 };
 
 static int xrcd_table_insert(struct ib_uverbs_device *dev,
-   struct inode *inode,
+   struct vnode *vnode,
struct ib_xrcd *xrcd)
 {
struct xrcd_table_entry *entry, *scan;
@@ -682,15 +682,15 @@ static int xrcd_table_insert(struct ib_uverbs_device *
return -ENOMEM;
 
entry->xrcd  = xrcd;
-   entry->inode = inode;
+   entry->vnode = vnode;
 
while (*p) {
parent = *p;
scan = rb_entry(parent, struct xrcd_table_entry, node);
 
-   if (inode < scan->inode) {
+   if ((uintptr_t)vnode < (uintptr_t)scan->vnode) {
p = &(*p)->rb_left;
-   } else if (inode > scan->inode) {
+   } else if ((uintptr_t)vnode > (uintptr_t)scan->vnode) {
p = &(*p)->rb_right;
} else {
kfree(entry);
@@ -700,12 +700,12 @@ static int xrcd_table_insert(struct ib_uverbs_device *
 
rb_link_node(>node, parent, p);
rb_insert_color(>node, >xrcd_tree);
-   igrab(inode);
+   vrefact(vnode);
return 0;
 }
 
 static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev,
- struct inode *inode)
+ struct vnode *vnode)
 {
struct xrcd_table_entry *entry;
struct rb_node *p = dev->xrcd_tree.rb_node;
@@ -713,9 +713,9 @@ static struct xrcd_table_entry *xrcd_table_search(stru
while (p) {
entry = rb_entry(p, struct xrcd_table_entry, node);
 
-   if (inode < entry->inode)
+   if ((uintptr_t)vnode < (uintptr_t)entry->vnode)
p = p->rb_left;
-   else if (inode > entry->inode)
+   else if ((uintptr_t)vnode > (uintptr_t)entry->vnode)
p = p->rb_right;
else
return entry;
@@ -724,11 +724,11 @@ static struct xrcd_table_entry *xrcd_table_search(stru
return NULL;
 }
 
-static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode 
*inode)
+static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct vnode 
*vnode)
 {
struct xrcd_table_entry *entry;
 
-   entry = xrcd_table_search(dev, inode);
+   entry = xrcd_table_search(dev, vnode);
if (!entry)
return NULL;
 
@@ -736,13 +736,13 @@ static struct ib_xrcd *find_xrcd(struct ib_uverbs_devi
 }
 
 static void xrcd_table_delete(struct ib_uverbs_device *dev,
- struct inode *inode)
+ struct vnode *vnode)
 {
struct xrcd_table_entry *entry;
 
-   entry = xrcd_table_search(dev, inode);
+   entry = xrcd_table_search(dev, vnode);
if (entry) {
-   iput(inode);
+   vrele(vnode);
rb_erase(>node, >xrcd_tree);
kfree(entry);
}
@@ -758,8 +758,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil
struct ib_udata udata;
struct ib_uxrcd_object *obj;
struct ib_xrcd *xrcd = NULL;
-   struct fd   f = {NULL};
-   struct inode   *inode = NULL;
+   struct vnode   *vnode = NULL;
int ret = 0;
int   

svn commit: r367561 - in stable/11: share/man/man4 sys/dev/usb sys/dev/usb/input

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:21:02 2020
New Revision: 367561
URL: https://svnweb.freebsd.org/changeset/base/367561

Log:
  MFC r367236:
  Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).
  
  Submitted by: pedro martelletto 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/share/man/man4/uhid.4
  stable/11/sys/dev/usb/input/uhid.c
  stable/11/sys/dev/usb/usb_generic.c
  stable/11/sys/dev/usb/usb_generic.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/uhid.4
==
--- stable/11/share/man/man4/uhid.4 Tue Nov 10 13:18:44 2020
(r367560)
+++ stable/11/share/man/man4/uhid.4 Tue Nov 10 13:21:02 2020
(r367561)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 22, 2006
+.Dd Oct 31, 2020
 .Dt UHID 4
 .Os
 .Sh NAME
@@ -114,6 +114,11 @@ It should be
 or
 .Dv UHID_FEATURE_REPORT .
 This call may fail if the device does not support this feature.
+.It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info"
+Returns information about the device, like USB vendor ID and USB product ID.
+This call will not issue any USB transactions.
+Also refer to
+.Xr ugen 4 .
 .El
 .Pp
 Use

Modified: stable/11/sys/dev/usb/input/uhid.c
==
--- stable/11/sys/dev/usb/input/uhid.c  Tue Nov 10 13:18:44 2020
(r367560)
+++ stable/11/sys/dev/usb/input/uhid.c  Tue Nov 10 13:21:02 2020
(r367561)
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #defineUSB_DEBUG_VAR uhid_debug
 #include 
@@ -141,11 +142,13 @@ static usb_fifo_cmd_t uhid_stop_write;
 static usb_fifo_open_t uhid_open;
 static usb_fifo_close_t uhid_close;
 static usb_fifo_ioctl_t uhid_ioctl;
+static usb_fifo_ioctl_t uhid_ioctl_post;
 
 static struct usb_fifo_methods uhid_fifo_methods = {
.f_open = _open,
.f_close = _close,
.f_ioctl = _ioctl,
+   .f_ioctl_post = _ioctl_post,
.f_start_read = _start_read,
.f_stop_read = _stop_read,
.f_start_write = _start_write,
@@ -642,6 +645,24 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *ad
 
case USB_GET_REPORT_ID:
*(int *)addr = 0;   /* XXX: we only support reportid 0? */
+   break;
+
+   default:
+   error = ENOIOCTL;
+   break;
+   }
+   return (error);
+}
+
+static int
+uhid_ioctl_post(struct usb_fifo *fifo, u_long cmd, void *addr,
+int fflags)
+{
+   int error;
+
+   switch (cmd) {
+   case USB_GET_DEVICEINFO:
+   error = ugen_fill_deviceinfo(fifo, addr);
break;
 
default:

Modified: stable/11/sys/dev/usb/usb_generic.c
==
--- stable/11/sys/dev/usb/usb_generic.c Tue Nov 10 13:18:44 2020
(r367560)
+++ stable/11/sys/dev/usb/usb_generic.c Tue Nov 10 13:21:02 2020
(r367561)
@@ -107,8 +107,6 @@ static int  ugen_set_interface(struct usb_fifo *, uint8
 static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *);
 static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *);
 static int ugen_get_iface_driver(struct usb_fifo *f, struct 
usb_gen_descriptor *ugd);
-static int usb_gen_fill_deviceinfo(struct usb_fifo *,
-   struct usb_device_info *);
 static int ugen_re_enumerate(struct usb_fifo *);
 static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int);
 static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *);
@@ -815,7 +813,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g
 }
 
 /**
- * usb_gen_fill_deviceinfo
+ * ugen_fill_deviceinfo
  *
  * This function dumps information about an USB device to the
  * structure pointed to by the "di" argument.
@@ -824,8 +822,8 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g
  *0: Success
  * Else: Failure
  **/
-static int
-usb_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
+int
+ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
 {
struct usb_device *udev;
struct usb_device *hub;
@@ -2214,7 +2212,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *
 
case USB_DEVICEINFO:
case USB_GET_DEVICEINFO:
-   error = usb_gen_fill_deviceinfo(f, addr);
+   error = ugen_fill_deviceinfo(f, addr);
break;
 
case USB_DEVICESTATS:

Modified: stable/11/sys/dev/usb/usb_generic.h
==
--- stable/11/sys/dev/usb/usb_generic.h Tue Nov 10 13:18:44 2020
(r367560)

svn commit: r367560 - in stable/12: share/man/man4 sys/dev/usb sys/dev/usb/input

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:18:44 2020
New Revision: 367560
URL: https://svnweb.freebsd.org/changeset/base/367560

Log:
  MFC r367236:
  Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).
  
  Submitted by: pedro martelletto 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/share/man/man4/uhid.4
  stable/12/sys/dev/usb/input/uhid.c
  stable/12/sys/dev/usb/usb_generic.c
  stable/12/sys/dev/usb/usb_generic.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/uhid.4
==
--- stable/12/share/man/man4/uhid.4 Tue Nov 10 13:16:37 2020
(r367559)
+++ stable/12/share/man/man4/uhid.4 Tue Nov 10 13:18:44 2020
(r367560)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 1, 2018
+.Dd Oct 31, 2020
 .Dt UHID 4
 .Os
 .Sh NAME
@@ -131,6 +131,11 @@ and the
 .Va ugd_maxlen
 fields.
 This call may fail if the device does not support this feature.
+.It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info"
+Returns information about the device, like USB vendor ID and USB product ID.
+This call will not issue any USB transactions.
+Also refer to
+.Xr ugen 4 .
 .El
 .Pp
 Use

Modified: stable/12/sys/dev/usb/input/uhid.c
==
--- stable/12/sys/dev/usb/input/uhid.c  Tue Nov 10 13:16:37 2020
(r367559)
+++ stable/12/sys/dev/usb/input/uhid.c  Tue Nov 10 13:18:44 2020
(r367560)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #defineUSB_DEBUG_VAR uhid_debug
 #include 
@@ -143,11 +144,13 @@ static usb_fifo_cmd_t uhid_stop_write;
 static usb_fifo_open_t uhid_open;
 static usb_fifo_close_t uhid_close;
 static usb_fifo_ioctl_t uhid_ioctl;
+static usb_fifo_ioctl_t uhid_ioctl_post;
 
 static struct usb_fifo_methods uhid_fifo_methods = {
.f_open = _open,
.f_close = _close,
.f_ioctl = _ioctl,
+   .f_ioctl_post = _ioctl_post,
.f_start_read = _start_read,
.f_stop_read = _stop_read,
.f_start_write = _start_write,
@@ -644,6 +647,24 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *ad
 
case USB_GET_REPORT_ID:
*(int *)addr = 0;   /* XXX: we only support reportid 0? */
+   break;
+
+   default:
+   error = ENOIOCTL;
+   break;
+   }
+   return (error);
+}
+
+static int
+uhid_ioctl_post(struct usb_fifo *fifo, u_long cmd, void *addr,
+int fflags)
+{
+   int error;
+
+   switch (cmd) {
+   case USB_GET_DEVICEINFO:
+   error = ugen_fill_deviceinfo(fifo, addr);
break;
 
default:

Modified: stable/12/sys/dev/usb/usb_generic.c
==
--- stable/12/sys/dev/usb/usb_generic.c Tue Nov 10 13:16:37 2020
(r367559)
+++ stable/12/sys/dev/usb/usb_generic.c Tue Nov 10 13:18:44 2020
(r367560)
@@ -109,8 +109,6 @@ static int  ugen_set_interface(struct usb_fifo *, uint8
 static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *);
 static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *);
 static int ugen_get_iface_driver(struct usb_fifo *f, struct 
usb_gen_descriptor *ugd);
-static int usb_gen_fill_deviceinfo(struct usb_fifo *,
-   struct usb_device_info *);
 static int ugen_re_enumerate(struct usb_fifo *);
 static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int);
 static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *);
@@ -817,7 +815,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g
 }
 
 /**
- * usb_gen_fill_deviceinfo
+ * ugen_fill_deviceinfo
  *
  * This function dumps information about an USB device to the
  * structure pointed to by the "di" argument.
@@ -826,8 +824,8 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g
  *0: Success
  * Else: Failure
  **/
-static int
-usb_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
+int
+ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
 {
struct usb_device *udev;
struct usb_device *hub;
@@ -2216,7 +2214,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *
 
case USB_DEVICEINFO:
case USB_GET_DEVICEINFO:
-   error = usb_gen_fill_deviceinfo(f, addr);
+   error = ugen_fill_deviceinfo(f, addr);
break;
 
case USB_DEVICESTATS:

Modified: stable/12/sys/dev/usb/usb_generic.h
==
--- stable/12/sys/dev/usb/usb_generic.h Tue Nov 10 13:16:37 2020
(r367559)
+++ 

svn commit: r367559 - in stable/11/sys/dev/usb: . serial

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:16:37 2020
New Revision: 367559
URL: https://svnweb.freebsd.org/changeset/base/367559

Log:
  MFC r367096:
  Add new USB IDs.
  
  Submitted by: aleksi.kaalin...@kapsi.fi
  PR:   250675
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/usb/serial/uftdi.c
  stable/11/sys/dev/usb/usbdevs
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/serial/uftdi.c
==
--- stable/11/sys/dev/usb/serial/uftdi.cTue Nov 10 13:15:53 2020
(r367558)
+++ stable/11/sys/dev/usb/serial/uftdi.cTue Nov 10 13:16:37 2020
(r367559)
@@ -291,6 +291,8 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = {
UFTDI_DEV(BBELECTRONICS, USPTL4, 0),
UFTDI_DEV(BBELECTRONICS, USTL4, 0),
UFTDI_DEV(BBELECTRONICS, ZZ_PROG1_USB, 0),
+   UFTDI_DEV(BRAINBOXES, US257, 0),
+   UFTDI_DEV(BRAINBOXES, US25701, 0),
UFTDI_DEV(CONTEC, COM1USBH, 0),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 0),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 0),

Modified: stable/11/sys/dev/usb/usbdevs
==
--- stable/11/sys/dev/usb/usbdevs   Tue Nov 10 13:15:53 2020
(r367558)
+++ stable/11/sys/dev/usb/usbdevs   Tue Nov 10 13:16:37 2020
(r367559)
@@ -1355,6 +1355,10 @@ product BILLIONTON USBEL100  0x0988  USB100EL
 product BILLIONTON USBE100 0x8511  USBE100
 product BILLIONTON USB2AR  0x90ff  USB2AR Ethernet
 
+/* Brainboxes Limited products */
+product BRAINBOXES US257   0x5001  US-257 USB2Serial 2xRS232
+product BRAINBOXES US25701 0x5002  US-25701 USB2Serial 2xRS232
+
 /* Broadcom products */
 product BROADCOM BCM2033   0x2033  BCM2033 Bluetooth USB dongle
 
___
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: r367558 - in stable/12/sys/dev/usb: . serial

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:15:53 2020
New Revision: 367558
URL: https://svnweb.freebsd.org/changeset/base/367558

Log:
  MFC r367096:
  Add new USB IDs.
  
  Submitted by: aleksi.kaalin...@kapsi.fi
  PR:   250675
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  stable/12/sys/dev/usb/serial/uftdi.c
  stable/12/sys/dev/usb/usbdevs
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/serial/uftdi.c
==
--- stable/12/sys/dev/usb/serial/uftdi.cTue Nov 10 13:13:37 2020
(r367557)
+++ stable/12/sys/dev/usb/serial/uftdi.cTue Nov 10 13:15:53 2020
(r367558)
@@ -293,6 +293,8 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = {
UFTDI_DEV(BBELECTRONICS, USPTL4, 0),
UFTDI_DEV(BBELECTRONICS, USTL4, 0),
UFTDI_DEV(BBELECTRONICS, ZZ_PROG1_USB, 0),
+   UFTDI_DEV(BRAINBOXES, US257, 0),
+   UFTDI_DEV(BRAINBOXES, US25701, 0),
UFTDI_DEV(CONTEC, COM1USBH, 0),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 0),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 0),

Modified: stable/12/sys/dev/usb/usbdevs
==
--- stable/12/sys/dev/usb/usbdevs   Tue Nov 10 13:13:37 2020
(r367557)
+++ stable/12/sys/dev/usb/usbdevs   Tue Nov 10 13:15:53 2020
(r367558)
@@ -1416,6 +1416,10 @@ product BILLIONTON USBEL100  0x0988  USB100EL
 product BILLIONTON USBE100 0x8511  USBE100
 product BILLIONTON USB2AR  0x90ff  USB2AR Ethernet
 
+/* Brainboxes Limited products */
+product BRAINBOXES US257   0x5001  US-257 USB2Serial 2xRS232
+product BRAINBOXES US25701 0x5002  US-25701 USB2Serial 2xRS232
+
 /* Broadcom products */
 product BROADCOM BCM2033   0x2033  BCM2033 Bluetooth USB dongle
 
___
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: r367557 - in stable/11/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:13:37 2020
New Revision: 367557
URL: https://svnweb.freebsd.org/changeset/base/367557

Log:
  MFC r364860 and r366996:
  Implement extensible arrays API using the existing radix tree implementation
  in the LinuxKPI.
  
  Differential Revision:https://reviews.freebsd.org/D25101
  Reviewed by:  kib @
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Added:
  stable/11/sys/compat/linuxkpi/common/include/linux/xarray.h
 - copied, changed from r364860, 
head/sys/compat/linuxkpi/common/include/linux/xarray.h
  stable/11/sys/compat/linuxkpi/common/src/linux_xarray.c
 - copied, changed from r364860, 
head/sys/compat/linuxkpi/common/src/linux_xarray.c
Modified:
  stable/11/sys/conf/files
  stable/11/sys/modules/linuxkpi/Makefile
Directory Properties:
  stable/11/   (props changed)

Copied and modified: 
stable/11/sys/compat/linuxkpi/common/include/linux/xarray.h (from r364860, 
head/sys/compat/linuxkpi/common/include/linux/xarray.h)
==
--- head/sys/compat/linuxkpi/common/include/linux/xarray.h  Thu Aug 27 
10:28:12 2020(r364860, copy source)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/xarray.h Tue Nov 10 
13:13:37 2020(r367557)
@@ -91,4 +91,10 @@ xa_err(void *ptr)
return (PTR_ERR_OR_ZERO(ptr));
 }
 
+static inline void
+xa_init(struct xarray *xa)
+{
+   xa_init_flags(xa, 0);
+}
+
 #endif /* _LINUX_XARRAY_H_ */

Copied and modified: stable/11/sys/compat/linuxkpi/common/src/linux_xarray.c 
(from r364860, head/sys/compat/linuxkpi/common/src/linux_xarray.c)
==
--- head/sys/compat/linuxkpi/common/src/linux_xarray.c  Thu Aug 27 10:28:12 
2020(r364860, copy source)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_xarray.c Tue Nov 10 
13:13:37 2020(r367557)
@@ -79,7 +79,7 @@ static void
 xa_vm_wait_locked(struct xarray *xa)
 {
xa_unlock(xa);
-   vm_wait(NULL);
+   vm_wait();
xa_lock(xa);
 }
 

Modified: stable/11/sys/conf/files
==
--- stable/11/sys/conf/filesTue Nov 10 13:10:15 2020(r367556)
+++ stable/11/sys/conf/filesTue Nov 10 13:13:37 2020(r367557)
@@ -4332,6 +4332,8 @@ compat/linuxkpi/common/src/linux_usb.c
optional compa
compile-with "${LINUXKPI_C}"
 compat/linuxkpi/common/src/linux_work.coptional 
compat_linuxkpi \
compile-with "${LINUXKPI_C}"
+compat/linuxkpi/common/src/linux_xarray.c  optional compat_linuxkpi \
+   compile-with "${LINUXKPI_C}"
 
 # OpenFabrics Enterprise Distribution (Infiniband)
 ofed/drivers/infiniband/core/ib_addr.c optional ofed   \

Modified: stable/11/sys/modules/linuxkpi/Makefile
==
--- stable/11/sys/modules/linuxkpi/Makefile Tue Nov 10 13:10:15 2020
(r367556)
+++ stable/11/sys/modules/linuxkpi/Makefile Tue Nov 10 13:13:37 2020
(r367557)
@@ -17,7 +17,8 @@ SRCS= linux_compat.c \
linux_slab.c \
linux_tasklet.c \
linux_usb.c \
-   linux_work.c
+   linux_work.c \
+   linux_xarray.c
 
 SRCS+= ${LINUXKPI_GENSRCS}
 
___
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: r367556 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf modules/linuxkpi

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 13:10:15 2020
New Revision: 367556
URL: https://svnweb.freebsd.org/changeset/base/367556

Log:
  MFC r364860 and r366996:
  Implement extensible arrays API using the existing radix tree implementation
  in the LinuxKPI.
  
  Differential Revision:https://reviews.freebsd.org/D25101
  Reviewed by:  kib @
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Added:
  stable/12/sys/compat/linuxkpi/common/include/linux/xarray.h
 - copied, changed from r364860, 
head/sys/compat/linuxkpi/common/include/linux/xarray.h
  stable/12/sys/compat/linuxkpi/common/src/linux_xarray.c
 - copied unchanged from r364860, 
head/sys/compat/linuxkpi/common/src/linux_xarray.c
Modified:
  stable/12/sys/conf/files
  stable/12/sys/modules/linuxkpi/Makefile
Directory Properties:
  stable/12/   (props changed)

Copied and modified: 
stable/12/sys/compat/linuxkpi/common/include/linux/xarray.h (from r364860, 
head/sys/compat/linuxkpi/common/include/linux/xarray.h)
==
--- head/sys/compat/linuxkpi/common/include/linux/xarray.h  Thu Aug 27 
10:28:12 2020(r364860, copy source)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/xarray.h Tue Nov 10 
13:10:15 2020(r367556)
@@ -91,4 +91,10 @@ xa_err(void *ptr)
return (PTR_ERR_OR_ZERO(ptr));
 }
 
+static inline void
+xa_init(struct xarray *xa)
+{
+   xa_init_flags(xa, 0);
+}
+
 #endif /* _LINUX_XARRAY_H_ */

Copied: stable/12/sys/compat/linuxkpi/common/src/linux_xarray.c (from r364860, 
head/sys/compat/linuxkpi/common/src/linux_xarray.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_xarray.c Tue Nov 10 
13:10:15 2020(r367556, copy of r364860, 
head/sys/compat/linuxkpi/common/src/linux_xarray.c)
@@ -0,0 +1,391 @@
+/*-
+ * Copyright (c) 2020 Mellanox Technologies, Ltd.
+ * 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 unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+
+#include 
+
+/*
+ * This function removes the element at the given index and returns
+ * the pointer to the removed element, if any.
+ */
+void *
+__xa_erase(struct xarray *xa, uint32_t index)
+{
+   XA_ASSERT_LOCKED(xa);
+
+   return (radix_tree_delete(>root, index));
+}
+
+void *
+xa_erase(struct xarray *xa, uint32_t index)
+{
+   void *retval;
+
+   xa_lock(xa);
+   retval = __xa_erase(xa, index);
+   xa_unlock(xa);
+
+   return (retval);
+}
+
+/*
+ * This function returns the element pointer at the given index. A
+ * value of NULL is returned if the element does not exist.
+ */
+void *
+xa_load(struct xarray *xa, uint32_t index)
+{
+   void *retval;
+
+   xa_lock(xa);
+   retval = radix_tree_lookup(>root, index);
+   xa_unlock(xa);
+
+   return (retval);
+}
+
+/*
+ * This is an internal function used to sleep until more memory
+ * becomes available.
+ */
+static void
+xa_vm_wait_locked(struct xarray *xa)
+{
+   xa_unlock(xa);
+   vm_wait(NULL);
+   xa_lock(xa);
+}
+
+/*
+ * This function iterates the xarray until it finds a free slot where
+ * it can insert the element pointer to by "ptr". It starts at the
+ * index pointed to by "pindex" and updates this value at return. The
+ * "mask" argument defines the maximum index allowed, inclusivly, and
+ * must be a power of two minus one value. The "gfp" argument
+ * basically tells if we can wait for more memory to become available
+ * or not. This function returns zero upon success or a negative error
+ * code on failure. A typical error code 

svn commit: r367555 - head/sys/dev/mlx4/mlx4_ib

2020-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 12:58:25 2020
New Revision: 367555
URL: https://svnweb.freebsd.org/changeset/base/367555

Log:
  Include GID type when deleting GIDs from HW table under RoCE in mlx4ib.
  Refer to the Linux commit mentioned below for a more detailed description.
  
  Linux commit:
  a18177925c252da7801149abe217c05b80884798
  
  Requested by: Isilon
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c

Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cTue Nov 10 12:45:59 2020
(r367554)
+++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cTue Nov 10 12:58:25 2020
(r367555)
@@ -371,8 +371,13 @@ static int mlx4_ib_del_gid(struct ib_device *device,
if (!gids) {
ret = -ENOMEM;
} else {
-   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++)
-   memcpy([i].gid, 
_gid_table->gids[i].gid, sizeof(union ib_gid));
+   for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) {
+   memcpy([i].gid,
+  _gid_table->gids[i].gid,
+  sizeof(union ib_gid));
+   gids[i].gid_type =
+   port_gid_table->gids[i].gid_type;
+   }
}
}
spin_unlock_bh(>lock);
___
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: r367269 - head/sys/ofed/drivers/infiniband/core

2020-11-02 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov  2 10:44:29 2020
New Revision: 367269
URL: https://svnweb.freebsd.org/changeset/base/367269

Log:
  Fix for referencing file via its vnode in ibore.
  
  Use the native vnode lookup functions, instead of going via the LinuxKPI,
  because the file referenced is typically created outside the LinuxKPI, and
  the LinuxKPI's fdget() can only resolve file descriptor numbers which
  were created by itself.
  
  The vnode pointer is used as an identifier to identify XRCD handles which
  are sharing resources.
  
  This patch fixes the so-called XRCD support in ibcore for FreeBSD.
  Refer to ibv_open_xrcd(3) for more information how the file descriptor
  argument is used.
  
  Reviewed by:  kib@
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c   Mon Nov  2 
08:26:19 2020(r367268)
+++ head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c   Mon Nov  2 
10:44:29 2020(r367269)
@@ -666,11 +666,11 @@ err_put:
 struct xrcd_table_entry {
struct rb_node  node;
struct ib_xrcd *xrcd;
-   struct inode   *inode;
+   struct vnode   *vnode;
 };
 
 static int xrcd_table_insert(struct ib_uverbs_device *dev,
-   struct inode *inode,
+   struct vnode *vnode,
struct ib_xrcd *xrcd)
 {
struct xrcd_table_entry *entry, *scan;
@@ -682,15 +682,15 @@ static int xrcd_table_insert(struct ib_uverbs_device *
return -ENOMEM;
 
entry->xrcd  = xrcd;
-   entry->inode = inode;
+   entry->vnode = vnode;
 
while (*p) {
parent = *p;
scan = rb_entry(parent, struct xrcd_table_entry, node);
 
-   if (inode < scan->inode) {
+   if ((uintptr_t)vnode < (uintptr_t)scan->vnode) {
p = &(*p)->rb_left;
-   } else if (inode > scan->inode) {
+   } else if ((uintptr_t)vnode > (uintptr_t)scan->vnode) {
p = &(*p)->rb_right;
} else {
kfree(entry);
@@ -700,12 +700,12 @@ static int xrcd_table_insert(struct ib_uverbs_device *
 
rb_link_node(>node, parent, p);
rb_insert_color(>node, >xrcd_tree);
-   igrab(inode);
+   vrefact(vnode);
return 0;
 }
 
 static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev,
- struct inode *inode)
+ struct vnode *vnode)
 {
struct xrcd_table_entry *entry;
struct rb_node *p = dev->xrcd_tree.rb_node;
@@ -713,9 +713,9 @@ static struct xrcd_table_entry *xrcd_table_search(stru
while (p) {
entry = rb_entry(p, struct xrcd_table_entry, node);
 
-   if (inode < entry->inode)
+   if ((uintptr_t)vnode < (uintptr_t)entry->vnode)
p = p->rb_left;
-   else if (inode > entry->inode)
+   else if ((uintptr_t)vnode > (uintptr_t)entry->vnode)
p = p->rb_right;
else
return entry;
@@ -724,11 +724,11 @@ static struct xrcd_table_entry *xrcd_table_search(stru
return NULL;
 }
 
-static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode 
*inode)
+static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct vnode 
*vnode)
 {
struct xrcd_table_entry *entry;
 
-   entry = xrcd_table_search(dev, inode);
+   entry = xrcd_table_search(dev, vnode);
if (!entry)
return NULL;
 
@@ -736,13 +736,13 @@ static struct ib_xrcd *find_xrcd(struct ib_uverbs_devi
 }
 
 static void xrcd_table_delete(struct ib_uverbs_device *dev,
- struct inode *inode)
+ struct vnode *vnode)
 {
struct xrcd_table_entry *entry;
 
-   entry = xrcd_table_search(dev, inode);
+   entry = xrcd_table_search(dev, vnode);
if (entry) {
-   iput(inode);
+   vrele(vnode);
rb_erase(>node, >xrcd_tree);
kfree(entry);
}
@@ -758,8 +758,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil
struct ib_udata udata;
struct ib_uxrcd_object *obj;
struct ib_xrcd *xrcd = NULL;
-   struct fd   f = {NULL};
-   struct inode   *inode = NULL;
+   struct vnode   *vnode = NULL;
int ret = 0;
int new_xrcd = 0;
 
@@ -777,14 +776,11 @@ ssize_t 

svn commit: r367236 - in head: share/man/man4 sys/dev/usb sys/dev/usb/input

2020-10-31 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Oct 31 21:53:23 2020
New Revision: 367236
URL: https://svnweb.freebsd.org/changeset/base/367236

Log:
  Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).
  
  Submitted by: pedro martelletto 
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/share/man/man4/uhid.4
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_generic.h

Modified: head/share/man/man4/uhid.4
==
--- head/share/man/man4/uhid.4  Sat Oct 31 21:11:34 2020(r367235)
+++ head/share/man/man4/uhid.4  Sat Oct 31 21:53:23 2020(r367236)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 1, 2018
+.Dd Oct 31, 2020
 .Dt UHID 4
 .Os
 .Sh NAME
@@ -131,6 +131,11 @@ and the
 .Va ugd_maxlen
 fields.
 This call may fail if the device does not support this feature.
+.It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info"
+Returns information about the device, like USB vendor ID and USB product ID.
+This call will not issue any USB transactions.
+Also refer to
+.Xr ugen 4 .
 .El
 .Pp
 Use

Modified: head/sys/dev/usb/input/uhid.c
==
--- head/sys/dev/usb/input/uhid.c   Sat Oct 31 21:11:34 2020
(r367235)
+++ head/sys/dev/usb/input/uhid.c   Sat Oct 31 21:53:23 2020
(r367236)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #defineUSB_DEBUG_VAR uhid_debug
 #include 
@@ -144,11 +145,13 @@ static usb_fifo_cmd_t uhid_stop_write;
 static usb_fifo_open_t uhid_open;
 static usb_fifo_close_t uhid_close;
 static usb_fifo_ioctl_t uhid_ioctl;
+static usb_fifo_ioctl_t uhid_ioctl_post;
 
 static struct usb_fifo_methods uhid_fifo_methods = {
.f_open = _open,
.f_close = _close,
.f_ioctl = _ioctl,
+   .f_ioctl_post = _ioctl_post,
.f_start_read = _start_read,
.f_stop_read = _stop_read,
.f_start_write = _start_write,
@@ -642,6 +645,24 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *ad
 
case USB_GET_REPORT_ID:
*(int *)addr = 0;   /* XXX: we only support reportid 0? */
+   break;
+
+   default:
+   error = ENOIOCTL;
+   break;
+   }
+   return (error);
+}
+
+static int
+uhid_ioctl_post(struct usb_fifo *fifo, u_long cmd, void *addr,
+int fflags)
+{
+   int error;
+
+   switch (cmd) {
+   case USB_GET_DEVICEINFO:
+   error = ugen_fill_deviceinfo(fifo, addr);
break;
 
default:

Modified: head/sys/dev/usb/usb_generic.c
==
--- head/sys/dev/usb/usb_generic.c  Sat Oct 31 21:11:34 2020
(r367235)
+++ head/sys/dev/usb/usb_generic.c  Sat Oct 31 21:53:23 2020
(r367236)
@@ -109,8 +109,6 @@ static int  ugen_set_interface(struct usb_fifo *, uint8
 static int ugen_get_cdesc(struct usb_fifo *, struct usb_gen_descriptor *);
 static int ugen_get_sdesc(struct usb_fifo *, struct usb_gen_descriptor *);
 static int ugen_get_iface_driver(struct usb_fifo *f, struct 
usb_gen_descriptor *ugd);
-static int usb_gen_fill_deviceinfo(struct usb_fifo *,
-   struct usb_device_info *);
 static int ugen_re_enumerate(struct usb_fifo *);
 static int ugen_iface_ioctl(struct usb_fifo *, u_long, void *, int);
 static uint8_t ugen_fs_get_complete(struct usb_fifo *, uint8_t *);
@@ -814,7 +812,7 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g
 }
 
 /**
- * usb_gen_fill_deviceinfo
+ * ugen_fill_deviceinfo
  *
  * This function dumps information about an USB device to the
  * structure pointed to by the "di" argument.
@@ -823,8 +821,8 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_g
  *0: Success
  * Else: Failure
  **/
-static int
-usb_gen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
+int
+ugen_fill_deviceinfo(struct usb_fifo *f, struct usb_device_info *di)
 {
struct usb_device *udev;
struct usb_device *hub;
@@ -2205,7 +2203,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *
 
case USB_DEVICEINFO:
case USB_GET_DEVICEINFO:
-   error = usb_gen_fill_deviceinfo(f, addr);
+   error = ugen_fill_deviceinfo(f, addr);
break;
 
case USB_DEVICESTATS:

Modified: head/sys/dev/usb/usb_generic.h
==
--- head/sys/dev/usb/usb_generic.h  Sat Oct 31 21:11:34 2020
(r367235)
+++ head/sys/dev/usb/usb_generic.h  Sat Oct 31 21:53:23 2020
(r367236)
@@ -31,5 +31,6 @@
 
 extern 

svn commit: r367158 - stable/11/sys/fs/cuse

2020-10-30 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct 30 08:06:56 2020
New Revision: 367158
URL: https://svnweb.freebsd.org/changeset/base/367158

Log:
  MFC r366961:
  Fix for loading cuse.ko via rc.d . Make sure we declare the cuse(3)
  module by name and not only by the version information, so that
  "kldstat -q -m cuse" works.
  
  Found by: Goran Mekic 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

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

Modified: stable/11/sys/fs/cuse/cuse.c
==
--- stable/11/sys/fs/cuse/cuse.cFri Oct 30 08:05:47 2020
(r367157)
+++ stable/11/sys/fs/cuse/cuse.cFri Oct 30 08:06:56 2020
(r367158)
@@ -66,6 +66,24 @@
 #include 
 #include 
 
+static int
+cuse_modevent(module_t mod, int type, void *data)
+{
+   switch (type) {
+   case MOD_LOAD:
+   case MOD_UNLOAD:
+   return (0);
+   default:
+   return (EOPNOTSUPP);
+   }
+}
+
+static moduledata_t cuse_mod = {
+   .name = "cuse",
+   .evhand = _modevent,
+};
+
+DECLARE_MODULE(cuse, cuse_mod, SI_SUB_DEVFS, SI_ORDER_FIRST);
 MODULE_VERSION(cuse, 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: r367157 - stable/12/sys/fs/cuse

2020-10-30 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Oct 30 08:05:47 2020
New Revision: 367157
URL: https://svnweb.freebsd.org/changeset/base/367157

Log:
  MFC r366961:
  Fix for loading cuse.ko via rc.d . Make sure we declare the cuse(3)
  module by name and not only by the version information, so that
  "kldstat -q -m cuse" works.
  
  Found by: Goran Mekic 
  Sponsored by: Mellanox Technologies // NVIDIA Networking

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

Modified: stable/12/sys/fs/cuse/cuse.c
==
--- stable/12/sys/fs/cuse/cuse.cFri Oct 30 06:30:46 2020
(r367156)
+++ stable/12/sys/fs/cuse/cuse.cFri Oct 30 08:05:47 2020
(r367157)
@@ -64,6 +64,24 @@
 #include 
 #include 
 
+static int
+cuse_modevent(module_t mod, int type, void *data)
+{
+   switch (type) {
+   case MOD_LOAD:
+   case MOD_UNLOAD:
+   return (0);
+   default:
+   return (EOPNOTSUPP);
+   }
+}
+
+static moduledata_t cuse_mod = {
+   .name = "cuse",
+   .evhand = _modevent,
+};
+
+DECLARE_MODULE(cuse, cuse_mod, SI_SUB_DEVFS, SI_ORDER_FIRST);
 MODULE_VERSION(cuse, 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: r367096 - in head/sys/dev/usb: . serial

2020-10-28 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 28 08:22:38 2020
New Revision: 367096
URL: https://svnweb.freebsd.org/changeset/base/367096

Log:
  Add new USB IDs.
  
  Submitted by: aleksi.kaalin...@kapsi.fi
  PR:   250675
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Wed Oct 28 02:30:44 2020
(r367095)
+++ head/sys/dev/usb/serial/uftdi.c Wed Oct 28 08:22:38 2020
(r367096)
@@ -293,6 +293,8 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = {
UFTDI_DEV(BBELECTRONICS, USPTL4, 0),
UFTDI_DEV(BBELECTRONICS, USTL4, 0),
UFTDI_DEV(BBELECTRONICS, ZZ_PROG1_USB, 0),
+   UFTDI_DEV(BRAINBOXES, US257, 0),
+   UFTDI_DEV(BRAINBOXES, US25701, 0),
UFTDI_DEV(CONTEC, COM1USBH, 0),
UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 0),
UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsWed Oct 28 02:30:44 2020(r367095)
+++ head/sys/dev/usb/usbdevsWed Oct 28 08:22:38 2020(r367096)
@@ -1415,6 +1415,10 @@ product BILLIONTON USBEL100  0x0988  USB100EL
 product BILLIONTON USBE100 0x8511  USBE100
 product BILLIONTON USB2AR  0x90ff  USB2AR Ethernet
 
+/* Brainboxes Limited products */
+product BRAINBOXES US257   0x5001  US-257 USB2Serial 2xRS232
+product BRAINBOXES US25701 0x5002  US-25701 USB2Serial 2xRS232
+
 /* Broadcom products */
 product BROADCOM BCM2033   0x2033  BCM2033 Bluetooth USB dongle
 
___
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: r366996 - head/sys/compat/linuxkpi/common/include/linux

2020-10-24 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Oct 24 13:16:10 2020
New Revision: 366996
URL: https://svnweb.freebsd.org/changeset/base/366996

Log:
  Implement xa_init() in the LinuxKPI as a wrapper for xa_init_flags().
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/xarray.h

Modified: head/sys/compat/linuxkpi/common/include/linux/xarray.h
==
--- head/sys/compat/linuxkpi/common/include/linux/xarray.h  Sat Oct 24 
13:07:50 2020(r366995)
+++ head/sys/compat/linuxkpi/common/include/linux/xarray.h  Sat Oct 24 
13:16:10 2020(r366996)
@@ -91,4 +91,10 @@ xa_err(void *ptr)
return (PTR_ERR_OR_ZERO(ptr));
 }
 
+static inline void
+xa_init(struct xarray *xa)
+{
+   xa_init_flags(xa, 0);
+}
+
 #endif /* _LINUX_XARRAY_H_ */
___
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"


Re: svn commit: r366993 - head/sys/net

2020-10-24 Thread Hans Petter Selasky

On 2020-10-24 14:52, Alexey Dokuchaev wrote:

On Sat, Oct 24, 2020 at 10:23:22AM +, Hans Petter Selasky wrote:

New Revision: 366993
URL: https://svnweb.freebsd.org/changeset/base/366993

Log:
   Run code through "clang-format -style=file" with some additional fixes.
   No functional change.
   
...

@@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr,
  
  #ifdef INET6

  static inline void
-infiniband_ipv6_multicast_map(const struct in6_addr *addr,
-const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv6_multicast_map(
+const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf)
  {


This is not how we format these in FreeBSD, please revert.  It was correct
before and no "fix" is need here.


Done.

--HPS

___
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: r366995 - head/sys/net

2020-10-24 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Oct 24 13:07:50 2020
New Revision: 366995
URL: https://svnweb.freebsd.org/changeset/base/366995

Log:
  More style fixes (partial revert of r366994).
  
  Suggested by: danfe@
  Differential Revision:https://reviews.freebsd.org/D26254
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/net/if_infiniband.c

Modified: head/sys/net/if_infiniband.c
==
--- head/sys/net/if_infiniband.cSat Oct 24 10:52:09 2020
(r366994)
+++ head/sys/net/if_infiniband.cSat Oct 24 13:07:50 2020
(r366995)
@@ -64,8 +64,8 @@ struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *
 
 #ifdef INET
 static inline void
-infiniband_ipv4_multicast_map(
-uint32_t addr, const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv4_multicast_map(uint32_t addr,
+const uint8_t *broadcast, uint8_t *buf)
 {
uint8_t scope;
 
@@ -97,8 +97,8 @@ infiniband_ipv4_multicast_map(
 
 #ifdef INET6
 static inline void
-infiniband_ipv6_multicast_map(
-const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv6_multicast_map(const struct in6_addr *addr,
+const uint8_t *broadcast, uint8_t *buf)
 {
uint8_t scope;
 
@@ -408,8 +408,8 @@ done:
 }
 
 static int
-infiniband_resolvemulti(
-struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa)
+infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
+struct sockaddr *sa)
 {
struct sockaddr_dl *sdl;
 #ifdef INET
___
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"


Re: svn commit: r366993 - head/sys/net

2020-10-24 Thread Hans Petter Selasky

On 2020-10-24 12:46, Konstantin Belousov wrote:

sys/systm.h should come right after sys/param.h


OK, fixed.

--HPS
___
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: r366994 - head/sys/net

2020-10-24 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Oct 24 10:52:09 2020
New Revision: 366994
URL: https://svnweb.freebsd.org/changeset/base/366994

Log:
  Fix order of header files:
  sys/systm.h should come right after sys/param.h
  
  Suggested by: kib@
  Differential Revision:https://reviews.freebsd.org/D26254
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/net/if_infiniband.c

Modified: head/sys/net/if_infiniband.c
==
--- head/sys/net/if_infiniband.cSat Oct 24 10:23:21 2020
(r366993)
+++ head/sys/net/if_infiniband.cSat Oct 24 10:52:09 2020
(r366994)
@@ -30,6 +30,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,7 +38,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#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: r366993 - head/sys/net

2020-10-24 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Oct 24 10:23:21 2020
New Revision: 366993
URL: https://svnweb.freebsd.org/changeset/base/366993

Log:
  Run code through "clang-format -style=file" with some additional fixes.
  No functional change.
  
  Suggested by: kib@ and emaste@
  Differential Revision:https://reviews.freebsd.org/D26254
  MFC after:1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/net/if_infiniband.c

Modified: head/sys/net/if_infiniband.c
==
--- head/sys/net/if_infiniband.cSat Oct 24 05:52:29 2020
(r366992)
+++ head/sys/net/if_infiniband.cSat Oct 24 10:23:21 2020
(r366993)
@@ -30,44 +30,42 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
-#include 
-#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
+#include 
 
-#include 
-#include 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
-
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-
 #include 
 #include 
 
 #include 
 
 /* if_lagg(4) support */
-struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); 
+struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *);
 
 #ifdef INET
 static inline void
-infiniband_ipv4_multicast_map(uint32_t addr,
-const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv4_multicast_map(
+uint32_t addr, const uint8_t *broadcast, uint8_t *buf)
 {
uint8_t scope;
 
@@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr,
 
 #ifdef INET6
 static inline void
-infiniband_ipv6_multicast_map(const struct in6_addr *addr,
-const uint8_t *broadcast, uint8_t *buf)
+infiniband_ipv6_multicast_map(
+const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf)
 {
uint8_t scope;
 
@@ -128,7 +126,7 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb
 {
struct infiniband_header *ibh;
struct ether_header eh;
-  
+
if (mb->m_len < sizeof(*ibh))
return;
 
@@ -198,7 +196,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c
if (error) {
if (error == EWOULDBLOCK)
error = 0;
-   m = NULL;   /* mbuf is consumed by resolver 
*/
+   m = NULL; /* mbuf is consumed by resolver */
goto bad;
}
}
@@ -265,7 +263,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c
if (error) {
if (error == EWOULDBLOCK)
error = 0;
-   m = NULL;   /* mbuf is consumed by resolver 
*/
+   m = NULL; /* mbuf is consumed by resolver */
goto bad;
}
}
@@ -410,8 +408,8 @@ done:
 }
 
 static int
-infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
-struct sockaddr *sa)
+infiniband_resolvemulti(
+struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa)
 {
struct sockaddr_dl *sdl;
 #ifdef INET
@@ -442,8 +440,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock
sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND);
sdl->sdl_alen = INFINIBAND_ADDR_LEN;
e_addr = LLADDR(sdl);
-   infiniband_ipv4_multicast_map(sin->sin_addr.s_addr, 
ifp->if_broadcastaddr,
-   e_addr);
+   infiniband_ipv4_multicast_map(
+   sin->sin_addr.s_addr, ifp->if_broadcastaddr, e_addr);
*llsa = (struct sockaddr *)sdl;
return (0);
 #endif
@@ -462,7 +460,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock
sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND);
sdl->sdl_alen = INFINIBAND_ADDR_LEN;
e_addr = LLADDR(sdl);
-   infiniband_ipv6_multicast_map(>sin6_addr, 
ifp->if_broadcastaddr, e_addr);
+   infiniband_ipv6_multicast_map(
+   >sin6_addr, ifp->if_broadcastaddr, e_addr);
*llsa = (struct sockaddr *)sdl;
return (0);
 #endif
@@ -487,7 +486,7 @@ infiniband_ifattach(struct ifnet *ifp, const uint8_t *
ifp->if_resolvemulti = infiniband_resolvemulti;
 
if (ifp->if_baudrate == 0)
-   ifp->if_baudrate = IF_Gbps(10); /* default value */
+   ifp->if_baudrate = IF_Gbps(10); /* default value */
if (llb != NULL)
ifp->if_broadcastaddr = llb;
 
___
svn-src-all@freebsd.org mailing list

  1   2   3   4   5   6   7   8   9   10   >