svn commit: r279014 - stable/10/sys/ofed/drivers/net/mlx4

2015-02-19 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Feb 19 17:42:12 2015
New Revision: 279014
URL: https://svnweb.freebsd.org/changeset/base/279014

Log:
  MFC r278856:
  The frag_info pointer is already pointing to an array index.
  Don't index twice.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/net/mlx4/en_rx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Feb 19 17:03:13 2015
(r279013)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Feb 19 17:42:12 2015
(r279014)
@@ -492,7 +492,7 @@ static int mlx4_en_complete_rx_desc(stru
if (nr)
mb-m_next = mb_list[nr];
mb = mb_list[nr];
-   mb-m_len = frag_info[nr].frag_size;
+   mb-m_len = frag_info-frag_size;
dma = be64_to_cpu(rx_desc-data[nr].addr);
 
 /* Allocate a replacement page */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279693 - stable/10/sys/dev/usb/controller

2015-03-06 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Mar  6 16:08:10 2015
New Revision: 279693
URL: https://svnweb.freebsd.org/changeset/base/279693

Log:
  MFC r279563:
  Add quirk for USB 3.0 controllers which don't support 64-bit DMA.

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

Modified: stable/10/sys/dev/usb/controller/xhci_pci.c
==
--- stable/10/sys/dev/usb/controller/xhci_pci.c Fri Mar  6 16:08:03 2015
(r279692)
+++ stable/10/sys/dev/usb/controller/xhci_pci.c Fri Mar  6 16:08:10 2015
(r279693)
@@ -180,6 +180,7 @@ xhci_pci_attach(device_t self)
 {
struct xhci_softc *sc = device_get_softc(self);
int count, err, rid;
+   uint8_t usedma32;
 
rid = PCI_XHCI_CBMEM;
sc-sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, rid,
@@ -192,7 +193,17 @@ xhci_pci_attach(device_t self)
sc-sc_io_hdl = rman_get_bushandle(sc-sc_io_res);
sc-sc_io_size = rman_get_size(sc-sc_io_res);
 
-   if (xhci_init(sc, self, 0)) {
+   /* check for USB 3.0 controllers which don't support 64-bit DMA */
+   switch (pci_get_devid(self)) {
+   case 0x01941033:/* NEC uPD720200 USB 3.0 controller */
+   usedma32 = 1;
+   break;
+   default:
+   usedma32 = 0;
+   break;
+   }
+   
+   if (xhci_init(sc, self, usedma32)) {
device_printf(self, Could not initialize softc\n);
bus_release_resource(self, SYS_RES_MEMORY, PCI_XHCI_CBMEM,
sc-sc_io_res);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279732 - stable/10/sys/ofed/include/linux

2015-03-07 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Mar  7 18:39:15 2015
New Revision: 279732
URL: https://svnweb.freebsd.org/changeset/base/279732

Log:
  MFC r278866:
  Define standard formatting strings to print GIDs
  in a separate header file.
  
  Sponsored by: Mellanox Technologies

Added:
  stable/10/sys/ofed/include/linux/printk.h
 - copied unchanged from r278866, head/sys/ofed/include/linux/printk.h
Modified:
Directory Properties:
  stable/10/   (props changed)

Copied: stable/10/sys/ofed/include/linux/printk.h (from r278866, 
head/sys/ofed/include/linux/printk.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sys/ofed/include/linux/printk.h   Sat Mar  7 18:39:15 2015
(r279732, copy of r278866, head/sys/ofed/include/linux/printk.h)
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2010 Isilon Systems, Inc.
+ * Copyright (c) 2010 iX Systems, Inc.
+ * Copyright (c) 2010 Panasas, Inc.
+ * Copyright (c) 2013, 2014 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.
+ */
+
+#ifndef _FBSD_PRINTK_H_
+#define_FBSD_PRINTK_H_
+
+/* GID printing macros */
+#defineGID_PRINT_FMT   
%.4x:%.4x:%.4x:%.4x:%.4x:%.4x:%.4x:%.4x
+#defineGID_PRINT_ARGS(gid_raw) htons(((u16 *)gid_raw)[0]), 
htons(((u16 *)gid_raw)[1]),\
+   htons(((u16 *)gid_raw)[2]), htons(((u16 
*)gid_raw)[3]),\
+   htons(((u16 *)gid_raw)[4]), htons(((u16 
*)gid_raw)[5]),\
+   htons(((u16 *)gid_raw)[6]), htons(((u16 
*)gid_raw)[7])
+
+#endif /* _FBSD_PRINTK_H */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279737 - stable/10/sys/ofed/include/linux

2015-03-07 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Mar  7 18:48:00 2015
New Revision: 279737
URL: https://svnweb.freebsd.org/changeset/base/279737

Log:
  MFC r279587:
  Define PTR_ALIGN() macro which will be needed coming Mellanox driver
  releases.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/kernel.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/kernel.h
==
--- stable/10/sys/ofed/include/linux/kernel.h   Sat Mar  7 18:46:21 2015
(r279736)
+++ stable/10/sys/ofed/include/linux/kernel.h   Sat Mar  7 18:48:00 2015
(r279737)
@@ -63,6 +63,8 @@
 
 #undef ALIGN
 #defineALIGN(x, y) roundup2((x), (y))
+#undef PTR_ALIGN
+#definePTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), 
(a)))
 #defineDIV_ROUND_UPhowmany
 
 #defineprintk(X...)printf(X)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279731 - in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4

2015-03-07 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Mar  7 18:33:28 2015
New Revision: 279731
URL: https://svnweb.freebsd.org/changeset/base/279731

Log:
  MFC r279584:
  Updates for the Mellanox ethernet driver
  
   List of fixes:
* use correct format for GID printouts
* double array indexing
* spelling in printouts
* void pointer arithmetic
* allow more receive rings
* correct maximum number of transmit rings
* use const instead of static for constants
* check for invalid VLAN tags
* check for lack of IRQ resources
   Added more hardware specific defines
   Added more verbose printouts of firmware status codes
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/net/mlx4/cmd.c
  stable/10/sys/ofed/drivers/net/mlx4/en_main.c
  stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
  stable/10/sys/ofed/drivers/net/mlx4/en_rx.c
  stable/10/sys/ofed/drivers/net/mlx4/en_tx.c
  stable/10/sys/ofed/drivers/net/mlx4/main.c
  stable/10/sys/ofed/drivers/net/mlx4/mcg.c
  stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h
  stable/10/sys/ofed/include/linux/mlx4/device.h
  stable/10/sys/ofed/include/linux/mlx4/qp.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/net/mlx4/cmd.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/cmd.c   Sat Mar  7 18:33:08 2015
(r279730)
+++ stable/10/sys/ofed/drivers/net/mlx4/cmd.c   Sat Mar  7 18:33:28 2015
(r279731)
@@ -757,6 +757,19 @@ static int mlx4_cmd_wait(struct mlx4_dev
 in_mod=0x%x, op_mod=0x%x, fw status = 0x%x\n,
 cmd_to_str(op), op, (unsigned long long) in_param, 
in_modifier,
 op_modifier, context-fw_status);
+
+   switch(context-fw_status) {
+   case CMD_STAT_BAD_PARAM:
+   mlx4_err(dev, Parameter is not supported, 
+   parameter is out of range\n);
+   break;
+   case CMD_STAT_EXCEED_LIM:
+   mlx4_err(dev, Required capability exceeded 
+   device limits\n);
+   break;
+   default:
+   break;
+   }
goto out;
}
 

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_main.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_main.c   Sat Mar  7 18:33:08 
2015(r279730)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_main.c   Sat Mar  7 18:33:28 
2015(r279731)
@@ -239,8 +239,8 @@ static void *mlx4_en_add(struct mlx4_dev
 
DEF_RX_RINGS)));
} else {
mdev-profile.prof[i].rx_ring_num = 
rounddown_pow_of_two(
-   min_t(int, dev-caps.comp_pool/
- dev-caps.num_ports - 1 , MAX_MSIX_P_PORT 
- 1));
+   min_t(int, dev-caps.comp_pool /
+ dev-caps.num_ports, MAX_MSIX_P_PORT));
}
}
 

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Sat Mar  7 18:33:08 
2015(r279730)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Sat Mar  7 18:33:28 
2015(r279731)
@@ -1305,7 +1305,7 @@ int mlx4_en_start_port(struct net_device
cq = priv-tx_cq[i];
err = mlx4_en_activate_cq(priv, cq, i);
if (err) {
-   en_err(priv, Failed allocating Tx CQ\n);
+   en_err(priv, Failed activating Tx CQ\n);
goto tx_err;
}
err = mlx4_en_set_cq_moder(priv, cq);
@@ -1323,7 +1323,7 @@ int mlx4_en_start_port(struct net_device
err = mlx4_en_activate_tx_ring(priv, tx_ring, cq-mcq.cqn,
   i / priv-num_tx_rings_p_up);
if (err) {
-   en_err(priv, Failed allocating Tx ring\n);
+   en_err(priv, Failed activating Tx ring %d\n, i);
mlx4_en_deactivate_cq(priv, cq);
goto tx_err;
}
@@ -2189,6 +2189,7 @@ out:
mlx4_en_destroy_netdev(dev);
return err;
 }
+
 static int mlx4_en_set_ring_size(struct net_device *dev,
 int rx_size, int tx_size)
 {
@@ -2409,7 +2410,6 @@ static void mlx4_en_sysctl_conf(struct m
 Enable adaptive rx coalescing);
 }
 
-
 static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv)
 {
struct net_device *dev;

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c

svn commit: r279353 - stable/10/sys/dev/usb/controller

2015-02-27 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 27 12:20:03 2015
New Revision: 279353
URL: https://svnweb.freebsd.org/changeset/base/279353

Log:
  MFC r279233:
  Ensure that the XHCI driver will refresh the control endpoint settings
  when re-enumerating a FULL speed device. Else the wrong max packet
  setting might be used when trying to re-enumerate a FULL speed device.

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

Modified: stable/10/sys/dev/usb/controller/xhci.c
==
--- stable/10/sys/dev/usb/controller/xhci.c Fri Feb 27 11:13:46 2015
(r279352)
+++ stable/10/sys/dev/usb/controller/xhci.c Fri Feb 27 12:20:03 2015
(r279353)
@@ -1415,6 +1415,13 @@ xhci_set_address(struct usb_device *udev
 
pepext = xhci_get_endpoint_ext(udev,
udev-ctrl_ep_desc);
+
+   /* ensure the control endpoint is setup again */
+   USB_BUS_LOCK(udev-bus);
+   pepext-trb_halted = 1;
+   pepext-trb_running = 0;
+   USB_BUS_UNLOCK(udev-bus);
+
err = xhci_configure_endpoint(udev,
udev-ctrl_ep_desc, pepext,
0, 1, 1, 0, mps, mps, USB_EP_MODE_DEFAULT);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279644 - stable/10/sys/dev/usb/controller

2015-03-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar  5 10:04:34 2015
New Revision: 279644
URL: https://svnweb.freebsd.org/changeset/base/279644

Log:
  MFC r279210:
  Add support for the DWC OTG v2 chipset found in the STM32F4 series of
  processors. Make sure we pullup the data lines in device mode when we
  power on the port.

Modified:
  stable/10/sys/dev/usb/controller/dwc_otg.c
  stable/10/sys/dev/usb/controller/dwc_otgreg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Thu Mar  5 09:55:35 2015
(r279643)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Thu Mar  5 10:04:34 2015
(r279644)
@@ -108,13 +108,20 @@
GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTMSK_OTGINTMSK | \
GINTSTS_SESSREQINT)
 
-static int dwc_otg_use_hsic;
+#defineDWC_OTG_PHY_ULPI 0
+#defineDWC_OTG_PHY_HSIC 1
+#defineDWC_OTG_PHY_INTERNAL 2
 
-static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, USB DWC OTG);
+#ifndef DWC_OTG_PHY_DEFAULT
+#defineDWC_OTG_PHY_DEFAULT DWC_OTG_PHY_ULPI
+#endif
+
+static int dwc_otg_phy_type = DWC_OTG_PHY_DEFAULT;
 
-SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, use_hsic, CTLFLAG_RD | CTLFLAG_TUN,
-dwc_otg_use_hsic, 0, DWC OTG uses HSIC interface);
-TUNABLE_INT(hw.usb.dwc_otg.use_hsic, dwc_otg_use_hsic);
+static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, USB DWC OTG);
+SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN,
+dwc_otg_phy_type, 0, DWC OTG PHY TYPE - 0/1/2 - ULPI/HSIC/INTERNAL);
+TUNABLE_INT(hw.usb.dwc_otg.phy_type, dwc_otg_phy_type);
 
 #ifdef USB_DEBUG
 static int dwc_otg_debug;
@@ -3762,8 +3769,9 @@ dwc_otg_init(struct dwc_otg_softc *sc)
break;
}
 
-   /* select HSIC or non-HSIC mode */
-   if (dwc_otg_use_hsic) {
+   /* select HSIC, ULPI or internal PHY mode */
+   switch (dwc_otg_phy_type) {
+   case DWC_OTG_PHY_HSIC:
DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG,
GUSBCFG_PHYIF |
GUSBCFG_TRD_TIM_SET(5) | temp);
@@ -3775,7 +3783,8 @@ dwc_otg_init(struct dwc_otg_softc *sc)
temp  ~GLPMCFG_HSIC_CONN);
DWC_OTG_WRITE_4(sc, DOTG_GLPMCFG,
temp | GLPMCFG_HSIC_CONN);
-   } else {
+   break;
+   case DWC_OTG_PHY_ULPI:
DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG,
GUSBCFG_ULPI_UTMI_SEL |
GUSBCFG_TRD_TIM_SET(5) | temp);
@@ -3784,6 +3793,25 @@ dwc_otg_init(struct dwc_otg_softc *sc)
temp = DWC_OTG_READ_4(sc, DOTG_GLPMCFG);
DWC_OTG_WRITE_4(sc, DOTG_GLPMCFG,
temp  ~GLPMCFG_HSIC_CONN);
+   break;
+   case DWC_OTG_PHY_INTERNAL:
+   DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG,
+   GUSBCFG_PHYSEL |
+   GUSBCFG_TRD_TIM_SET(5) | temp);
+   DWC_OTG_WRITE_4(sc, DOTG_GOTGCTL, 0);
+
+   temp = DWC_OTG_READ_4(sc, DOTG_GLPMCFG);
+   DWC_OTG_WRITE_4(sc, DOTG_GLPMCFG,
+   temp  ~GLPMCFG_HSIC_CONN);
+
+   temp = DWC_OTG_READ_4(sc, DOTG_GGPIO);
+   temp = ~(DOTG_GGPIO_NOVBUSSENS | DOTG_GGPIO_I2CPADEN);
+   temp |= (DOTG_GGPIO_VBUSASEN | DOTG_GGPIO_VBUSBSEN |
+   DOTG_GGPIO_PWRDWN);
+   DWC_OTG_WRITE_4(sc, DOTG_GGPIO, temp);
+   break;
+   default:
+   break;
}
 
/* clear global nak */
@@ -3803,9 +3831,6 @@ dwc_otg_init(struct dwc_otg_softc *sc)
/* wait 10ms */
usb_pause_mtx(sc-sc_bus.bus_mtx, hz / 100);
 
-   /* pull up D+ */
-   dwc_otg_pull_up(sc);
-
temp = DWC_OTG_READ_4(sc, DOTG_GHWCFG3);
 
sc-sc_fifo_size = 4 * GHWCFG3_DFIFODEPTH_GET(temp);
@@ -4544,11 +4569,15 @@ tr_handle_set_port_feature:
/* nops */
break;
case UHF_PORT_POWER:
+   sc-sc_flags.port_powered = 1;
if (sc-sc_mode == DWC_MODE_HOST || sc-sc_mode == 
DWC_MODE_OTG) {
sc-sc_hprt_val |= HPRT_PRTPWR;
DWC_OTG_WRITE_4(sc, DOTG_HPRT, sc-sc_hprt_val);
}
-   sc-sc_flags.port_powered = 1;
+   if (sc-sc_mode == DWC_MODE_DEVICE || sc-sc_mode == 
DWC_MODE_OTG) {
+   /* pull up D+, if any */
+   dwc_otg_pull_up(sc);
+   }
break;
default:
err = USB_ERR_IOERROR;

Modified: stable/10/sys/dev/usb/controller/dwc_otgreg.h
==
--- stable/10/sys/dev/usb/controller/dwc_otgreg.h   Thu Mar  5 09:55:35 
2015(r279643)
+++ stable/10/sys/dev/usb/controller/dwc_otgreg.h   Thu Mar  5 10:04:34 
2015

svn commit: r279633 - stable/10/sys/sys

2015-03-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar  5 09:23:43 2015
New Revision: 279633
URL: https://svnweb.freebsd.org/changeset/base/279633

Log:
  MFC r279241 and r279242:
  Fix debugging macros.

Modified:
  stable/10/sys/sys/queue.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/queue.h
==
--- stable/10/sys/sys/queue.h   Thu Mar  5 09:01:46 2015(r279632)
+++ stable/10/sys/sys/queue.h   Thu Mar  5 09:23:43 2015(r279633)
@@ -116,7 +116,7 @@ struct qm_trace {
 };
 
 #defineTRACEBUFstruct qm_trace trace;
-#defineTRACEBUF_INITIALIZER{ __FILE__, __LINE__, NULL, 0 } ,
+#defineTRACEBUF_INITIALIZER{ __LINE__, 0, __FILE__, NULL } ,
 #defineTRASHIT(x)  do {(x) = (void *)-1;} while (0)
 #defineQMD_SAVELINK(name, link)void **name = (void *)(link)
 
@@ -612,7 +612,7 @@ struct {
\
TAILQ_NEXT((listelm), field) = (elm);   \
(elm)-field.tqe_prev = TAILQ_NEXT((listelm), field);  \
QMD_TRACE_ELEM((elm)-field);  \
-   QMD_TRACE_ELEM(listelm-field);\
+   QMD_TRACE_ELEM((listelm)-field);  \
 } while (0)
 
 #defineTAILQ_INSERT_BEFORE(listelm, elm, field) do {   
\
@@ -622,7 +622,7 @@ struct {
\
*(listelm)-field.tqe_prev = (elm); \
(listelm)-field.tqe_prev = TAILQ_NEXT((elm), field);  \
QMD_TRACE_ELEM((elm)-field);  \
-   QMD_TRACE_ELEM(listelm-field);\
+   QMD_TRACE_ELEM((listelm)-field);  \
 } while (0)
 
 #defineTAILQ_INSERT_HEAD(head, elm, field) do {
\
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279636 - stable/10/sys/dev/usb

2015-03-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar  5 09:31:36 2015
New Revision: 279636
URL: https://svnweb.freebsd.org/changeset/base/279636

Log:
  MFC r279270:
  Add ugen keyword to USB pnpinfo. Remove extra space from existing pnpinfo.
  
  PR:   198015
  PR:   198019
  PR:   198026

Modified:
  stable/10/sys/dev/usb/usb_hub.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_hub.c
==
--- stable/10/sys/dev/usb/usb_hub.c Thu Mar  5 09:29:05 2015
(r279635)
+++ stable/10/sys/dev/usb/usb_hub.c Thu Mar  5 09:31:36 2015
(r279636)
@@ -1694,11 +1694,19 @@ uhub_child_location_string(device_t pare
}
goto done;
}
-   snprintf(buf, buflen, bus=%u hubaddr=%u port=%u devaddr=%u 
interface=%u,
-   device_get_unit(res.udev-bus-bdev),
-   (res.udev-parent_hub != NULL) ? res.udev-parent_hub-device_index 
: 0,
-   res.portno,
-   res.udev-device_index, res.iface_index);
+   snprintf(buf, buflen, bus=%u hubaddr=%u port=%u devaddr=%u
+interface=%u
+#if USB_HAVE_UGEN
+ugen=%s
+#endif
+   , device_get_unit(res.udev-bus-bdev)
+   , (res.udev-parent_hub != NULL) ?
+   res.udev-parent_hub-device_index : 0
+   , res.portno, res.udev-device_index, res.iface_index
+#if USB_HAVE_UGEN
+   , res.udev-ugen_name
+#endif
+   );
 done:
mtx_unlock(Giant);
 
@@ -1740,7 +1748,7 @@ uhub_child_pnpinfo_string(device_t paren
release=0x%04x 
mode=%s 
intclass=0x%02x intsubclass=0x%02x 
-   intprotocol=0x%02x  %s%s,
+   intprotocol=0x%02x %s%s,
UGETW(res.udev-ddesc.idVendor),
UGETW(res.udev-ddesc.idProduct),
res.udev-ddesc.bDeviceClass,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279648 - stable/10/sys/dev/usb/controller

2015-03-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar  5 10:18:03 2015
New Revision: 279648
URL: https://svnweb.freebsd.org/changeset/base/279648

Log:
  MFC r279544:
  Add quirk to disable 64-bit XHCI DMA after r276717.
  
  Requested by: Gary Jennejohn gljennj...@gmail.com

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

Modified: stable/10/sys/dev/usb/controller/xhci.c
==
--- stable/10/sys/dev/usb/controller/xhci.c Thu Mar  5 10:12:28 2015
(r279647)
+++ stable/10/sys/dev/usb/controller/xhci.c Thu Mar  5 10:18:03 2015
(r279648)
@@ -98,18 +98,23 @@ TUNABLE_INT(hw.usb.xhci.streams, xhci
 static int xhcidebug;
 static int xhciroute;
 static int xhcipolling;
+static int xhcidma32;
 
 SYSCTL_INT(_hw_usb_xhci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN,
 xhcidebug, 0, Debug level);
 TUNABLE_INT(hw.usb.xhci.debug, xhcidebug);
 SYSCTL_INT(_hw_usb_xhci, OID_AUTO, xhci_port_route, CTLFLAG_RW | CTLFLAG_TUN,
-xhciroute, 0, Routing bitmap for switching EHCI ports to XHCI 
controller);
+xhciroute, 0, Routing bitmap for switching EHCI ports to the XHCI 
controller);
 TUNABLE_INT(hw.usb.xhci.xhci_port_route, xhciroute);
 SYSCTL_INT(_hw_usb_xhci, OID_AUTO, use_polling, CTLFLAG_RW | CTLFLAG_TUN,
-xhcipolling, 0, Set to enable software interrupt polling for XHCI 
controller);
+xhcipolling, 0, Set to enable software interrupt polling for the XHCI 
controller);
 TUNABLE_INT(hw.usb.xhci.use_polling, xhcipolling);
+SYSCTL_INT(_hw_usb_xhci, OID_AUTO, dma32, CTLFLAG_RWTUN,
+xhcidma32, 0, Set to only use 32-bit DMA for the XHCI controller);
+TUNABLE_INT(hw.usb.xhci.dma32, xhcidma32);
 #else
 #definexhciroute 0
+#definexhcidma32 0
 #endif
 
 #defineXHCI_INTR_ENDPT 1
@@ -580,7 +585,7 @@ xhci_halt_controller(struct xhci_softc *
 }
 
 usb_error_t
-xhci_init(struct xhci_softc *sc, device_t self)
+xhci_init(struct xhci_softc *sc, device_t self, uint8_t dma32)
 {
uint32_t temp;
 
@@ -627,7 +632,8 @@ xhci_init(struct xhci_softc *sc, device_
}
 
/* get DMA bits */
-   sc-sc_bus.dma_bits = XHCI_HCS0_AC64(temp) ? 64 : 32;
+   sc-sc_bus.dma_bits = (XHCI_HCS0_AC64(temp) 
+   xhcidma32 == 0  dma32 == 0) ? 64 : 32;
 
device_printf(self, %d bytes context size, %d-bit DMA\n,
sc-sc_ctx_is_64_byte ? 64 : 32, (int)sc-sc_bus.dma_bits);

Modified: stable/10/sys/dev/usb/controller/xhci.h
==
--- stable/10/sys/dev/usb/controller/xhci.h Thu Mar  5 10:12:28 2015
(r279647)
+++ stable/10/sys/dev/usb/controller/xhci.h Thu Mar  5 10:18:03 2015
(r279648)
@@ -522,7 +522,7 @@ struct xhci_softc {
 
 uint8_txhci_use_polling(void);
 usb_error_t xhci_halt_controller(struct xhci_softc *);
-usb_error_t xhci_init(struct xhci_softc *, device_t);
+usb_error_t xhci_init(struct xhci_softc *, device_t, uint8_t);
 usb_error_t xhci_start_controller(struct xhci_softc *);
 void   xhci_interrupt(struct xhci_softc *);
 void   xhci_uninit(struct xhci_softc *);

Modified: stable/10/sys/dev/usb/controller/xhci_pci.c
==
--- stable/10/sys/dev/usb/controller/xhci_pci.c Thu Mar  5 10:12:28 2015
(r279647)
+++ stable/10/sys/dev/usb/controller/xhci_pci.c Thu Mar  5 10:18:03 2015
(r279648)
@@ -192,7 +192,7 @@ xhci_pci_attach(device_t self)
sc-sc_io_hdl = rman_get_bushandle(sc-sc_io_res);
sc-sc_io_size = rman_get_size(sc-sc_io_res);
 
-   if (xhci_init(sc, self)) {
+   if (xhci_init(sc, self, 0)) {
device_printf(self, Could not initialize softc\n);
bus_release_resource(self, SYS_RES_MEMORY, PCI_XHCI_CBMEM,
sc-sc_io_res);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r279639 - stable/10/usr.bin/unifdef

2015-03-05 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar  5 09:39:29 2015
New Revision: 279639
URL: https://svnweb.freebsd.org/changeset/base/279639

Log:
  MFC r279297:
  Update to upstream version 2.10
  
  The most notable new feature is support for definition files.
  
  Obtained from:http://dotat.at/prog/unifdef

Modified:
  stable/10/usr.bin/unifdef/unifdef.1
  stable/10/usr.bin/unifdef/unifdef.c
  stable/10/usr.bin/unifdef/unifdef.h
  stable/10/usr.bin/unifdef/unifdefall.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/unifdef/unifdef.1
==
--- stable/10/usr.bin/unifdef/unifdef.1 Thu Mar  5 09:37:27 2015
(r279638)
+++ stable/10/usr.bin/unifdef/unifdef.1 Thu Mar  5 09:39:29 2015
(r279639)
@@ -31,7 +31,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 21, 2012
+.Dd January 7, 2014
 .Dt UNIFDEF 1 PRM
 .Os  
 .Sh NAME
@@ -44,6 +44,7 @@
 .Op Fl [i]D Ns Ar sym Ns Op = Ns Ar val
 .Op Fl [i]U Ns Ar sym
 .Ar ...
+.Op Fl f Ar defile
 .Op Fl x Bro Ar 012 Brc
 .Op Fl M Ar backext
 .Op Fl o Ar outfile
@@ -70,11 +71,17 @@ utility acts on
 .Ic #elif , #else ,
 and
 .Ic #endif
-lines.
-A directive is only processed
-if the symbols specified on the command line are sufficient to allow
-.Nm
-to get a definite value for its control expression.
+lines,
+using macros specified in
+.Fl D
+and
+.Fl U
+command line options or in
+.Fl f
+definitions files.
+A directive is processed
+if the macro specifications are sufficient to provide
+a definite value for its control expression.
 If the result is false,
 the directive and the following lines under its control are removed.
 If the result is true,
@@ -84,7 +91,7 @@ An
 or
 .Ic #ifndef
 directive is passed through unchanged
-if its controlling symbol is not specified on the command line.
+if its controlling macro is not specified.
 Any
 .Ic #if
 or
@@ -110,7 +117,7 @@ and
 .Ic #elif
 lines:
 integer constants,
-integer values of symbols defined on the command line,
+integer values of macros defined on the command line,
 the
 .Fn defined
 operator,
@@ -131,16 +138,42 @@ if either operand of
 .Ic ||
 is definitely true then the result is true.
 .Pp
-In most cases, the
+When evaluating an expression,
 .Nm
-utility does not distinguish between object-like macros
-(without arguments) and function-like arguments (with arguments).
-If a macro is not explicitly defined, or is defined with the
+does not expand macros first.
+The value of a macro must be a simple number,
+not an expression.
+A limited form of indirection is allowed,
+where one macro's value is the name of another.
+.Pp
+In most cases,
+.Nm
+does not distinguish between object-like macros
+(without arguments) and function-like macros (with arguments).
+A function-like macro invocation can appear in
+.Ic #if
+and
+.Ic #elif
+control expressions.
+If the macro is not explicitly defined,
+or is defined with the
 .Fl D
-flag on the command-line, its arguments are ignored.
+flag on the command-line,
+or with
+.Ic #define
+in a
+.Fl f
+definitions file,
+its arguments are ignored.
 If a macro is explicitly undefined on the command line with the
 .Fl U
-flag, it may not have any arguments since this leads to a syntax error.
+flag,
+or with
+.Ic #undef
+in a
+.Fl f
+definitions file,
+it may not have any arguments since this leads to a syntax error.
 .Pp
 The
 .Nm
@@ -161,7 +194,7 @@ It uses
 .Nm Fl s
 and
 .Nm cpp Fl dM
-to get lists of all the controlling symbols
+to get lists of all the controlling macros
 and their definitions (or lack thereof),
 then invokes
 .Nm
@@ -169,19 +202,15 @@ with appropriate arguments to process th
 .Sh OPTIONS
 .Bl -tag -width indent -compact
 .It Fl D Ns Ar sym Ns = Ns Ar val
-Specify that a symbol is defined to a given value
-which is used when evaluating
-.Ic #if
-and
-.Ic #elif
-control expressions.
+Specify that a macro is defined to a given value.
 .Pp
 .It Fl D Ns Ar sym
-Specify that a symbol is defined to the value 1.
+Specify that a macro is defined to the value 1.
 .Pp
 .It Fl U Ns Ar sym
-Specify that a symbol is undefined.
-If the same symbol appears in more than one argument,
+Specify that a macro is undefined.
+.Pp
+If the same macro appears in more than one argument,
 the last occurrence dominates.
 .Pp
 .It Fl iD Ns Ar sym Ns Op = Ns Ar val
@@ -193,9 +222,37 @@ are ignored within
 and
 .Ic #ifndef
 blocks
-controlled by symbols
+controlled by macros
 specified with these options.
 .Pp
+.It Fl f Ar defile
+The file
+.Ar defile
+contains
+.Ic #define
+and
+.Ic #undef
+preprocessor directives,
+which have the same effect as the corresponding
+.Fl D
+and
+.Fl U
+command-line arguments.
+You can have multiple
+.Fl f
+arguments and mix them with
+.Fl D
+and
+.Fl U
+arguments;
+later options override earlier ones.
+.Pp
+Each directive must be on a single line.
+Object-like macro definitions (without arguments)
+are set to the given value.
+Function-like macro definitions (with 

svn commit: r280552 - stable/10/sys/netinet

2015-03-25 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Mar 25 10:55:08 2015
New Revision: 280552
URL: https://svnweb.freebsd.org/changeset/base/280552

Log:
  MFC r279281:
  Fix a special case in ip_fragment() to produce a more sensible chain
  of packets. When the data payload length excluding any headers, of an
  outgoing IPv4 packet exceeds PAGE_SIZE bytes, a special case in
  ip_fragment() can kick in to optimise the outgoing payload(s). The
  code which was added in r98849 as part of zero copy socket support
  assumes that the beginning of any MTU sized payload is aligned to
  where a MBUF's m_data pointer points. This is not always the case
  and can sometimes cause large IPv4 packets, as part of ping replies,
  to be split more than needed.
  
  Instead of iterating the MBUFs to figure out how much data is in the
  current chain, use the value already in the m_pkthdr.len field of
  the first MBUF in the chain.
  
  Reviewed by:  ken @
  Differential Revision:https://reviews.freebsd.org/D1893
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/netinet/ip_output.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/ip_output.c
==
--- stable/10/sys/netinet/ip_output.c   Wed Mar 25 10:54:23 2015
(r280551)
+++ stable/10/sys/netinet/ip_output.c   Wed Mar 25 10:55:08 2015
(r280552)
@@ -752,10 +752,8 @@ ip_fragment(struct ip *ip, struct mbuf *
 * be less than the receiver's page size ?
 */
int newlen;
-   struct mbuf *m;
 
-   for (m = m0, off = 0; m  (off+m-m_len) = mtu; m = m-m_next)
-   off += m-m_len;
+   off = MIN(mtu, m0-m_pkthdr.len);
 
/*
 * firstlen (off - hlen) must be aligned on an 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r280546 - in stable/10/contrib/ofed: libibverbs/examples/build librdmacm/examples/build

2015-03-25 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Mar 25 10:50:13 2015
New Revision: 280546
URL: https://svnweb.freebsd.org/changeset/base/280546

Log:
  MFC r280264:
  Define BINDIR for some test utilities.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/contrib/ofed/libibverbs/examples/build/Makefile.inc
  stable/10/contrib/ofed/librdmacm/examples/build/Makefile.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/ofed/libibverbs/examples/build/Makefile.inc
==
--- stable/10/contrib/ofed/libibverbs/examples/build/Makefile.inc   Wed Mar 
25 10:49:45 2015(r280545)
+++ stable/10/contrib/ofed/libibverbs/examples/build/Makefile.inc   Wed Mar 
25 10:50:13 2015(r280546)
@@ -1,3 +1,5 @@
+BINDIR?= /usr/bin
+
 CFLAGS+= \
-I../../../../../../sys/ofed/include \
-I../../../../libibverbs/include \

Modified: stable/10/contrib/ofed/librdmacm/examples/build/Makefile.inc
==
--- stable/10/contrib/ofed/librdmacm/examples/build/Makefile.incWed Mar 
25 10:49:45 2015(r280545)
+++ stable/10/contrib/ofed/librdmacm/examples/build/Makefile.incWed Mar 
25 10:50:13 2015(r280546)
@@ -1,3 +1,5 @@
+BINDIR?= /usr/bin
+
 IBDIR=../../../..
 
 CFLAGS+= \
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r282512 - stable/10/sys/cam/scsi

2015-05-05 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May  5 20:04:01 2015
New Revision: 282512
URL: https://svnweb.freebsd.org/changeset/base/282512

Log:
  MFC r280597:
  Add DA_Q_NO_RC16 quirk for USB mass storage device.
  
  PR:   198647

Modified:
  stable/10/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_da.c
==
--- stable/10/sys/cam/scsi/scsi_da.cTue May  5 20:01:28 2015
(r282511)
+++ stable/10/sys/cam/scsi/scsi_da.cTue May  5 20:04:01 2015
(r282512)
@@ -1175,6 +1175,13 @@ static struct da_quirk_entry da_quirk_ta
{ T_DIRECT, SIP_MEDIA_FIXED, ATA, SG9XCS2D*, * },
/*quirks*/DA_Q_4K
},
+   {
+   /*
+* MX-ES USB Drive by Mach Xtreme
+*/
+   { T_DIRECT, SIP_MEDIA_REMOVABLE, MX, MXUB3SES*, *},
+   /*quirks*/DA_Q_NO_RC16
+   },
 };
 
 static disk_strategy_t dastrategy;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r282509 - stable/10/sys/dev/usb

2015-05-05 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May  5 19:59:15 2015
New Revision: 282509
URL: https://svnweb.freebsd.org/changeset/base/282509

Log:
  MFC r280598:
  Add definition of the ISOCHRONOUS endpoint usage bits.
  Refer to the USB v2.0 specification for more information.

Modified:
  stable/10/sys/dev/usb/usb.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb.h
==
--- stable/10/sys/dev/usb/usb.h Tue May  5 19:56:23 2015(r282508)
+++ stable/10/sys/dev/usb/usb.h Tue May  5 19:59:15 2015(r282509)
@@ -542,6 +542,11 @@ struct usb_endpoint_descriptor {
 #defineUE_ISO_ADAPT0x08
 #defineUE_ISO_SYNC 0x0c
 #defineUE_GET_ISO_TYPE(a)  ((a)  UE_ISO_TYPE)
+#defineUE_ISO_USAGE0x30
+#defineUE_ISO_USAGE_DATA   0x00
+#defineUE_ISO_USAGE_FEEDBACK   0x10
+#defineUE_ISO_USAGE_IMPLICT_FB 0x20
+#defineUE_GET_ISO_USAGE(a) ((a)  UE_ISO_USAGE)
uWord   wMaxPacketSize;
 #defineUE_ZERO_MPS 0x  /* for internal use only */
uByte   bInterval;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r282513 - in stable/10/sys/ofed/include: linux net

2015-05-05 Thread Hans Petter Selasky
Author: hselasky
Date: Tue May  5 20:58:12 2015
New Revision: 282513
URL: https://svnweb.freebsd.org/changeset/base/282513

Log:
  MFC r277396, r278681, r278865, r278924, r279205, r280208,
r280210, r280764 and r280768:
  
  Update the Linux compatibility layer:
  - Add more functions.
  - Add some missing includes which are needed when the header files
are not included in a particular order.
  - The kasprintf() function cannot be inlined due to using a variable
number of arguments. Move it to a C-file.
  - Fix problems about 32-bit ticks wraparound and unsigned long
conversion. Jiffies or ticks in FreeBSD have integer type and are
not long.
  - Add missing order_base_2() macro.
  - Fix BUILD_BUG_ON() macro.
  - Declare a missing symbol which is needed when compiling without -O2
  - Clean up header file inclusions in the linux/completion.h, linux/in.h
and linux/fs.h header files.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/bitops.h
  stable/10/sys/ofed/include/linux/cache.h
  stable/10/sys/ofed/include/linux/completion.h
  stable/10/sys/ofed/include/linux/device.h
  stable/10/sys/ofed/include/linux/dma-mapping.h
  stable/10/sys/ofed/include/linux/etherdevice.h
  stable/10/sys/ofed/include/linux/fs.h
  stable/10/sys/ofed/include/linux/gfp.h
  stable/10/sys/ofed/include/linux/in.h
  stable/10/sys/ofed/include/linux/io.h
  stable/10/sys/ofed/include/linux/jiffies.h
  stable/10/sys/ofed/include/linux/kernel.h
  stable/10/sys/ofed/include/linux/kref.h
  stable/10/sys/ofed/include/linux/ktime.h
  stable/10/sys/ofed/include/linux/linux_compat.c
  stable/10/sys/ofed/include/linux/log2.h
  stable/10/sys/ofed/include/linux/pci.h
  stable/10/sys/ofed/include/linux/slab.h
  stable/10/sys/ofed/include/linux/timer.h
  stable/10/sys/ofed/include/net/ip.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/bitops.h
==
--- stable/10/sys/ofed/include/linux/bitops.h   Tue May  5 20:04:01 2015
(r282512)
+++ stable/10/sys/ofed/include/linux/bitops.h   Tue May  5 20:58:12 2015
(r282513)
@@ -288,9 +288,15 @@ bitmap_empty(unsigned long *addr, int si
 
 #defineNBLONG  (NBBY * sizeof(long))
 
+#define__set_bit(i, a) 
\
+atomic_set_long(((volatile long *)(a))[(i)/NBLONG], 1UL  ((i) % NBLONG))
+
 #defineset_bit(i, a)   
\
 atomic_set_long(((volatile long *)(a))[(i)/NBLONG], 1UL  ((i) % NBLONG))
 
+#define__clear_bit(i, a)   
\
+atomic_clear_long(((volatile long *)(a))[(i)/NBLONG], 1UL  ((i) % 
NBLONG))
+
 #defineclear_bit(i, a) 
\
 atomic_clear_long(((volatile long *)(a))[(i)/NBLONG], 1UL  ((i) % 
NBLONG))
 

Modified: stable/10/sys/ofed/include/linux/cache.h
==
--- stable/10/sys/ofed/include/linux/cache.hTue May  5 20:04:01 2015
(r282512)
+++ stable/10/sys/ofed/include/linux/cache.hTue May  5 20:58:12 2015
(r282513)
@@ -30,8 +30,7 @@
 #ifndef_LINUX_CACHE_H_
 #define _LINUX_CACHE_H_
 
-
 #definecache_line_size()   CACHE_LINE_SIZE
-
+#defineL1_CACHE_BYTES  CACHE_LINE_SIZE
 
 #endif /* _LINUX_CACHE_H_ */

Modified: stable/10/sys/ofed/include/linux/completion.h
==
--- stable/10/sys/ofed/include/linux/completion.h   Tue May  5 20:04:01 
2015(r282512)
+++ stable/10/sys/ofed/include/linux/completion.h   Tue May  5 20:58:12 
2015(r282513)
@@ -32,124 +32,35 @@
 
 #include linux/errno.h
 
-#include sys/param.h
-#include sys/systm.h
-#include sys/sleepqueue.h
-#include sys/kernel.h
-#include sys/proc.h
-
 struct completion {
unsigned int done;
 };
 
-#defineINIT_COMPLETION(c)  ((c).done = 0)
-#defineinit_completion(c)  ((c)-done = 0)
-
-static inline void
-_complete_common(struct completion *c, int all)
-{
-   int wakeup_swapper;
-
-   sleepq_lock(c);
-   c-done++;
-   if (all)
-   wakeup_swapper = sleepq_broadcast(c, SLEEPQ_SLEEP, 0, 0);
-   else
-   wakeup_swapper = sleepq_signal(c, SLEEPQ_SLEEP, 0, 0);
-   sleepq_release(c);
-   if (wakeup_swapper)
-   kick_proc0();
-}
-
-#definecomplete(c) _complete_common(c, 0)
-#definecomplete_all(c) _complete_common(c, 1)
-
-/*
- * Indefinite wait for done != 0 with or without signals.
- */
-static inline long
-_wait_for_common(struct completion *c, int flags)
-{
-
-   flags |= SLEEPQ_SLEEP;
-   for (;;) {
-   sleepq_lock(c);
-   if (c-done)
-   break;
-   

svn commit: r283193 - in stable/10/sys/dev/usb: . serial

2015-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 21 07:49:44 2015
New Revision: 283193
URL: https://svnweb.freebsd.org/changeset/base/283193

Log:
  MFC r282505:
  Add new USB ID.
  
  PR:   199843

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

Modified: stable/10/sys/dev/usb/serial/uftdi.c
==
--- stable/10/sys/dev/usb/serial/uftdi.cThu May 21 07:48:06 2015
(r283192)
+++ stable/10/sys/dev/usb/serial/uftdi.cThu May 21 07:49:44 2015
(r283193)
@@ -497,6 +497,7 @@ static const STRUCT_USB_HOST_ID uftdi_de
UFTDI_DEV(FTDI, SCS_DEVICE_5, 0),
UFTDI_DEV(FTDI, SCS_DEVICE_6, 0),
UFTDI_DEV(FTDI, SCS_DEVICE_7, 0),
+   UFTDI_DEV(FTDI, SCX8_USB_PHOENIX, 0),
UFTDI_DEV(FTDI, SDMUSBQSS, 0),
UFTDI_DEV(FTDI, SEMC_DSS20, 0),
UFTDI_DEV(FTDI, SERIAL_2232C, UFTDI_JTAG_CHECK_STRING),

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Thu May 21 07:48:06 2015
(r283192)
+++ stable/10/sys/dev/usb/usbdevs   Thu May 21 07:49:44 2015
(r283193)
@@ -1851,6 +1851,7 @@ product FREECOM HDD   0xfc05  Classic SL H
 product FSC E5400  0x1009  PrismGT USB 2.0 WLAN
 
 /* Future Technology Devices products */
+product FTDI SCX8_USB_PHOENIX  0x5259  SCx8 USB Phoenix interface
 product FTDI SERIAL_8U100AX0x8372  8U100AX Serial
 product FTDI SERIAL_8U232AM0x6001  8U232AM Serial
 product FTDI SERIAL_8U232AM4   0x6004  8U232AM Serial
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r283192 - stable/10/sys/dev/sound/pcm

2015-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 21 07:48:06 2015
New Revision: 283192
URL: https://svnweb.freebsd.org/changeset/base/283192

Log:
  MFC r282017:
  Allow DSP basename cloning to be disabled or enabled at boot and
  runtime. This is useful when implementing OSS sound stacks in
  userspace via libcuse for example.

Modified:
  stable/10/sys/dev/sound/pcm/dsp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/pcm/dsp.c
==
--- stable/10/sys/dev/sound/pcm/dsp.c   Thu May 21 07:46:01 2015
(r283191)
+++ stable/10/sys/dev/sound/pcm/dsp.c   Thu May 21 07:48:06 2015
(r283192)
@@ -48,6 +48,12 @@ SYSCTL_INT(_hw_snd, OID_AUTO, compat_lin
 dsp_mmap_allow_prot_exec, 0,
 linux mmap compatibility (-1=force disable 0=auto 1=force enable));
 
+static int dsp_basename_clone = 1;
+SYSCTL_INT(_hw_snd, OID_AUTO, basename_clone, CTLFLAG_RWTUN,
+dsp_basename_clone, 0,
+DSP basename cloning (0: Disable; 1: Enabled));
+TUNABLE_INT(hw.snd.basename_clone, dsp_basename_clone);
+
 struct dsp_cdevinfo {
struct pcm_channel *rdch, *wrch;
struct pcm_channel *volch;
@@ -2359,9 +2365,10 @@ dsp_clone(void *arg,
devname = devcmp;
devhw = dsp_cdevs[i].hw;
devcmax = dsp_cdevs[i].max - 1;
-   if (strcmp(name, devcmp) == 0)
-   unit = snd_unit;
-   else if (dsp_stdclone(name, devcmp, devsep,
+   if (strcmp(name, devcmp) == 0) {
+   if (dsp_basename_clone != 0)
+   unit = snd_unit;
+   } else if (dsp_stdclone(name, devcmp, devsep,
dsp_cdevs[i].use_sep, unit, cunit) != 0) {
unit = -1;
cunit = -1;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r283173 - in stable/10: share/man/man4 sys/dev/usb sys/dev/usb/quirk

2015-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 21 06:47:20 2015
New Revision: 283173
URL: https://svnweb.freebsd.org/changeset/base/283173

Log:
  MFC r282577:
  Add support for DYMO LabelWriter PnP.

Modified:
  stable/10/share/man/man4/usb_quirk.4
  stable/10/sys/dev/usb/quirk/usb_quirk.c
  stable/10/sys/dev/usb/quirk/usb_quirk.h
  stable/10/sys/dev/usb/usb_device.c
  stable/10/sys/dev/usb/usb_msctest.c
  stable/10/sys/dev/usb/usb_msctest.h
  stable/10/sys/dev/usb/usbdevs
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/usb_quirk.4
==
--- stable/10/share/man/man4/usb_quirk.4Thu May 21 06:34:06 2015
(r283172)
+++ stable/10/share/man/man4/usb_quirk.4Thu May 21 06:47:20 2015
(r283173)
@@ -16,7 +16,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd April 21, 2013
+.Dd May 7, 2015
 .Dt USB_QUIRK 4
 .Os
 .Sh NAME
@@ -170,6 +170,9 @@ ejects after Huawei SCSI command
 .It UQ_MSC_EJECT_TCT
 ejects after TCT SCSI command
 .Dv 0x06f504025270
+.It UQ_MSC_DYMO_EJECT
+ejects after HID command
+.Dv 0x1b5a01
 .El
 .Pp
 See

Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/10/sys/dev/usb/quirk/usb_quirk.c Thu May 21 06:34:06 2015
(r283172)
+++ stable/10/sys/dev/usb/quirk/usb_quirk.c Thu May 21 06:47:20 2015
(r283173)
@@ -523,6 +523,9 @@ static struct usb_quirk_entry usb_quirks
USB_QUIRK(FEIYA, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MATCH_VENDOR_ONLY),
USB_QUIRK(REALTEK, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MATCH_VENDOR_ONLY),
USB_QUIRK(INITIO, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MATCH_VENDOR_ONLY),
+
+   /* DYMO LabelManager Pnp */
+   USB_QUIRK(DYMO, LABELMANAGERPNP, 0x, 0x, UQ_MSC_DYMO_EJECT),
 };
 #undef USB_QUIRK_VP
 #undef USB_QUIRK
@@ -592,6 +595,7 @@ static const char *usb_quirk_str[USB_QUI
[UQ_BAD_MIDI]   = UQ_BAD_MIDI,
[UQ_AU_VENDOR_CLASS]= UQ_AU_VENDOR_CLASS,
[UQ_SINGLE_CMD_MIDI]= UQ_SINGLE_CMD_MIDI,
+   [UQ_MSC_DYMO_EJECT] = UQ_MSC_DYMO_EJECT,
 };
 
 /**

Modified: stable/10/sys/dev/usb/quirk/usb_quirk.h
==
--- stable/10/sys/dev/usb/quirk/usb_quirk.h Thu May 21 06:34:06 2015
(r283172)
+++ stable/10/sys/dev/usb/quirk/usb_quirk.h Thu May 21 06:47:20 2015
(r283173)
@@ -108,6 +108,7 @@ enum {
UQ_BAD_MIDI,/* device claims MIDI class, but isn't */
UQ_AU_VENDOR_CLASS, /* audio device uses vendor and not audio class 
*/
UQ_SINGLE_CMD_MIDI, /* at most one command per USB packet */
+   UQ_MSC_DYMO_EJECT,  /* ejects Dymo MSC device */
 
USB_QUIRK_MAX
 };

Modified: stable/10/sys/dev/usb/usb_device.c
==
--- stable/10/sys/dev/usb/usb_device.c  Thu May 21 06:34:06 2015
(r283172)
+++ stable/10/sys/dev/usb/usb_device.c  Thu May 21 06:47:20 2015
(r283173)
@@ -1346,6 +1346,12 @@ usb_probe_and_attach(struct usb_device *
 */
if (iface_index == USB_IFACE_INDEX_ANY) {
 
+   if (usb_test_quirk(uaa, UQ_MSC_DYMO_EJECT) != 0 
+   usb_dymo_eject(udev, 0) == 0) {
+   /* success, mark the udev as disappearing */
+   uaa.dev_state = UAA_DEV_EJECTING;
+   }
+
EVENTHANDLER_INVOKE(usb_dev_configured, udev, uaa);
 
if (uaa.dev_state != UAA_DEV_READY) {

Modified: stable/10/sys/dev/usb/usb_msctest.c
==
--- stable/10/sys/dev/usb/usb_msctest.c Thu May 21 06:34:06 2015
(r283172)
+++ stable/10/sys/dev/usb/usb_msctest.c Thu May 21 06:47:20 2015
(r283173)
@@ -177,6 +177,7 @@ static usb_callback_t bbb_data_rd_cs_cal
 static usb_callback_t bbb_data_write_callback;
 static usb_callback_t bbb_data_wr_cs_callback;
 static usb_callback_t bbb_status_callback;
+static usb_callback_t bbb_raw_write_callback;
 
 static voidbbb_done(struct bbb_transfer *, int);
 static voidbbb_transfer_start(struct bbb_transfer *, uint8_t);
@@ -184,7 +185,7 @@ static void bbb_data_clear_stall_callbac
uint8_t);
 static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t,
void *, size_t, void *, size_t, usb_timeout_t);
-static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t);
+static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t, uint8_t);
 static voidbbb_detach(struct bbb_transfer *);
 
 static const struct usb_config bbb_config[ST_MAX] = {
@@ -247,6 +248,19 @@ static const 

svn commit: r283175 - stable/10/sys/ofed/drivers/net/mlx4

2015-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 21 06:56:35 2015
New Revision: 283175
URL: https://svnweb.freebsd.org/changeset/base/283175

Log:
  MFC r282817:
  Apply proper locking when iterating the multicast addresses and add a
  missing check for NULL from a non-blocking kzalloc() function call.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Thu May 21 06:53:55 
2015(r283174)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Thu May 21 06:56:35 
2015(r283175)
@@ -650,6 +650,7 @@ static void mlx4_en_cache_mclist(struct 
struct mlx4_en_mc_list *tmp;
struct mlx4_en_priv *priv = netdev_priv(dev);
 
+if_maddr_rlock(dev);
 TAILQ_FOREACH(ifma, dev-if_multiaddrs, ifma_link) {
 if (ifma-ifma_addr-sa_family != AF_LINK)
 continue;
@@ -658,10 +659,13 @@ static void mlx4_en_cache_mclist(struct 
 continue;
 /* Make sure the list didn't grow. */
tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC);
+   if (tmp == NULL)
+   break;
memcpy(tmp-addr,
LLADDR((struct sockaddr_dl *)ifma-ifma_addr), 
ETH_ALEN);
list_add_tail(tmp-list, priv-mc_list);
 }
+if_maddr_runlock(dev);
 }
 
 static void update_mclist_flags(struct mlx4_en_priv *priv,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r283185 - stable/10/sys/dev/sound/usb

2015-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 21 07:10:49 2015
New Revision: 283185
URL: https://svnweb.freebsd.org/changeset/base/283185

Log:
  MFC r282652:
  Ensure the USB audio driver doesn't attach twice on the same USB
  device by grabbing all the USB audio device interfaces.

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cThu May 21 07:09:19 2015
(r283184)
+++ stable/10/sys/dev/sound/usb/uaudio.cThu May 21 07:10:49 2015
(r283185)
@@ -1574,6 +1574,19 @@ uaudio_chan_fill_info_sub(struct uaudio_
asf1d.v1 = NULL;
ed1 = NULL;
sed.v1 = NULL;
+
+   /*
+* There can only be one USB audio instance
+* per USB device. Grab all USB audio
+* interfaces on this USB device so that we
+* don't attach USB audio twice:
+*/
+   if (alt_index == 0  curidx != 
sc-sc_mixer_iface_index 
+   (id-bInterfaceClass == UICLASS_AUDIO || audio_if 
!= 0 ||
+   midi_if != 0)) {
+   usbd_set_parent_iface(sc-sc_udev, curidx,
+   sc-sc_mixer_iface_index);
+   }
}
 
if (audio_if == 0) {
@@ -1809,9 +1822,6 @@ uaudio_chan_fill_info_sub(struct uaudio_
chan_alt-iface_index = curidx;
chan_alt-iface_alt_index = alt_index;
 
-   usbd_set_parent_iface(sc-sc_udev, curidx,
-   sc-sc_mixer_iface_index);
-
if (ep_dir == UE_DIR_IN)
chan_alt-usb_cfg = uaudio_cfg_record;
else
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r283187 - stable/10/sys/dev/vt

2015-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 21 07:34:08 2015
New Revision: 283187
URL: https://svnweb.freebsd.org/changeset/base/283187

Log:
  MFC r282645, r282646 and r282730:
  * Prevent switching to NULL or own window in the vt_proc_window_switch
function. This fixes an issue where X11 keyboard input can appear
stuck. The cause of the problem is a duplicate TTY device window
switch IOCTL during boot, which leaves the vt_switch_timer running,
because the current window is already selected. While at it factor out
some NULL checks.
  * The SYSCTL_INT() default value is only used for read only SYSCTLs
and is not applicable unless the integer pointer is NULL. Set it to
zero to avoid confusion. While at it remove extra semicolon at the end
of the VT_SYSCTL_INT() macro.
  * Ensure the result from signed subtraction under modulus does not
become negative.
  
  PR:   200032

Modified:
  stable/10/sys/dev/vt/vt.h
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/vt.h
==
--- stable/10/sys/dev/vt/vt.h   Thu May 21 07:23:50 2015(r283186)
+++ stable/10/sys/dev/vt/vt.h   Thu May 21 07:34:08 2015(r283187)
@@ -83,10 +83,10 @@
 #defineISSIGVALID(sig) ((sig)  0  (sig)  NSIG)
 
 #defineVT_SYSCTL_INT(_name, _default, _descr)  
\
-static int vt_##_name = _default;  \
-SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RW, vt_##_name, _default,\
+static int vt_##_name = (_default);\
+SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, vt_##_name, 0,   \
_descr);\
-TUNABLE_INT(kern.vt. #_name, vt_##_name);
+TUNABLE_INT(kern.vt. #_name, vt_##_name)
 
 struct vt_driver;
 

Modified: stable/10/sys/dev/vt/vt_core.c
==
--- stable/10/sys/dev/vt/vt_core.c  Thu May 21 07:23:50 2015
(r283186)
+++ stable/10/sys/dev/vt/vt_core.c  Thu May 21 07:34:08 2015
(r283187)
@@ -448,12 +448,35 @@ vt_proc_window_switch(struct vt_window *
struct vt_device *vd;
int ret;
 
+   /* Prevent switching to NULL */
+   if (vw == NULL) {
+   DPRINTF(30, %s: Cannot switch: vw is NULL., __func__);
+   return (EINVAL);
+   }
vd = vw-vw_device;
curvw = vd-vd_curwindow;
 
+   /* Check if virtual terminal is locked */
if (curvw-vw_flags  VWF_VTYLOCK)
return (EBUSY);
 
+   /* Check if switch already in progress */
+   if (curvw-vw_flags  VWF_SWWAIT_REL) {
+   /* Check if switching to same window */
+   if (curvw-vw_switch_to == vw) {
+   DPRINTF(30, %s: Switch in progress to same vw., 
__func__);
+   return (0); /* success */
+   }
+   DPRINTF(30, %s: Switch in progress to different vw., 
__func__);
+   return (EBUSY);
+   }
+
+   /* Avoid switching to already selected window */
+   if (vw == curvw) {
+   DPRINTF(30, %s: Cannot switch: vw == curvw., __func__);
+   return (0); /* success */
+   }
+
/* Ask current process permission to switch away. */
if (curvw-vw_smode.mode == VT_PROCESS) {
DPRINTF(30, %s: VT_PROCESS , __func__);
@@ -661,8 +684,7 @@ vt_scrollmode_kbdevent(struct vt_window 
if (console == 0) {
if (c = F_SCR  c = MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) {
vw = vd-vd_windows[c - F_SCR];
-   if (vw != NULL)
-   vt_proc_window_switch(vw);
+   vt_proc_window_switch(vw);
return;
}
VT_LOCK(vd);
@@ -747,8 +769,7 @@ vt_processkey(keyboard_t *kbd, struct vt
 
if (c = F_SCR  c = MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) {
vw = vd-vd_windows[c - F_SCR];
-   if (vw != NULL)
-   vt_proc_window_switch(vw);
+   vt_proc_window_switch(vw);
return (0);
}
 
@@ -757,15 +778,13 @@ vt_processkey(keyboard_t *kbd, struct vt
/* Switch to next VT. */
c = (vw-vw_number + 1) % VT_MAXWINDOWS;
vw = vd-vd_windows[c];
-   if (vw != NULL)
-   vt_proc_window_switch(vw);
+   vt_proc_window_switch(vw);
return (0);
case PREV:
/* Switch to previous VT. */
-   c = (vw-vw_number - 1) % VT_MAXWINDOWS;
+ 

svn commit: r284015 - stable/10/sys/dev/usb/controller

2015-06-05 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  5 07:17:14 2015
New Revision: 284015
URL: https://svnweb.freebsd.org/changeset/base/284015

Log:
  MFC r283922:
  Fix for control endpoint handling in the DWC OTG driver. The data
  stage processing is only allowed after the setup complete event has
  been received. Else a race may occur and the OUT data can be corrupted.
  While at it ensure resetting a FIFO has the required wait loop.

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

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Fri Jun  5 06:49:08 2015
(r284014)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Fri Jun  5 07:17:14 2015
(r284015)
@@ -181,6 +181,22 @@ dwc_otg_get_hw_ep_profile(struct usb_dev
*ppf = NULL;
 }
 
+static void
+dwc_otg_tx_fifo_reset(struct dwc_otg_softc *sc, uint32_t value)
+{
+   uint32_t temp;
+
+   /* reset FIFO */
+   DWC_OTG_WRITE_4(sc, DOTG_GRSTCTL, value);
+
+   /* wait for reset to complete */
+   for (temp = 0; temp != 16; temp++) {
+   value = DWC_OTG_READ_4(sc, DOTG_GRSTCTL);
+   if (!(value  (GRSTCTL_TXFFLSH | GRSTCTL_RXFFLSH)))
+   break;
+   }
+}
+
 static int
 dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode)
 {
@@ -335,12 +351,11 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
}
 
/* reset RX FIFO */
-   DWC_OTG_WRITE_4(sc, DOTG_GRSTCTL,
-   GRSTCTL_RXFFLSH);
+   dwc_otg_tx_fifo_reset(sc, GRSTCTL_RXFFLSH);
 
if (mode != DWC_MODE_OTG) {
/* reset all TX FIFOs */
-   DWC_OTG_WRITE_4(sc, DOTG_GRSTCTL,
+   dwc_otg_tx_fifo_reset(sc,
GRSTCTL_TXFIFO(0x10) |
GRSTCTL_TXFFLSH);
} else {
@@ -951,15 +966,21 @@ dwc_otg_setup_rx(struct dwc_otg_softc *s
if (GRXSTSRD_CHNUM_GET(sc-sc_last_rx_status) != 0)
goto not_complete;
 
-   if ((sc-sc_last_rx_status  GRXSTSRD_DPID_MASK) !=
-   GRXSTSRD_DPID_DATA0) {
+   if ((sc-sc_last_rx_status  GRXSTSRD_PKTSTS_MASK) !=
+   GRXSTSRD_STP_DATA) {
+   if ((sc-sc_last_rx_status  GRXSTSRD_PKTSTS_MASK) !=
+   GRXSTSRD_STP_COMPLETE || td-remainder != 0) {
+   /* release FIFO */
+   dwc_otg_common_rx_ack(sc);
+   goto not_complete;
+   }
/* release FIFO */
dwc_otg_common_rx_ack(sc);
-   goto not_complete;
+   return (0); /* complete */
}
 
-   if ((sc-sc_last_rx_status  GRXSTSRD_PKTSTS_MASK) !=
-   GRXSTSRD_STP_DATA) {
+   if ((sc-sc_last_rx_status  GRXSTSRD_DPID_MASK) !=
+   GRXSTSRD_DPID_DATA0) {
/* release FIFO */
dwc_otg_common_rx_ack(sc);
goto not_complete;
@@ -973,14 +994,6 @@ dwc_otg_setup_rx(struct dwc_otg_softc *s
/* get the packet byte count */
count = GRXSTSRD_BCNT_GET(sc-sc_last_rx_status);
 
-   /* verify data length */
-   if (count != td-remainder) {
-   DPRINTFN(0, Invalid SETUP packet 
-   length, %d bytes\n, count);
-   /* release FIFO */
-   dwc_otg_common_rx_ack(sc);
-   goto not_complete;
-   }
if (count != sizeof(req)) {
DPRINTFN(0, Unsupported SETUP packet 
length, %d bytes\n, count);
@@ -1006,43 +1019,27 @@ dwc_otg_setup_rx(struct dwc_otg_softc *s
}
 
/* don't send any data by default */
-   DWC_OTG_WRITE_4(sc, DOTG_DIEPTSIZ(0),
-   DXEPTSIZ_SET_NPKT(0) | 
-   DXEPTSIZ_SET_NBYTES(0));
-
-   temp = sc-sc_in_ctl[0];
-
-   /* enable IN endpoint */
-   DWC_OTG_WRITE_4(sc, DOTG_DIEPCTL(0),
-   temp | DIEPCTL_EPENA);
-   DWC_OTG_WRITE_4(sc, DOTG_DIEPCTL(0),
-   temp | DIEPCTL_SNAK);
+   DWC_OTG_WRITE_4(sc, DOTG_DIEPTSIZ(0), DIEPCTL_EPDIS);
+   DWC_OTG_WRITE_4(sc, DOTG_DOEPTSIZ(0), DOEPCTL_EPDIS);
 
/* reset IN endpoint buffer */
-   DWC_OTG_WRITE_4(sc, DOTG_GRSTCTL,
+   dwc_otg_tx_fifo_reset(sc,
GRSTCTL_TXFIFO(0) |
GRSTCTL_TXFFLSH);
 
/* acknowledge RX status */
dwc_otg_common_rx_ack(sc);
-   return (0); /* complete */
+   td-did_stall = 1;
 
 not_complete:
/* abort any ongoing transfer, before enabling again */
-
-   temp = sc-sc_out_ctl[0];
-
-   temp |= DOEPCTL_EPENA |
-   DOEPCTL_SNAK;
-
-   /* enable OUT endpoint */
-   DWC_OTG_WRITE_4(sc, DOTG_DOEPCTL(0), temp);
-
if (!td-did_stall) {
td-did_stall = 1;
 
DPRINTFN(5, stalling IN and OUT direction\n);
 
+   temp = 

svn commit: r283950 - in stable/10/sys: dev/sound/pcm dev/sound/usb sys

2015-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  3 15:32:43 2015
New Revision: 283950
URL: https://svnweb.freebsd.org/changeset/base/283950

Log:
  MFC r282650 and r282651:
  Extend the maximum number of allowed PCM channels in a PCM stream to
  127 and decrease the maximum number of sub-channels to 1. These
  definitions are only used inside the kernel and can be changed later
  if more than one sub-channel is desired. This has been done to allow
  so-called USB audio rack modules to work with FreeBSD.
  
  Add support for more than 8 audio channels per PCM stream for USB
  audio class compliant devices under FreeBSD. Tested using 16 recording
  and 16 playback audio channels simultaneously.
  
  Bump the FreeBSD version to force recompiling all external modules.

Modified:
  stable/10/sys/dev/sound/pcm/channel.c
  stable/10/sys/dev/sound/pcm/channel.h
  stable/10/sys/dev/sound/pcm/feeder_chain.c
  stable/10/sys/dev/sound/pcm/sound.h
  stable/10/sys/dev/sound/usb/uaudio.c
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sound/pcm/channel.c
==
--- stable/10/sys/dev/sound/pcm/channel.c   Wed Jun  3 15:18:32 2015
(r283949)
+++ stable/10/sys/dev/sound/pcm/channel.c   Wed Jun  3 15:32:43 2015
(r283950)
@@ -1029,32 +1029,17 @@ static const struct {
{NULL,  NULL, NULL, 0   }
 };
 
-static const struct {
-   char *name, *alias1, *alias2;
-   int matrix_id;
-} matrix_id_tab[] = {
-   { 1.0,  1,   mono, SND_CHN_MATRIX_1_0 },
-   { 2.0,  2, stereo, SND_CHN_MATRIX_2_0 },
-   { 2.1, NULL, NULL, SND_CHN_MATRIX_2_1 },
-   { 3.0,  3, NULL, SND_CHN_MATRIX_3_0 },
-   { 3.1, NULL, NULL, SND_CHN_MATRIX_3_1 },
-   { 4.0,  4,   quad, SND_CHN_MATRIX_4_0 },
-   { 4.1, NULL, NULL, SND_CHN_MATRIX_4_1 },
-   { 5.0,  5, NULL, SND_CHN_MATRIX_5_0 },
-   { 5.1,  6, NULL, SND_CHN_MATRIX_5_1 },
-   { 6.0, NULL, NULL, SND_CHN_MATRIX_6_0 },
-   { 6.1,  7, NULL, SND_CHN_MATRIX_6_1 },
-   { 7.0, NULL, NULL, SND_CHN_MATRIX_7_0 },
-   { 7.1,  8, NULL, SND_CHN_MATRIX_7_1 },
-   {  NULL, NULL, NULL, SND_CHN_MATRIX_UNKNOWN }
-};
-
 uint32_t
 snd_str2afmt(const char *req)
 {
-   uint32_t i, afmt;
-   int matrix_id;
-   char b1[8], b2[8];
+   int ext;
+   int ch;
+   int i;
+   char b1[8];
+   char b2[8];
+
+   memset(b1, 0, sizeof(b1));
+   memset(b2, 0, sizeof(b2));
 
i = sscanf(req, %5[^:]:%6s, b1, b2);
 
@@ -1068,88 +1053,78 @@ snd_str2afmt(const char *req)
} else
return (0);
 
-   afmt = 0;
-   matrix_id = SND_CHN_MATRIX_UNKNOWN;
-
-   for (i = 0; afmt == 0  afmt_tab[i].name != NULL; i++) {
-   if (strcasecmp(afmt_tab[i].name, b1) == 0 ||
-   (afmt_tab[i].alias1 != NULL 
-   strcasecmp(afmt_tab[i].alias1, b1) == 0) ||
-   (afmt_tab[i].alias2 != NULL 
-   strcasecmp(afmt_tab[i].alias2, b1) == 0)) {
-   afmt = afmt_tab[i].afmt;
-   strlcpy(b1, afmt_tab[i].name, sizeof(b1));
-   }
-   }
+   i = sscanf(b2, %d.%d, ch, ext);
 
-   if (afmt == 0)
+   if (i == 0) {
+   if (strcasecmp(b2, mono) == 0) {
+   ch = 1;
+   ext = 0;
+   } else if (strcasecmp(b2, stereo) == 0) {
+   ch = 2;
+   ext = 0;
+   } else if (strcasecmp(b2, quad) == 0) {
+   ch = 4;
+   ext = 0;
+   } else
+   return (0);
+   } else if (i == 1) {
+   if (ch  1 || ch  AFMT_CHANNEL_MAX)
+   return (0);
+   ext = 0;
+   } else if (i == 2) {
+   if (ext  0 || ext  AFMT_EXTCHANNEL_MAX)
+   return (0);
+   if (ch  1 || (ch + ext)  AFMT_CHANNEL_MAX)
+   return (0);
+   } else
return (0);
 
-   for (i = 0; matrix_id == SND_CHN_MATRIX_UNKNOWN 
-   matrix_id_tab[i].name != NULL; i++) {
-   if (strcmp(matrix_id_tab[i].name, b2) == 0 ||
-   (matrix_id_tab[i].alias1 != NULL 
-   strcmp(matrix_id_tab[i].alias1, b2) == 0) ||
-   (matrix_id_tab[i].alias2 != NULL 
-   strcasecmp(matrix_id_tab[i].alias2, b2) == 0)) {
-   matrix_id = matrix_id_tab[i].matrix_id;
-   strlcpy(b2, matrix_id_tab[i].name, sizeof(b2));
+   for (i = 0; afmt_tab[i].name != NULL; i++) {
+   if (strcasecmp(afmt_tab[i].name, b1) != 0) {
+   if (afmt_tab[i].alias1 == NULL)
+   

svn commit: r283951 - stable/10/sys/dev/usb/controller

2015-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun  3 15:41:03 2015
New Revision: 283951
URL: https://svnweb.freebsd.org/changeset/base/283951

Log:
  MFC r283103:
  Fix for DWC OTG device side isochronous transfers. The even or odd
  isochronous frame bit needs to be flipped.

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

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Wed Jun  3 15:32:43 2015
(r283950)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Wed Jun  3 15:41:03 2015
(r283951)
@@ -1561,6 +1561,22 @@ dwc_otg_data_rx(struct dwc_otg_softc *sc
/* release FIFO */
dwc_otg_common_rx_ack(sc);
 
+   temp = sc-sc_out_ctl[td-ep_no];
+
+   /* check for isochronous mode */
+   if ((temp  DIEPCTL_EPTYPE_MASK) ==
+   (DIEPCTL_EPTYPE_ISOC  DIEPCTL_EPTYPE_SHIFT)) {
+   /* toggle odd or even frame bit */
+   if (temp  DIEPCTL_SETD1PID) {
+   temp = ~DIEPCTL_SETD1PID;
+   temp |= DIEPCTL_SETD0PID;
+   } else {
+   temp = ~DIEPCTL_SETD0PID;
+   temp |= DIEPCTL_SETD1PID;
+   }
+   sc-sc_out_ctl[td-ep_no] = temp;
+   }
+
/* check if we are complete */
if ((td-remainder == 0) || got_short) {
if (td-short_pkt) {
@@ -2136,10 +2152,23 @@ repeat:
 
temp = sc-sc_in_ctl[td-ep_no];
 
+   /* check for isochronous mode */
+   if ((temp  DIEPCTL_EPTYPE_MASK) ==
+   (DIEPCTL_EPTYPE_ISOC  DIEPCTL_EPTYPE_SHIFT)) {
+   /* toggle odd or even frame bit */
+   if (temp  DIEPCTL_SETD1PID) {
+   temp = ~DIEPCTL_SETD1PID;
+   temp |= DIEPCTL_SETD0PID;
+   } else {
+   temp = ~DIEPCTL_SETD0PID;
+   temp |= DIEPCTL_SETD1PID;
+   }
+   sc-sc_in_ctl[td-ep_no] = temp;
+   }
+
/* must enable before writing data to FIFO */
DWC_OTG_WRITE_4(sc, DOTG_DIEPCTL(td-ep_no), temp |
-   DIEPCTL_EPENA |
-   DIEPCTL_CNAK);
+   DIEPCTL_EPENA | DIEPCTL_CNAK);
 
td-tx_bytes = count;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r284499 - in stable/10/sys/dev/usb: . quirk

2015-06-17 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 17 07:32:28 2015
New Revision: 284499
URL: https://svnweb.freebsd.org/changeset/base/284499

Log:
  MFC r284125:
  Add new USB quirk.
  
  PR:   200693

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

Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/10/sys/dev/usb/quirk/usb_quirk.c Wed Jun 17 07:30:53 2015
(r284498)
+++ stable/10/sys/dev/usb/quirk/usb_quirk.c Wed Jun 17 07:32:28 2015
(r284499)
@@ -94,6 +94,7 @@ static struct usb_quirk_entry usb_quirks
USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC),
USB_QUIRK(LOGITECH, UN53B, 0x, 0x, UQ_NO_STRINGS),
USB_QUIRK(REALTEK, RTL8196EU, 0x, 0x, UQ_CFG_INDEX_1),
+   USB_QUIRK(REALTEK, RTL8153, 0x, 0x, UQ_CFG_INDEX_1),
USB_QUIRK(ELSA, MODEM1, 0x, 0x, UQ_CFG_INDEX_1),
USB_QUIRK(PLANEX2, MZKUE150N, 0x, 0x, UQ_CFG_INDEX_1),
/* Quirks for printer devices */

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Wed Jun 17 07:30:53 2015
(r284498)
+++ stable/10/sys/dev/usb/usbdevs   Wed Jun 17 07:32:28 2015
(r284499)
@@ -3722,6 +3722,7 @@ product REALTEK USB20CRW  0x0158  USB20CRW
 product REALTEK RTL8188ETV 0x0179  RTL8188ETV
 product REALTEK RTL8188CTV  0x018a  RTL8188CTV
 product REALTEK USBKR100   0x8150  USBKR100 USB Ethernet
+product REALTEK RTL81530x8153  RTL8153 USB Ethernet
 product REALTEK RTL8188CE_0 0x8170  RTL8188CE
 product REALTEK RTL81710x8171  RTL8171
 product REALTEK RTL81720x8172  RTL8172
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r284503 - stable/10/sys/dev/pci

2015-06-17 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 17 07:41:53 2015
New Revision: 284503
URL: https://svnweb.freebsd.org/changeset/base/284503

Log:
  MFC r284012:
  Disable VGA PCI interrupts until a chipset driver is loaded for VGA
  PCI devices. Else unhandled display adapter interrupts might freeze
  the CPU or consume a lot of CPU.
  
  PR:   156596

Modified:
  stable/10/sys/dev/pci/vga_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/pci/vga_pci.c
==
--- stable/10/sys/dev/pci/vga_pci.c Wed Jun 17 07:38:50 2015
(r284502)
+++ stable/10/sys/dev/pci/vga_pci.c Wed Jun 17 07:41:53 2015
(r284503)
@@ -125,6 +125,13 @@ vga_pci_is_boot_display(device_t dev)
if ((config  (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN)) == 0)
return (0);
 
+   /*
+* Disable interrupts until a chipset driver is loaded for
+* this PCI device. Else unhandled display adapter interrupts
+* might freeze the CPU.
+*/
+   pci_write_config(dev, PCIR_COMMAND, config | PCIM_CMD_INTxDIS, 2);
+
/* This video card is the boot display: record its unit number. */
vga_pci_default_unit = unit;
device_set_flags(dev, 1);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r284496 - stable/10/sys/netinet

2015-06-17 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 17 07:21:43 2015
New Revision: 284496
URL: https://svnweb.freebsd.org/changeset/base/284496

Log:
  MFC r280991:
  Extend fixes made in r278103 and r38754 by copying the complete packet
  header and not only partial flags and fields. Firewalls can attach
  classification tags to the outgoing mbufs which should be copied to
  all the new fragments. Else only the first fragment will be let
  through by the firewall. This can easily be tested by sending a large
  ping packet through a firewall. It was also discovered that VLAN
  related flags and fields should be copied for packets traversing
  through VLANs. This is all handled by m_dup_pkthdr().
  
  Regarding the MAC policy check in ip_fragment(), the tag provided by
  the originating mbuf is copied instead of using the default one
  provided by m_gethdr().
  
  Tested by:Karim Fodil-Lemelin fodillemlinkarim at gmail.com
  Sponsored by: Mellanox Technologies
  PR:   7802

Modified:
  stable/10/sys/netinet/ip_output.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/ip_output.c
==
--- stable/10/sys/netinet/ip_output.c   Wed Jun 17 04:46:58 2015
(r284495)
+++ stable/10/sys/netinet/ip_output.c   Wed Jun 17 07:21:43 2015
(r284496)
@@ -797,13 +797,18 @@ smart_frag_failure:
goto done;
}
/*
-* make sure the flowid and flowtype are the same for the
-* fragmented mbufs
+* Make sure the complete packet header gets copied
+* from the originating mbuf to the newly created
+* mbuf. This also ensures that existing firewall
+* classification(s), VLAN tags and so on get copied
+* to the resulting fragmented packet(s):
 */
-   M_HASHTYPE_SET(m, M_HASHTYPE_GET(m0));
-   m-m_pkthdr.flowid = m0-m_pkthdr.flowid;
-   /* copy multicast flags, if any */
-   m-m_flags |= (m0-m_flags  M_MCAST);
+   if (m_dup_pkthdr(m, m0, M_NOWAIT) == 0) {
+   m_free(m);
+   error = ENOBUFS;
+   IPSTAT_INC(ips_odropped);
+   goto done;
+   }
/*
 * In the first mbuf, leave room for the link header, then
 * copy the original IP header including options. The payload
@@ -833,11 +838,9 @@ smart_frag_failure:
goto done;
}
m-m_pkthdr.len = mhlen + len;
-   m-m_pkthdr.rcvif = NULL;
 #ifdef MAC
mac_netinet_fragment(m0, m);
 #endif
-   m-m_pkthdr.csum_flags = m0-m_pkthdr.csum_flags;
mhip-ip_off = htons(mhip-ip_off);
mhip-ip_sum = 0;
if (m-m_pkthdr.csum_flags  CSUM_IP  ~if_hwassist_flags) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r290607 - stable/10/sys/dev/usb/net

2015-11-09 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov  9 11:24:59 2015
New Revision: 290607
URL: https://svnweb.freebsd.org/changeset/base/290607

Log:
  MFC r290441:
  Fix for unaligned IP-header.
  
  The mbuf length fields must be set before m_adj() is called else
  m_adj() will not always adjust the mbuf and an unaligned read
  exception can trigger inside the network stack. This can happen on
  platforms where unaligned reads are not supported. Adjust a length
  check to include the 2-byte ethernet alignment while at it.

Modified:
  stable/10/sys/dev/usb/net/if_cdce.c
  stable/10/sys/dev/usb/net/if_urndis.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/net/if_cdce.c
==
--- stable/10/sys/dev/usb/net/if_cdce.c Mon Nov  9 10:41:27 2015
(r290606)
+++ stable/10/sys/dev/usb/net/if_cdce.c Mon Nov  9 11:24:59 2015
(r290607)
@@ -1381,6 +1381,7 @@ cdce_ncm_bulk_read_callback(struct usb_x
 
/* check if we have a buffer */
if (m) {
+   m->m_len = m->m_pkthdr.len = temp + ETHER_ALIGN;
m_adj(m, ETHER_ALIGN);
 
usbd_copy_out(pc, offset, m->m_data, temp);

Modified: stable/10/sys/dev/usb/net/if_urndis.c
==
--- stable/10/sys/dev/usb/net/if_urndis.c   Mon Nov  9 10:41:27 2015
(r290606)
+++ stable/10/sys/dev/usb/net/if_urndis.c   Mon Nov  9 11:24:59 2015
(r290607)
@@ -848,7 +848,7 @@ urndis_bulk_read_callback(struct usb_xfe
DPRINTF("invalid ethernet size "
"%u < %u\n", msg.rm_datalen, 
(unsigned)sizeof(struct ether_header));
goto tr_setup;
-   } else if (msg.rm_datalen > (uint32_t)MCLBYTES) {
+   } else if (msg.rm_datalen > (uint32_t)(MCLBYTES - 
ETHER_ALIGN)) {
ifp->if_ierrors++;
DPRINTF("invalid ethernet size "
"%u > %u\n",
@@ -862,6 +862,7 @@ urndis_bulk_read_callback(struct usb_xfe
 
/* check if we have a buffer */
if (m != NULL) {
+   m->m_len = m->m_pkthdr.len = msg.rm_datalen + 
ETHER_ALIGN;
m_adj(m, ETHER_ALIGN);
 
usbd_copy_out(pc, offset + msg.rm_dataoffset +
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r290331 - stable/10/sys/dev/usb/controller

2015-11-03 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov  3 10:24:54 2015
New Revision: 290331
URL: https://svnweb.freebsd.org/changeset/base/290331

Log:
  MFC r285914, r289029 and r289560:
  - Move the remainder of host controller capability registers reading from
xhci_start_controller() to xhci_init(). These values don't change at run-
time so there's no point of acquiring them on every USB_HW_POWER_RESUME
instead of only once during initialization. In r276717, reading the first
couple of registers in question already had been moved as a prerequisite
for the changes in that revision.
  - Identify ASMedia ASM1042A controllers.
  - Use NULL instead of 0 for pointers.
  - Add quirks for USB 3.0 PCI devices.
  
  PR:   203650

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

Modified: stable/10/sys/dev/usb/controller/xhci.c
==
--- stable/10/sys/dev/usb/controller/xhci.c Tue Nov  3 10:21:53 2015
(r290330)
+++ stable/10/sys/dev/usb/controller/xhci.c Tue Nov  3 10:24:54 2015
(r290331)
@@ -380,54 +380,12 @@ xhci_start_controller(struct xhci_softc 
return (USB_ERR_IOERROR);
}
 
-   if (!(XREAD4(sc, oper, XHCI_PAGESIZE) & XHCI_PAGESIZE_4K)) {
-   device_printf(sc->sc_bus.parent, "Controller does "
-   "not support 4K page size.\n");
-   return (USB_ERR_IOERROR);
-   }
-
-   temp = XREAD4(sc, capa, XHCI_HCSPARAMS1);
-
-   i = XHCI_HCS1_N_PORTS(temp);
-
-   if (i == 0) {
-   device_printf(sc->sc_bus.parent, "Invalid number "
-   "of ports: %u\n", i);
-   return (USB_ERR_IOERROR);
-   }
-
-   sc->sc_noport = i;
-   sc->sc_noslot = XHCI_HCS1_DEVSLOT_MAX(temp);
-
-   if (sc->sc_noslot > XHCI_MAX_DEVICES)
-   sc->sc_noslot = XHCI_MAX_DEVICES;
-
/* set up number of device slots */
-
DPRINTF("CONFIG=0x%08x -> 0x%08x\n",
XREAD4(sc, oper, XHCI_CONFIG), sc->sc_noslot);
 
XWRITE4(sc, oper, XHCI_CONFIG, sc->sc_noslot);
 
-   DPRINTF("Max slots: %u\n", sc->sc_noslot);
-
-   temp = XREAD4(sc, capa, XHCI_HCSPARAMS2);
-
-   sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp);
-
-   if (sc->sc_noscratch > XHCI_MAX_SCRATCHPADS) {
-   device_printf(sc->sc_bus.parent, "XHCI request "
-   "too many scratchpads\n");
-   return (USB_ERR_NOMEM);
-   }
-
-   DPRINTF("Max scratch: %u\n", sc->sc_noscratch);
-
-   temp = XREAD4(sc, capa, XHCI_HCSPARAMS3);
-
-   sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) +
-   XHCI_HCS3_U2_DEL(temp) + 250 /* us */;
-
temp = XREAD4(sc, oper, XHCI_USBSTS);
 
/* clear interrupts */
@@ -459,29 +417,13 @@ xhci_start_controller(struct xhci_softc 
XWRITE4(sc, oper, XHCI_DCBAAP_LO, (uint32_t)addr);
XWRITE4(sc, oper, XHCI_DCBAAP_HI, (uint32_t)(addr >> 32));
 
-   /* Setup event table size */
-
-   temp = XREAD4(sc, capa, XHCI_HCSPARAMS2);
-
-   DPRINTF("HCS2=0x%08x\n", temp);
-
-   temp = XHCI_HCS2_ERST_MAX(temp);
-   temp = 1U << temp;
-   if (temp > XHCI_MAX_RSEG)
-   temp = XHCI_MAX_RSEG;
-
-   sc->sc_erst_max = temp;
-
+   /* set up event table size */
DPRINTF("ERSTSZ=0x%08x -> 0x%08x\n",
-   XREAD4(sc, runt, XHCI_ERSTSZ(0)), temp);
+   XREAD4(sc, runt, XHCI_ERSTSZ(0)), sc->sc_erst_max);
 
-   XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(temp));
+   XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(sc->sc_erst_max));
 
-   /* Check if we should use the default IMOD value */
-   if (sc->sc_imod_default == 0)
-   sc->sc_imod_default = XHCI_IMOD_DEFAULT;
-
-   /* Setup interrupt rate */
+   /* set up interrupt rate */
XWRITE4(sc, runt, XHCI_IMOD(0), sc->sc_imod_default);
 
usbd_get_page(>sc_hw.root_pc, 0, _res);
@@ -508,8 +450,7 @@ xhci_start_controller(struct xhci_softc 
XWRITE4(sc, runt, XHCI_ERSTBA_LO(0), (uint32_t)addr);
XWRITE4(sc, runt, XHCI_ERSTBA_HI(0), (uint32_t)(addr >> 32));
 
-   /* Setup interrupter registers */
-
+   /* set up interrupter registers */
temp = XREAD4(sc, runt, XHCI_IMAN(0));
temp |= XHCI_IMAN_INTR_ENA;
XWRITE4(sc, runt, XHCI_IMAN(0), temp);
@@ -620,6 +561,12 @@ xhci_init(struct xhci_softc *sc, device_
 
DPRINTF("xHCI version = 0x%04x\n", XREAD2(sc, capa, XHCI_HCIVERSION));
 
+   if (!(XREAD4(sc, oper, XHCI_PAGESIZE) & XHCI_PAGESIZE_4K)) {
+   device_printf(sc->sc_bus.parent, "Controller does "
+   "not support 4K page size.\n");
+   return (ENXIO);
+   }
+
temp = XREAD4(sc, capa, XHCI_HCSPARAMS0);
 
DPRINTF("HCS0 = 0x%08x\n", temp);
@@ -638,6 +585,55 @@ 

svn commit: r290443 - stable/10/sys/dev/usb/controller

2015-11-06 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Nov  6 13:34:55 2015
New Revision: 290443
URL: https://svnweb.freebsd.org/changeset/base/290443

Log:
  MFC r290195:
  Reduce the DWC OTG interrupt load by not reading all the host channel
  status registers for every interrupt. Check a common host channel
  status interrupt register first, then conditionally read the
  individual host channel status registers.

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

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Fri Nov  6 13:08:16 2015
(r290442)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Fri Nov  6 13:34:55 2015
(r290443)
@@ -2559,6 +2559,7 @@ dwc_otg_interrupt_poll_locked(struct dwc
struct usb_xfer *xfer;
uint32_t count;
uint32_t temp;
+   uint32_t haint;
uint8_t got_rx_status;
uint8_t x;
 
@@ -2576,14 +2577,18 @@ repeat:
DPRINTF("Yield\n");
return;
}
+
/* get all host channel interrupts */
-   for (x = 0; x != sc->sc_host_ch_max; x++) {
+   haint = DWC_OTG_READ_4(sc, DOTG_HAINT);
+   while (1) {
+   x = ffs(haint) - 1;
+   if (x >= sc->sc_host_ch_max)
+   break;
temp = DWC_OTG_READ_4(sc, DOTG_HCINT(x));
-   if (temp != 0) {
-   DWC_OTG_WRITE_4(sc, DOTG_HCINT(x), temp);
-   temp &= ~HCINT_SOFTWARE_ONLY;
-   sc->sc_chan_state[x].hcint |= temp;
-   }
+   DWC_OTG_WRITE_4(sc, DOTG_HCINT(x), temp);
+   temp &= ~HCINT_SOFTWARE_ONLY;
+   sc->sc_chan_state[x].hcint |= temp;
+   haint &= ~(1U << x);
}
 
if (sc->sc_last_rx_status == 0) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r289020 - in stable/10/sys: net netinet

2015-10-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Oct  8 08:30:40 2015
New Revision: 289020
URL: https://svnweb.freebsd.org/changeset/base/289020

Log:
  MFC r287775:
  Update TSO limits to include all headers.
  
  To make driver programming easier the TSO limits are changed to
  reflect the values used in the BUSDMA tag a network adapter driver is
  using. The TCP/IP network stack will subtract space for all linklevel
  and protocol level headers and ensure that the full mbuf chain passed
  to the network adapter fits within the given limits. See r287775
  for a more detailed description.
  
  Differential Revision:https://reviews.freebsd.org/D3477
  Reviewed by:  rmacklem

Modified:
  stable/10/sys/net/if_var.h
  stable/10/sys/netinet/tcp_output.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if_var.h
==
--- stable/10/sys/net/if_var.h  Thu Oct  8 08:06:23 2015(r289019)
+++ stable/10/sys/net/if_var.h  Thu Oct  8 08:30:40 2015(r289020)
@@ -236,11 +236,12 @@ struct ifnet {
 * count limit does not apply. If all three fields are zero,
 * there is no TSO limit.
 *
-* NOTE: The TSO limits only apply to the data payload part of
-* a TCP/IP packet. That means there is no need to subtract
-* space for ethernet-, vlan-, IP- or TCP- headers from the
-* TSO limits unless the hardware driver in question requires
-* so.
+* NOTE: The TSO limits should reflect the values used in the
+* BUSDMA tag a network adapter is using to load a mbuf chain
+* for transmission. The TCP/IP network stack will subtract
+* space for all linklevel and protocol level headers and
+* ensure that the full mbuf chain passed to the network
+* adapter fits within the given limits.
 */
u_int   if_hw_tsomax;
 

Modified: stable/10/sys/netinet/tcp_output.c
==
--- stable/10/sys/netinet/tcp_output.c  Thu Oct  8 08:06:23 2015
(r289019)
+++ stable/10/sys/netinet/tcp_output.c  Thu Oct  8 08:30:40 2015
(r289020)
@@ -807,7 +807,8 @@ send:
 */
if (if_hw_tsomax != 0) {
/* compute maximum TSO length */
-   max_len = (if_hw_tsomax - hdrlen);
+   max_len = (if_hw_tsomax - hdrlen -
+   max_linkhdr);
if (max_len <= 0) {
len = 0;
} else if (len > max_len) {
@@ -822,6 +823,15 @@ send:
 */
if (if_hw_tsomaxsegcount != 0 &&
if_hw_tsomaxsegsize != 0) {
+   /*
+* Subtract one segment for the LINK
+* and TCP/IP headers mbuf that will
+* be prepended to this mbuf chain
+* after the code in this section
+* limits the number of mbufs in the
+* chain to if_hw_tsomaxsegcount.
+*/
+   if_hw_tsomaxsegcount -= 1;
max_len = 0;
mb = sbsndmbuf(>so_snd, off, );
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r289013 - stable/10/sys/dev/usb/controller

2015-10-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Oct  8 07:24:54 2015
New Revision: 289013
URL: https://svnweb.freebsd.org/changeset/base/289013

Log:
  MFC r287355, r287772 and r287825:
  Add new USB PCI IDs.
  
  PR:   202807
  Submitted by: Dmitry Luhtionov 
  Differential Revision:https://reviews.freebsd.org/D3665

Modified:
  stable/10/sys/dev/usb/controller/uhci_pci.c
  stable/10/sys/dev/usb/controller/xhci_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/uhci_pci.c
==
--- stable/10/sys/dev/usb/controller/uhci_pci.c Thu Oct  8 07:22:40 2015
(r289012)
+++ stable/10/sys/dev/usb/controller/uhci_pci.c Thu Oct  8 07:24:54 2015
(r289013)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include "usb_if.h"
 
 #definePCI_UHCI_VENDORID_INTEL 0x8086
+#definePCI_UHCI_VENDORID_HP0x103c
 #definePCI_UHCI_VENDORID_VIA   0x1106
 
 /* PIIX4E has no separate stepping */
@@ -222,6 +223,9 @@ uhci_pci_match(device_t self)
case 0x76028086:
return ("Intel 82372FB/82468GX USB controller");
 
+   case 0x3300103c:
+   return ("HP iLO Standard Virtual USB controller");
+
case 0x30381106:
return ("VIA 83C572 USB controller");
 
@@ -309,6 +313,9 @@ uhci_pci_attach(device_t self)
case PCI_UHCI_VENDORID_INTEL:
sprintf(sc->sc_vendor, "Intel");
break;
+   case PCI_UHCI_VENDORID_HP:
+   sprintf(sc->sc_vendor, "HP");
+   break;
case PCI_UHCI_VENDORID_VIA:
sprintf(sc->sc_vendor, "VIA");
break;

Modified: stable/10/sys/dev/usb/controller/xhci_pci.c
==
--- stable/10/sys/dev/usb/controller/xhci_pci.c Thu Oct  8 07:22:40 2015
(r289012)
+++ stable/10/sys/dev/usb/controller/xhci_pci.c Thu Oct  8 07:24:54 2015
(r289013)
@@ -112,6 +112,9 @@ xhci_pci_match(device_t self)
case 0x8cb18086:
return ("Intel Wildcat Point USB 3.0 controller");
 
+   case 0xa01b177d:
+   return ("Cavium ThunderX USB 3.0 controller");
+
default:
break;
}
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r289016 - in stable/10/sys/dev/usb: . quirk

2015-10-08 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Oct  8 07:31:05 2015
New Revision: 289016
URL: https://svnweb.freebsd.org/changeset/base/289016

Log:
  MFC r287321:
  Add new USB quirk.
  
  PR:   202783

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

Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/10/sys/dev/usb/quirk/usb_quirk.c Thu Oct  8 07:29:30 2015
(r289015)
+++ stable/10/sys/dev/usb/quirk/usb_quirk.c Thu Oct  8 07:31:05 2015
(r289016)
@@ -98,6 +98,7 @@ static struct usb_quirk_entry usb_quirks
USB_QUIRK(REALTEK, RTL8153, 0x, 0x, UQ_CFG_INDEX_1),
USB_QUIRK(ELSA, MODEM1, 0x, 0x, UQ_CFG_INDEX_1),
USB_QUIRK(PLANEX2, MZKUE150N, 0x, 0x, UQ_CFG_INDEX_1),
+   USB_QUIRK(CISCOLINKSYS, USB3GIGV1, 0x, 0x, UQ_CFG_INDEX_1),
/* Quirks for printer devices */
USB_QUIRK(HP, 895C, 0x, 0x, UQ_BROKEN_BIDIR),
USB_QUIRK(HP, 880C, 0x, 0x, UQ_BROKEN_BIDIR),

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Thu Oct  8 07:29:30 2015
(r289015)
+++ stable/10/sys/dev/usb/usbdevs   Thu Oct  8 07:31:05 2015
(r289016)
@@ -1407,6 +1407,7 @@ product CISCOLINKSYS WUSB54GC 0x0020  WUS
 product CISCOLINKSYS WUSB54GR  0x0023  WUSB54GR
 product CISCOLINKSYS WUSBF54G  0x0024  WUSBF54G
 product CISCOLINKSYS AE10000x002f  AE1000
+product CISCOLINKSYS USB3GIGV1 0x0041  USB3GIGV1 USB Ethernet Adapter
 product CISCOLINKSYS2 RT3070   0x4001  RT3070
 product CISCOLINKSYS3 RT3070   0x0101  RT3070
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r289215 - in stable/10/sys/dev/usb: . serial

2015-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 13 08:14:36 2015
New Revision: 289215
URL: https://svnweb.freebsd.org/changeset/base/289215

Log:
  MFC r287592 and r287616:
  Add new USB ID.
  
  PR:   202968

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

Modified: stable/10/sys/dev/usb/serial/u3g.c
==
--- stable/10/sys/dev/usb/serial/u3g.c  Tue Oct 13 08:10:21 2015
(r289214)
+++ stable/10/sys/dev/usb/serial/u3g.c  Tue Oct 13 08:14:36 2015
(r289215)
@@ -316,6 +316,7 @@ static const STRUCT_USB_HOST_ID u3g_devs
U3G_DEV(HUAWEI, E220, U3GINIT_HUAWEI),
U3G_DEV(HUAWEI, E220BIS, U3GINIT_HUAWEI),
U3G_DEV(HUAWEI, E392, U3GINIT_HUAWEISCSI),
+   U3G_DEV(HUAWEI, ME909U, U3GINIT_HUAWEISCSI2),
U3G_DEV(HUAWEI, MOBILE, U3GINIT_HUAWEI),
U3G_DEV(HUAWEI, E1752, U3GINIT_HUAWEISCSI),
U3G_DEV(HUAWEI, E1820, U3GINIT_HUAWEISCSI),

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Tue Oct 13 08:10:21 2015
(r289214)
+++ stable/10/sys/dev/usb/usbdevs   Tue Oct 13 08:14:36 2015
(r289215)
@@ -2365,6 +2365,7 @@ product HUAWEI K3765_INIT 0x1520  K3765 I
 product HUAWEI K4505_INIT  0x1521  K4505 Initial
 product HUAWEI K3772_INIT  0x1526  K3772 Initial
 product HUAWEI E3272_INIT  0x155b  LTE modem initial
+product HUAWEI ME909U  0x1573  LTE modem
 product HUAWEI R215_INIT   0x1582  LTE modem initial
 product HUAWEI R2150x1588  LTE modem
 product HUAWEI ETS2055 0x1803  CDMA modem
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r289213 - stable/10/share/man/man4

2015-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 13 08:09:16 2015
New Revision: 289213
URL: https://svnweb.freebsd.org/changeset/base/289213

Log:
  MFC r288273:
  Fix spelling.
  
  PR:   203249

Modified:
  stable/10/share/man/man4/usb_quirk.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/usb_quirk.4
==
--- stable/10/share/man/man4/usb_quirk.4Tue Oct 13 06:14:03 2015
(r289212)
+++ stable/10/share/man/man4/usb_quirk.4Tue Oct 13 08:09:16 2015
(r289213)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 24, 2015
+.Dd September 26, 2015
 .Dt USB_QUIRK 4
 .Os
 .Sh NAME
@@ -193,9 +193,10 @@ The value is a string whose format is:
 Installs the quirks
 .Ic UQ_QUIRK,...
 for all USB devices matching
-.Ic VendorId ,
+.Ic VendorId
+and
 .Ic ProductId
-and has a hardware revision between and including
+which have a hardware revision between and including
 .Ic LowRevision
 and
 .Ic HighRevision .
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r289218 - stable/10/usr.bin/usbhidaction

2015-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 13 08:21:15 2015
New Revision: 289218
URL: https://svnweb.freebsd.org/changeset/base/289218

Log:
  MFC r288335:
  Store PID after becoming a daemon() and not before to ensure the
  correct PID gets written to the PID file.
  
  PR:   203252

Modified:
  stable/10/usr.bin/usbhidaction/usbhidaction.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/usbhidaction/usbhidaction.c
==
--- stable/10/usr.bin/usbhidaction/usbhidaction.c   Tue Oct 13 08:19:21 
2015(r289217)
+++ stable/10/usr.bin/usbhidaction/usbhidaction.c   Tue Oct 13 08:21:15 
2015(r289218)
@@ -166,17 +166,15 @@ main(int argc, char **argv)
 
if (demon) {
fp = open(pidfile, O_WRONLY|O_CREAT, S_IRUSR|S_IRGRP|S_IROTH);
-   if (fp >= 0) {
-   sz1 = snprintf(buf, sizeof buf, "%ld\n", 
-   (long)getpid());
-   if (sz1 > sizeof buf)
-   sz1 = sizeof buf;
-   write(fp, buf, sz1);
-   close(fp);
-   } else
+   if (fp < 0)
err(1, "%s", pidfile);
if (daemon(0, 0) < 0)
err(1, "daemon()");
+   snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
+   sz1 = strlen(buf);
+   if (write(fp, buf, sz1) < 0)
+   err(1, "%s", pidfile);
+   close(fp);
isdemon = 1;
}
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287272 - stable/10/sys/dev/usb

2015-08-29 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Aug 29 06:11:50 2015
New Revision: 287272
URL: https://svnweb.freebsd.org/changeset/base/287272

Log:
  MFC r286799:
  Fix race in USB PF which can happen if we stop tracing exactly when
  the kernel is tapping an USB transfer. This leads to a NULL pointer
  access. The solution is to only trace while the USB bus lock is
  locked.

Modified:
  stable/10/sys/dev/usb/usb_pf.c
  stable/10/sys/dev/usb/usb_transfer.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_pf.c
==
--- stable/10/sys/dev/usb/usb_pf.c  Sat Aug 29 06:07:55 2015
(r287271)
+++ stable/10/sys/dev/usb/usb_pf.c  Sat Aug 29 06:11:50 2015
(r287272)
@@ -220,7 +220,13 @@ usbpf_clone_destroy(struct if_clone *ifc
ubus = ifp-if_softc;
unit = ifp-if_dunit;
 
+   /*
+* Lock USB before clearing the ifp pointer, to avoid
+* clearing the pointer in the middle of a TAP operation:
+*/
+   USB_BUS_LOCK(ubus);
ubus-ifp = NULL;
+   USB_BUS_UNLOCK(ubus);
bpfdetach(ifp);
if_detach(ifp);
if_free(ifp);

Modified: stable/10/sys/dev/usb/usb_transfer.c
==
--- stable/10/sys/dev/usb/usb_transfer.cSat Aug 29 06:07:55 2015
(r287271)
+++ stable/10/sys/dev/usb/usb_transfer.cSat Aug 29 06:11:50 2015
(r287272)
@@ -2381,8 +2381,11 @@ usbd_callback_wrapper(struct usb_xfer_qu
}
 
 #if USB_HAVE_PF
-   if (xfer-usb_state != USB_ST_SETUP)
+   if (xfer-usb_state != USB_ST_SETUP) {
+   USB_BUS_LOCK(info-bus);
usbpf_xfertap(xfer, USBPF_XFERTAP_DONE);
+   USB_BUS_UNLOCK(info-bus);
+   }
 #endif
/* call processing routine */
(xfer-callback) (xfer, xfer-error);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to svn-src-stable-10-unsubscr...@freebsd.org


svn commit: r287274 - in stable/10/sys: boot/usb dev/usb dev/usb/controller

2015-08-29 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Aug 29 06:23:40 2015
New Revision: 287274
URL: https://svnweb.freebsd.org/changeset/base/287274

Log:
  MFC r286773:
  Improve the realtime properties of USB transfers for embedded systems
  like RPI-B and RPI-2.

Modified:
  stable/10/sys/boot/usb/bsd_kernel.h
  stable/10/sys/dev/usb/controller/usb_controller.c
  stable/10/sys/dev/usb/usb_bus.h
  stable/10/sys/dev/usb/usb_device.c
  stable/10/sys/dev/usb/usb_hub.c
  stable/10/sys/dev/usb/usb_process.h
  stable/10/sys/dev/usb/usb_transfer.c
  stable/10/sys/dev/usb/usbdi.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/usb/bsd_kernel.h
==
--- stable/10/sys/boot/usb/bsd_kernel.h Sat Aug 29 06:17:39 2015
(r287273)
+++ stable/10/sys/boot/usb/bsd_kernel.h Sat Aug 29 06:23:40 2015
(r287274)
@@ -42,7 +42,8 @@
 #defineM_USBDEV 0
 #defineUSB_PROC_MAX 3
 #defineUSB_BUS_GIANT_PROC(bus) (usb_process + 2)
-#defineUSB_BUS_NON_GIANT_PROC(bus) (usb_process + 2)
+#defineUSB_BUS_NON_GIANT_BULK_PROC(bus) (usb_process + 2)
+#defineUSB_BUS_NON_GIANT_ISOC_PROC(bus) (usb_process + 2)
 #defineUSB_BUS_EXPLORE_PROC(bus) (usb_process + 0)
 #defineUSB_BUS_CONTROL_XFER_PROC(bus) (usb_process + 1)
 #defineSYSCTL_DECL(...)

Modified: stable/10/sys/dev/usb/controller/usb_controller.c
==
--- stable/10/sys/dev/usb/controller/usb_controller.c   Sat Aug 29 06:17:39 
2015(r287273)
+++ stable/10/sys/dev/usb/controller/usb_controller.c   Sat Aug 29 06:23:40 
2015(r287274)
@@ -233,7 +233,8 @@ usb_detach(device_t dev)
/* Get rid of USB callback processes */
 
usb_proc_free(USB_BUS_GIANT_PROC(bus));
-   usb_proc_free(USB_BUS_NON_GIANT_PROC(bus));
+   usb_proc_free(USB_BUS_NON_GIANT_ISOC_PROC(bus));
+   usb_proc_free(USB_BUS_NON_GIANT_BULK_PROC(bus));
 
/* Get rid of USB explore process */
 
@@ -397,7 +398,8 @@ usb_bus_explore(struct usb_proc_msg *pm)
 */
usb_proc_rewakeup(USB_BUS_CONTROL_XFER_PROC(bus));
usb_proc_rewakeup(USB_BUS_GIANT_PROC(bus));
-   usb_proc_rewakeup(USB_BUS_NON_GIANT_PROC(bus));
+   usb_proc_rewakeup(USB_BUS_NON_GIANT_ISOC_PROC(bus));
+   usb_proc_rewakeup(USB_BUS_NON_GIANT_BULK_PROC(bus));
 #endif
 
USB_BUS_UNLOCK(bus);
@@ -862,9 +864,13 @@ usb_attach_sub(device_t dev, struct usb_
bus-bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
device_printf(dev, WARNING: Creation of USB Giant 
callback process failed.\n);
-   } else if (usb_proc_create(USB_BUS_NON_GIANT_PROC(bus),
+   } else if (usb_proc_create(USB_BUS_NON_GIANT_ISOC_PROC(bus),
+   bus-bus_mtx, device_get_nameunit(dev), USB_PRI_HIGHEST)) {
+   device_printf(dev, WARNING: Creation of USB non-Giant ISOC 
+   callback process failed.\n);
+   } else if (usb_proc_create(USB_BUS_NON_GIANT_BULK_PROC(bus),
bus-bus_mtx, device_get_nameunit(dev), USB_PRI_HIGH)) {
-   device_printf(dev, WARNING: Creation of USB non-Giant 
+   device_printf(dev, WARNING: Creation of USB non-Giant BULK 
callback process failed.\n);
} else if (usb_proc_create(USB_BUS_EXPLORE_PROC(bus),
bus-bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {

Modified: stable/10/sys/dev/usb/usb_bus.h
==
--- stable/10/sys/dev/usb/usb_bus.h Sat Aug 29 06:17:39 2015
(r287273)
+++ stable/10/sys/dev/usb/usb_bus.h Sat Aug 29 06:23:40 2015
(r287274)
@@ -57,19 +57,26 @@ struct usb_bus {
struct root_hold_token *bus_roothold;
 #endif
 
+/* convenience macros */
+#defineUSB_BUS_TT_PROC(bus) USB_BUS_NON_GIANT_ISOC_PROC(bus)
+#defineUSB_BUS_CS_PROC(bus) USB_BUS_NON_GIANT_ISOC_PROC(bus)
+  
 #if USB_HAVE_PER_BUS_PROCESS
 #defineUSB_BUS_GIANT_PROC(bus) ((bus)-giant_callback_proc)
-#defineUSB_BUS_NON_GIANT_PROC(bus) ((bus)-non_giant_callback_proc)
+#defineUSB_BUS_NON_GIANT_ISOC_PROC(bus) 
((bus)-non_giant_isoc_callback_proc)
+#defineUSB_BUS_NON_GIANT_BULK_PROC(bus) 
((bus)-non_giant_bulk_callback_proc)
 #defineUSB_BUS_EXPLORE_PROC(bus) ((bus)-explore_proc)
 #defineUSB_BUS_CONTROL_XFER_PROC(bus) ((bus)-control_xfer_proc)
-
/*
-* There are two callback processes. One for Giant locked
-* callbacks. One for non-Giant locked callbacks. This should
-* avoid congestion and reduce response time in most cases.
+* There are three callback processes. One for Giant locked
+* callbacks. One for non-Giant locked non-periodic callbacks
+* and one for 

svn commit: r287271 - stable/10/sys/dev/usb/controller

2015-08-29 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Aug 29 06:07:55 2015
New Revision: 287271
URL: https://svnweb.freebsd.org/changeset/base/287271

Log:
  MFC r283067, r286118, r285638, r285935, r286778, r286780 and r286802:
  - Make the FIFO configuration a bit more flexible for the DWC OTG in
  device side mode.
  - Limit the number of times we loop inside the DWC OTG poll handler to
  avoid starving other fast interrupts. Fix a comment while at it.
  - Optimise the DWC OTG host mode driver's transmit path
  - Optimise the DWC OTG host mode driver's receive path
  - Minor code refactor to avoid duplicating code.
  - Handle NYET high speed tokens and predict NAK'ing is up next.
  - Fixes for HIGH speed ISOCHRONOUS traffic.

Modified:
  stable/10/sys/dev/usb/controller/dwc_otg.c
  stable/10/sys/dev/usb/controller/dwc_otg.h
  stable/10/sys/dev/usb/controller/dwc_otgreg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Sat Aug 29 04:33:31 2015
(r287270)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Sat Aug 29 06:07:55 2015
(r287271)
@@ -1,6 +1,7 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2015 Daisuke Aoyama. All rights reserved.
+ * Copyright (c) 2012-2015 Hans Petter Selasky. All rights reserved.
  * Copyright (c) 2010-2011 Aleksandr Rybalko. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -152,7 +153,6 @@ static void dwc_otg_do_poll(struct usb_b
 static void dwc_otg_standard_done(struct usb_xfer *);
 static void dwc_otg_root_intr(struct dwc_otg_softc *);
 static void dwc_otg_interrupt_poll_locked(struct dwc_otg_softc *);
-static void dwc_otg_host_channel_disable(struct dwc_otg_softc *, uint8_t);
 
 /*
  * Here is a configuration that the chip supports.
@@ -225,7 +225,7 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
/* split equally for IN and OUT */
fifo_size /= 2;
 
-   /* align to 4 bytes boundary */
+   /* Align to 4 bytes boundary (refer to PGM) */
fifo_size = ~3;
 
/* set global receive FIFO size */
@@ -238,13 +238,6 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
return (EINVAL);
}
 
-   /* disable any leftover host channels */
-   for (x = 0; x != sc-sc_host_ch_max; x++) {
-   if (sc-sc_chan_state[x].wait_sof == 0)
-   continue;
-   dwc_otg_host_channel_disable(sc, x);
-   }
-
if (mode == DWC_MODE_HOST) {
 
/* reset active endpoints */
@@ -253,6 +246,8 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
/* split equally for periodic and non-periodic */
fifo_size /= 2;
 
+   DPRINTF(PTX/NPTX FIFO=%u\n, fifo_size);
+
/* align to 4 bytes boundary */
fifo_size = ~3;
 
@@ -263,7 +258,7 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
tx_start += fifo_size;
 
for (x = 0; x != sc-sc_host_ch_max; x++) {
-   /* disable all host interrupts */
+   /* enable all host interrupts */
DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x),
HCINT_DEFAULT_MASK);
}
@@ -275,13 +270,6 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
/* reset host channel state */
memset(sc-sc_chan_state, 0, sizeof(sc-sc_chan_state));
 
-   /* reset FIFO TX levels */
-   sc-sc_tx_cur_p_level = 0;
-   sc-sc_tx_cur_np_level = 0;
-
-   /* store maximum periodic and non-periodic FIFO TX size */
-   sc-sc_tx_max_size = fifo_size;
-
/* enable all host channel interrupts */
DWC_OTG_WRITE_4(sc, DOTG_HAINTMSK,
(1U  sc-sc_host_ch_max) - 1U);
@@ -314,32 +302,29 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
if (x  sc-sc_dev_in_ep_max) {
uint32_t limit;
 
-   limit = (x == 1) ? DWC_OTG_MAX_TXN :
-   (DWC_OTG_MAX_TXN / 2);
+   limit = (x == 1) ? MIN(DWC_OTG_TX_MAX_FIFO_SIZE,
+   DWC_OTG_MAX_TXN) : MIN(DWC_OTG_MAX_TXN / 2,
+   DWC_OTG_TX_MAX_FIFO_SIZE);
 
-   if (fifo_size = limit) {
-   DWC_OTG_WRITE_4(sc, DOTG_DIEPTXF(x),
-   ((limit / 4)  16) |
-   (tx_start / 4));
-   tx_start += limit;
-   fifo_size -= limit;
-   pf-usb.max_in_frame_size = 0x200;
-   pf-usb.support_in = 1;
+   /* see if there is enough FIFO space

svn commit: r292107 - in stable/10/sys: modules/mlxen ofed/drivers/net/mlx4 ofed/include/linux/mlx4

2015-12-11 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec 11 14:21:58 2015
New Revision: 292107
URL: https://svnweb.freebsd.org/changeset/base/292107

Log:
  MFC r290710, r291694, r291699 and r291793:
  - Fix print formatting compile warnings for Sparc64 and PowerPC platforms.
  - Updated the mlx4 and mlxen drivers to the latest version, v2.1.6:
- Added support for dumping the SFP EEPROM content to dmesg.
- Fixed handling of network interface capability IOCTLs.
- Fixed race when loading and unloading the mlxen driver by applying
  appropriate locking.
- Removed two unused C-files.
  - Convert the mlxen driver to use the BUSDMA(9) APIs instead of
vtophys() when loading mbufs for transmission and reception. While at
it all pointer arithmetic and cast qualifier issues were fixed, mostly
related to transmission and reception.
  - Fix i386 build WITH_OFED=YES. Remove some redundant KASSERTs.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4283
  Differential Revision:https://reviews.freebsd.org/D4284

Deleted:
  stable/10/sys/ofed/drivers/net/mlx4/en_ethtool.c
  stable/10/sys/ofed/drivers/net/mlx4/en_selftest.c
Modified:
  stable/10/sys/modules/mlxen/Makefile
  stable/10/sys/ofed/drivers/net/mlx4/en_main.c
  stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
  stable/10/sys/ofed/drivers/net/mlx4/en_port.c
  stable/10/sys/ofed/drivers/net/mlx4/en_rx.c
  stable/10/sys/ofed/drivers/net/mlx4/en_tx.c
  stable/10/sys/ofed/drivers/net/mlx4/main.c
  stable/10/sys/ofed/drivers/net/mlx4/mlx4.h
  stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h
  stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h
  stable/10/sys/ofed/drivers/net/mlx4/port.c
  stable/10/sys/ofed/include/linux/mlx4/cq.h
  stable/10/sys/ofed/include/linux/mlx4/device.h
  stable/10/sys/ofed/include/linux/mlx4/doorbell.h
  stable/10/sys/ofed/include/linux/mlx4/qp.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/modules/mlxen/Makefile
==
--- stable/10/sys/modules/mlxen/MakefileFri Dec 11 13:55:31 2015
(r292106)
+++ stable/10/sys/modules/mlxen/MakefileFri Dec 11 14:21:58 2015
(r292107)
@@ -26,4 +26,4 @@ opt_inet6.h:
 
 .include 
 
-CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
+CFLAGS+= ${GCC_MS_EXTENSIONS}

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_main.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_main.c   Fri Dec 11 13:55:31 
2015(r292106)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_main.c   Fri Dec 11 14:21:58 
2015(r292107)
@@ -42,14 +42,7 @@
 
 #include "mlx4_en.h"
 
-MODULE_AUTHOR("Liran Liss, Yevgeny Petrilin");
-MODULE_DESCRIPTION("Mellanox ConnectX HCA Ethernet driver");
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_VERSION(DRV_VERSION " ("DRV_RELDATE")");
-
-static const char mlx4_en_version[] =
-   DRV_NAME ": Mellanox ConnectX HCA Ethernet driver v"
-   DRV_VERSION " (" DRV_RELDATE ")\n";
+/* Mellanox ConnectX HCA Ethernet driver */
 
 #define MLX4_EN_PARM_INT(X, def_val, desc) \
static unsigned int X = def_val;\
@@ -174,8 +167,6 @@ static void *mlx4_en_add(struct mlx4_dev
int i;
int err;
 
-   printk_once(KERN_INFO "%s", mlx4_en_version);
-
mdev = kzalloc(sizeof *mdev, GFP_KERNEL);
if (!mdev) {
dev_err(>pdev->dev, "Device struct alloc failed, "

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 13:55:31 
2015(r292106)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 14:21:58 
2015(r292107)
@@ -659,8 +659,10 @@ static void mlx4_en_cache_mclist(struct 
 continue;
 /* Make sure the list didn't grow. */
tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC);
-   if (tmp == NULL)
+   if (tmp == NULL) {
+   en_err(priv, "Failed to allocate multicast list\n");
break;
+   }
memcpy(tmp->addr,
LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 
ETH_ALEN);
list_add_tail(>list, >mc_list);
@@ -971,12 +973,12 @@ static void mlx4_en_do_set_rx_mode(struc
if (!mlx4_en_QUERY_PORT(mdev, priv->port)) {
if (priv->port_state.link_state) {
priv->last_link_state = MLX4_DEV_EVENT_PORT_UP;
-   /* Important note: the following call for 
if_link_state_change
-* is needed for interface up scenario (start port, 
link state
-* change) */
/* update netif baudrate */

svn commit: r292113 - stable/10/sys/ofed/drivers/net/mlx4

2015-12-11 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec 11 15:35:47 2015
New Revision: 292113
URL: https://svnweb.freebsd.org/changeset/base/292113

Log:
  Enable the mlx4en TSO limits.
  
  This is a direct commit to stable/10.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 15:25:47 
2015(r292112)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Dec 11 15:35:47 
2015(r292113)
@@ -2174,12 +2174,10 @@ int mlx4_en_init_netdev(struct mlx4_en_d
if (mdev->LSO_support)
dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | 
IFCAP_VLAN_HWTSO;
 
-#if __FreeBSD_version >= 110
/* set TSO limits so that we don't have to drop TX packets */
dev->if_hw_tsomax = MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + 
ETHER_VLAN_ENCAP_LEN) /* hdr */;
dev->if_hw_tsomaxsegcount = MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */;
dev->if_hw_tsomaxsegsize = MLX4_EN_TX_MAX_MBUF_SIZE;
-#endif
 
dev->if_capenable = dev->if_capabilities;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r292192 - stable/10/sys/ofed/include/linux

2015-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 10:03:04 2015
New Revision: 292192
URL: https://svnweb.freebsd.org/changeset/base/292192

Log:
  MFC r290003:
  Add support for binding IRQs to CPUs in the LinuxKPI. The new function
  added is for BSD only and does not exist in Linux.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/interrupt.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/interrupt.h
==
--- stable/10/sys/ofed/include/linux/interrupt.hMon Dec 14 09:59:21 
2015(r292191)
+++ stable/10/sys/ofed/include/linux/interrupt.hMon Dec 14 10:03:04 
2015(r292192)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -117,6 +117,23 @@ request_irq(unsigned int irq, irq_handle
return 0;
 }
 
+static inline int
+bind_irq_to_cpu(unsigned int irq, int cpu_id)
+{
+   struct irq_ent *irqe;
+   struct device *dev;
+
+   dev = _pci_find_irq_dev(irq);
+   if (dev == NULL)
+   return (-ENOENT);
+
+   irqe = _irq_ent(dev, irq);
+   if (irqe == NULL)
+   return (-ENOENT);
+
+   return (-bus_bind_intr(dev->bsddev, irqe->res, cpu_id));
+}
+
 static inline void
 free_irq(unsigned int irq, void *device)
 {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r292185 - stable/10/sys/dev/usb/net

2015-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 09:46:46 2015
New Revision: 292185
URL: https://svnweb.freebsd.org/changeset/base/292185

Log:
  MFC r291953:
  When setting up VLANs on a Raspberry Pi ethernet port, the MTU drops
  from 1500 to 1496 bytes. The MTU should remain at 1500, extending the
  frame size as per IEEE 802.3. Adding IFCAP_VLAN_MTU to the
  if_capabilities field in the smsc driver solves the problem.  The
  datasheet for the LAN9512 chip, section 3.2.3 states that the chip
  supports the extended frame.
  
  Submitted by: r...@ci.com.au
  PR:   205050

Modified:
  stable/10/sys/dev/usb/net/if_smsc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/net/if_smsc.c
==
--- stable/10/sys/dev/usb/net/if_smsc.c Mon Dec 14 09:42:39 2015
(r292184)
+++ stable/10/sys/dev/usb/net/if_smsc.c Mon Dec 14 09:46:46 2015
(r292185)
@@ -1686,7 +1686,7 @@ smsc_attach_post_sub(struct usb_ether *u
/* The chip supports TCP/UDP checksum offloading on TX and RX paths, 
however
 * currently only RX checksum is supported in the driver (see top of 
file).
 */
-   ifp->if_capabilities |= IFCAP_RXCSUM;
+   ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_VLAN_MTU;
ifp->if_hwassist = 0;

/* TX checksuming is disabled (for now?)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r292190 - stable/10/sys/dev/mlx5/mlx5_en

2015-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 09:57:42 2015
New Revision: 292190
URL: https://svnweb.freebsd.org/changeset/base/292190

Log:
  MFC r291931:
  The firmware no longer supports setting a port MTU of zero bytes.
  Set the port MTU and then query it and report if any problems instead.
  
  Submitted by: Shahar Klein 
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4408

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 14 09:55:14 
2015(r292189)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 14 09:57:42 
2015(r292190)
@@ -2005,32 +2005,15 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp
struct mlx5e_priv *priv = ifp->if_softc;
struct mlx5_core_dev *mdev = priv->mdev;
int hw_mtu;
-   int min_mtu;
int err;
 
-   /*
-* Trying to set MTU to zero, in order
-* to find out the FW's minimal MTU
-*/
-   err = mlx5_set_port_mtu(mdev, 0);
-   if (err)
-   return (err);
 
-   err = mlx5_query_port_oper_mtu(mdev, _mtu);
+   err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(sw_mtu));
if (err) {
-   if_printf(ifp, "Query port minimal MTU failed\n");
+   if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, 
err=%d\n",
+   __func__, sw_mtu, err);
return (err);
}
-
-   if (sw_mtu < MLX5E_HW2SW_MTU(min_mtu)) {
-   ifp->if_mtu = sw_mtu;
-   return (0);
-   }
-
-   err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(sw_mtu));
-   if (err)
-   return (err);
-
err = mlx5_query_port_oper_mtu(mdev, _mtu);
if (!err) {
ifp->if_mtu = MLX5E_HW2SW_MTU(hw_mtu);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r292196 - in stable/10/sys: dev/mlx5 dev/mlx5/mlx5_core modules/mlx5

2015-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 10:31:03 2015
New Revision: 292196
URL: https://svnweb.freebsd.org/changeset/base/292196

Log:
  MFC r291939:
  Update the mlx5 shared driver code to the latest version, which
  include the following list of changes:
  
  - Added eswitch ACL table management
Introduce API for managing ACL table.
This API include the following features:
1) vlan filter - for VST/VGT+ support.
2) spoofcheck.
3) robust functionality to allow/drop general untagged/tagged traffic.
4) support for both ingress and egress ACL types.
  
  - Added loopback filter to the vacl table.
  
  - Added multicast list set in the vPort context
  
  - Added promiscuous mode set in the vPort context
  
  - Set the vlan list in vPort context
1) Check caps if VLAN list is not longer than FW supports
2) Set MODIFY_NIC_VPORT_CONTEXT command
  
  - Changed MLX5_EEPROM_MAX_BYTES from 48 to 32 so that a single EEPROM
reading cannot cross the 128-byte boundary. Previously reading the
MCIA register was done in batches of 48 bytes. The third reading
would then by-pass the 127th byte, which means that part of the low
page and part of the high page would be read at the same time, which
created a bug:
  1st: 0-47 bytes
  2nd: 48-95 bytes
  3rd: 96-143 bytes
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4411

Added:
  stable/10/sys/dev/mlx5/eswitch_vacl.h
 - copied unchanged from r291939, head/sys/dev/mlx5/eswitch_vacl.h
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_eswitch_vacl.c
 - copied, changed from r291939, 
head/sys/dev/mlx5/mlx5_core/mlx5_eswitch_vacl.c
Modified:
  stable/10/sys/dev/mlx5/device.h
  stable/10/sys/dev/mlx5/driver.h
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c
  stable/10/sys/dev/mlx5/vport.h
  stable/10/sys/modules/mlx5/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/device.h
==
--- stable/10/sys/dev/mlx5/device.h Mon Dec 14 10:18:04 2015
(r292195)
+++ stable/10/sys/dev/mlx5/device.h Mon Dec 14 10:31:03 2015
(r292196)
@@ -1023,6 +1023,25 @@ enum {
MLX5_MODIFY_ESW_VPORT_CONTEXT_FIELD_SELECT_CVLAN_INSERT = 1 << 3
 };
 
+enum {
+   MLX5_UC_ADDR_CHANGE = (1 << 0),
+   MLX5_MC_ADDR_CHANGE = (1 << 1),
+   MLX5_VLAN_CHANGE= (1 << 2),
+   MLX5_PROMISC_CHANGE = (1 << 3),
+   MLX5_MTU_CHANGE = (1 << 4),
+};
+
+enum mlx5_list_type {
+   MLX5_NIC_VPORT_LIST_TYPE_UC   = 0x0,
+   MLX5_NIC_VPORT_LIST_TYPE_MC   = 0x1,
+   MLX5_NIC_VPORT_LIST_TYPE_VLAN = 0x2,
+};
+
+enum {
+   MLX5_ESW_VPORT_ADMIN_STATE_DOWN  = 0x0,
+   MLX5_ESW_VPORT_ADMIN_STATE_UP= 0x1,
+   MLX5_ESW_VPORT_ADMIN_STATE_AUTO  = 0x2,
+};
 /* MLX5 DEV CAPs */
 
 /* TODO: EAT.ME */
@@ -1087,6 +1106,22 @@ enum mlx5_cap_type {
MLX5_GET(flow_table_eswitch_cap, \
 mdev->hca_caps_max[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
 
+#define MLX5_CAP_ESW_FLOWTABLE_EGRESS_ACL(mdev, cap) \
+   MLX5_CAP_ESW_FLOWTABLE(dev, \
+  flow_table_properties_esw_acl_egress.cap)
+
+#define MLX5_CAP_ESW_FLOWTABLE_EGRESS_ACL_MAX(mdev, cap) \
+   MLX5_CAP_ESW_FLOWTABLE_MAX(dev, \
+  flow_table_properties_esw_acl_egress.cap)
+
+#define MLX5_CAP_ESW_FLOWTABLE_INGRESS_ACL(mdev, cap) \
+   MLX5_CAP_ESW_FLOWTABLE(dev, \
+  flow_table_properties_esw_acl_ingress.cap)
+
+#define MLX5_CAP_ESW_FLOWTABLE_INGRESS_ACL_MAX(mdev, cap) \
+   MLX5_CAP_ESW_FLOWTABLE_MAX(dev, \
+  flow_table_properties_esw_acl_ingress.cap)
+
 #define MLX5_CAP_ESW(mdev, cap) \
MLX5_GET(e_switch_cap, \
 mdev->hca_caps_cur[MLX5_CAP_ESWITCH], cap)

Modified: stable/10/sys/dev/mlx5/driver.h
==
--- stable/10/sys/dev/mlx5/driver.h Mon Dec 14 10:18:04 2015
(r292195)
+++ stable/10/sys/dev/mlx5/driver.h Mon Dec 14 10:31:03 2015
(r292196)
@@ -934,7 +934,7 @@ struct mlx5_profile {
 };
 
 
-#define MLX5_EEPROM_MAX_BYTES  48
+#define MLX5_EEPROM_MAX_BYTES  32
 #define MLX5_EEPROM_IDENTIFIER_BYTE_MASK   0x00ff
 #define MLX5_EEPROM_REVISION_ID_BYTE_MASK  0xff00
 #define MLX5_EEPROM_PAGE_3_VALID_BIT_MASK  0x0004

Copied: stable/10/sys/dev/mlx5/eswitch_vacl.h (from r291939, 
head/sys/dev/mlx5/eswitch_vacl.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/sys/dev/mlx5/eswitch_vacl.h   Mon Dec 14 10:31:03 2015
(r292196, copy of r291939, head/sys/dev/mlx5/eswitch_vacl.h)
@@ -0,0 +1,46 @@
+/*-
+ * Copyright (c) 

svn commit: r292191 - stable/10/sys/dev/mlx5/mlx5_en

2015-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 09:59:21 2015
New Revision: 292191
URL: https://svnweb.freebsd.org/changeset/base/292191

Log:
  MFC r291932:
  Add support for setting the TX moderation mode via a sysctl entry. TX
  completion events can be moderated in the same way like RX completion
  events. Expose this functionality by a sysctl variable.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4409

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Dec 14 09:57:42 2015
(r292190)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Dec 14 09:59:21 2015
(r292191)
@@ -356,6 +356,7 @@ struct mlx5e_params {
u8  default_vlan_prio;
u8  num_tc;
u8  rx_cq_moderation_mode;
+   u8  tx_cq_moderation_mode;
u16 rx_cq_moderation_usec;
u16 rx_cq_moderation_pkts;
u16 tx_cq_moderation_usec;
@@ -381,6 +382,7 @@ struct mlx5e_params {
   m(+1, u64 rx_coalesce_mode, "rx_coalesce_mode", "0: EQE mode 1: CQE mode") \
   m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining 
tx packets") \
   m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx 
packets to join") \
+  m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \
   m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro")
 
 #defineMLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT))

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Dec 14 09:57:42 
2015(r292190)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Dec 14 09:59:21 
2015(r292191)
@@ -136,6 +136,11 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params_ethtool.rx_coalesce_mode = 1;
priv->params.rx_cq_moderation_mode = 
priv->params_ethtool.rx_coalesce_mode;
 
+   /* import TX mode */
+   if (priv->params_ethtool.tx_coalesce_mode != 0)
+   priv->params_ethtool.tx_coalesce_mode = 1;
+   priv->params.tx_cq_moderation_mode = 
priv->params_ethtool.tx_coalesce_mode;
+
/* import RX coal time */
if (priv->params_ethtool.rx_coalesce_usecs < 1)
priv->params_ethtool.rx_coalesce_usecs = 0;
@@ -460,6 +465,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *
priv->params_ethtool.rx_coalesce_mode = 
priv->params.rx_cq_moderation_mode;
priv->params_ethtool.rx_coalesce_usecs = 
priv->params.rx_cq_moderation_usec;
priv->params_ethtool.rx_coalesce_pkts = 
priv->params.rx_cq_moderation_pkts;
+   priv->params_ethtool.tx_coalesce_mode = 
priv->params.tx_cq_moderation_mode;
priv->params_ethtool.tx_coalesce_usecs = 
priv->params.tx_cq_moderation_usec;
priv->params_ethtool.tx_coalesce_pkts = 
priv->params.tx_cq_moderation_pkts;
priv->params_ethtool.hw_lro = priv->params.hw_lro_en;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 14 09:57:42 
2015(r292190)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 14 09:59:21 
2015(r292191)
@@ -1324,13 +1324,25 @@ static int
 mlx5e_open_tx_cqs(struct mlx5e_channel *c,
 struct mlx5e_channel_param *cparam)
 {
+   u8 tx_moderation_mode;
int err;
int tc;
 
+   switch (c->priv->params.tx_cq_moderation_mode) {
+   case 0:
+   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
+   break;
+   default:
+   if (MLX5_CAP_GEN(c->priv->mdev, cq_period_start_from_cqe))
+   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE;
+   else
+   tx_moderation_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
+   break;
+   }
for (tc = 0; tc < c->num_tc; tc++) {
/* open completion queue */
err = mlx5e_open_cq(c, >tx_cq, >sq[tc].cq,
-   _tx_cq_comp, MLX5_CQ_PERIOD_MODE_START_FROM_EQE);
+   _tx_cq_comp, tx_moderation_mode);
if (err)
goto err_close_tx_cqs;
}
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r292213 - stable/10/sys/i386/conf

2015-12-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 14 15:45:11 2015
New Revision: 292213
URL: https://svnweb.freebsd.org/changeset/base/292213

Log:
  Fix the XEN build by disabling the mlx5 and mlx5en modules
  when XEN is enabled.
  
  This is a direct commit to stable/10.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/i386/conf/XEN

Modified: stable/10/sys/i386/conf/XEN
==
--- stable/10/sys/i386/conf/XEN Mon Dec 14 15:44:34 2015(r292212)
+++ stable/10/sys/i386/conf/XEN Mon Dec 14 15:45:11 2015(r292213)
@@ -14,6 +14,9 @@ makeoptions   WITHOUT_MODULES="ctl cxgb dp
 # The following drivers don't work with PAE enabled.
 makeoptionsWITHOUT_MODULES+="asr ncr pst"
 
+# The following drivers don't build with XEN enabled.
+makeoptionsWITHOUT_MODULES+="mlx5 mlx5en"
+
 optionsSCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r292105 - stable/10/sys/ofed/include/linux

2015-12-11 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Dec 11 13:30:49 2015
New Revision: 292105
URL: https://svnweb.freebsd.org/changeset/base/292105

Log:
  MFC r291693:
  Add some structures and defines which will be used when decoding small
  form factor, SFF, standards compliant ethernet EEPROMs.
  
  Obtained from:Linux
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/etherdevice.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/etherdevice.h
==
--- stable/10/sys/ofed/include/linux/etherdevice.h  Fri Dec 11 13:20:51 
2015(r292104)
+++ stable/10/sys/ofed/include/linux/etherdevice.h  Fri Dec 11 13:30:49 
2015(r292105)
@@ -37,6 +37,25 @@
 
 #include 
 
+#defineETH_MODULE_SFF_8079 1
+#defineETH_MODULE_SFF_8079_LEN 256
+#defineETH_MODULE_SFF_8472 2
+#defineETH_MODULE_SFF_8472_LEN 512
+#defineETH_MODULE_SFF_8636 3
+#defineETH_MODULE_SFF_8636_LEN 256
+#defineETH_MODULE_SFF_8436 4
+#defineETH_MODULE_SFF_8436_LEN 256
+
+struct ethtool_eeprom {
+   u32 offset;
+   u32 len;
+};
+
+struct ethtool_modinfo {
+   u32 type;
+   u32 eeprom_len;
+};
+
 /**
  * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
  * @addr: Pointer to a six-byte array containing the Ethernet address
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293155 - in stable/10/sys/dev/mlx5: . mlx5_en

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:52:40 2016
New Revision: 293155
URL: https://svnweb.freebsd.org/changeset/base/293155

Log:
  MFC r292838:
  Add support for CQE zipping. CQE zipping reduces PCI overhead by
  coalescing and zipping multiple CQEs into a single merged CQE. The
  feature is enabled by default and can be disabled by a sysctl.
  
  Implementing this feature mlx5_cqwq_pop() has been separated from
  mlx5e_get_cqe().
  
  Submitted by: Mark Bloch 
  Differential Revision:https://reviews.freebsd.org/D4598
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/device.h
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/device.h
==
--- stable/10/sys/dev/mlx5/device.h Mon Jan  4 09:49:53 2016
(r293154)
+++ stable/10/sys/dev/mlx5/device.h Mon Jan  4 09:52:40 2016
(r293155)
@@ -1042,6 +1042,7 @@ enum {
MLX5_ESW_VPORT_ADMIN_STATE_UP= 0x1,
MLX5_ESW_VPORT_ADMIN_STATE_AUTO  = 0x2,
 };
+
 /* MLX5 DEV CAPs */
 
 /* TODO: EAT.ME */
@@ -1219,4 +1220,36 @@ struct mlx5_ifc_mcia_reg_bits {
 };
 
 #define MLX5_CMD_OP_QUERY_EEPROM 0x93c
+
+struct mlx5_mini_cqe8 {
+   union {
+   u32 rx_hash_result;
+   u32 checksum;
+   struct {
+   u16 wqe_counter;
+   u8  s_wqe_opcode;
+   u8  reserved;
+   } s_wqe_info;
+   };
+   u32 byte_cnt;
+};
+
+enum {
+   MLX5_NO_INLINE_DATA,
+   MLX5_INLINE_DATA32_SEG,
+   MLX5_INLINE_DATA64_SEG,
+   MLX5_COMPRESSED,
+};
+
+enum mlx5_exp_cqe_zip_recv_type {
+   MLX5_CQE_FORMAT_HASH,
+   MLX5_CQE_FORMAT_CSUM,
+};
+
+#define MLX5E_CQE_FORMAT_MASK 0xc
+static inline int mlx5_get_cqe_format(const struct mlx5_cqe64 *cqe)
+{
+   return (cqe->op_own & MLX5E_CQE_FORMAT_MASK) >> 2;
+}
+
 #endif /* MLX5_DEVICE_H */

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Jan  4 09:49:53 2016
(r293154)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Jan  4 09:52:40 2016
(r293155)
@@ -372,6 +372,7 @@ struct mlx5e_params {
u16 tx_cq_moderation_pkts;
u16 min_rx_wqes;
boolhw_lro_en;
+   boolcqe_zipping_en;
u32 lro_wqe_sz;
u16 rx_hash_log_tbl_sz;
 };
@@ -392,7 +393,8 @@ struct mlx5e_params {
   m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining 
tx packets") \
   m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx 
packets to join") \
   m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \
-  m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro")
+  m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \
+  m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled")
 
 #defineMLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT))
 

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:49:53 
2016(r293154)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:52:40 
2016(r293155)
@@ -204,6 +204,18 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params.hw_lro_en = false;
}
 
+   if (>params_ethtool.arg[arg2] ==
+   >params_ethtool.cqe_zipping) {
+   if (priv->params_ethtool.cqe_zipping &&
+   MLX5_CAP_GEN(priv->mdev, cqe_compression)) {
+   priv->params.cqe_zipping_en = true;
+   priv->params_ethtool.cqe_zipping = 1;
+   } else {
+   priv->params.cqe_zipping_en = false;
+   priv->params_ethtool.cqe_zipping = 0;
+   }
+   }
+
if (was_opened)
mlx5e_open_locked(priv->ifp);
 done:
@@ -472,6 +484,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *
priv->params_ethtool.tx_coalesce_usecs = 
priv->params.tx_cq_moderation_usec;
priv->params_ethtool.tx_coalesce_pkts = 
priv->params.tx_cq_moderation_pkts;
priv->params_ethtool.hw_lro = priv->params.hw_lro_en;
+   priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en;
 
/* create root node */
node = SYSCTL_ADD_NODE(>sysctl_ctx,

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==

svn commit: r293154 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:49:53 2016
New Revision: 293154
URL: https://svnweb.freebsd.org/changeset/base/293154

Log:
  MFC r292837:
  Add support for sysctl tunables to 10-stable and older. Pushed through
  head first to simplify driver maintenance.
  
  MFC after:1 week
  Submitted by: Drew Gallatin 
  Differential Revision:https://reviews.freebsd.org/D4552
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:47:20 
2016(r293153)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:49:53 
2016(r293154)
@@ -58,13 +58,17 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
 
PRIV_LOCK(priv);
value = priv->params_ethtool.arg[arg2];
-   error = sysctl_handle_64(oidp, , 0, req);
-   if (error || req->newptr == NULL ||
-   value == priv->params_ethtool.arg[arg2])
-   goto done;
+   if (req != NULL) {
+   error = sysctl_handle_64(oidp, , 0, req);
+   if (error || req->newptr == NULL ||
+   value == priv->params_ethtool.arg[arg2])
+   goto done;
 
-   /* assign new value */
-   priv->params_ethtool.arg[arg2] = value;
+   /* assign new value */
+   priv->params_ethtool.arg[arg2] = value;
+   } else {
+   error = 0;
+   }
 
/* check if device is gone */
if (priv->gone) {
@@ -483,10 +487,30 @@ mlx5e_create_ethtool(struct mlx5e_priv *
CTLFLAG_MPSAFE, priv, x, _ethtool_handler, 
"QU",
mlx5e_params_desc[2 * x + 1]);
} else {
+#if (__FreeBSD_version < 110)
+   char path[64];
+#endif
+   /*
+* NOTE: In FreeBSD-11 and newer the
+* CTLFLAG_RWTUN flag will take care of
+* loading default sysctl value from the
+* kernel environment, if any:
+*/
SYSCTL_ADD_PROC(>sysctl_ctx, 
SYSCTL_CHILDREN(node), OID_AUTO,
mlx5e_params_desc[2 * x], CTLTYPE_U64 | 
CTLFLAG_RWTUN |
CTLFLAG_MPSAFE, priv, x, _ethtool_handler, 
"QU",
mlx5e_params_desc[2 * x + 1]);
+
+#if (__FreeBSD_version < 110)
+   /* compute path for sysctl */
+   snprintf(path, sizeof(path), "dev.mce.%d.conf.%s",
+   device_get_unit(priv->mdev->pdev->dev.bsddev),
+   mlx5e_params_desc[2 * x]);
+
+   /* try to fetch tunable, if any */
+   if (TUNABLE_QUAD_FETCH(path, 
>params_ethtool.arg[x]))
+   mlx5e_ethtool_handler(NULL, priv, x, NULL);
+#endif
}
}
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293157 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:56:57 2016
New Revision: 293157
URL: https://svnweb.freebsd.org/changeset/base/293157

Log:
  MFC r292948:
  Allow I2C to read address 0x51 as well as address 0x50.
  
  Submitted by: Shahar Klein 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jan  4 09:55:21 
2016(r293156)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jan  4 09:56:57 
2016(r293157)
@@ -2298,6 +2298,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long co
int size_read = 0;
int module_num;
int max_mtu;
+   uint8_t read_addr;
 
priv = ifp->if_softc;
 
@@ -2484,11 +2485,21 @@ out:
}
 
/*
-* Note that we ignore i2c.addr here. The driver hardcodes
-* the address to 0x50, while standard expects it to be 0xA0.
+* Currently 0XA0 and 0xA2 are the only addresses permitted.
+* The internal conversion is as follows:
 */
+   if (i2c.dev_addr == 0xA0)
+   read_addr = MLX5E_I2C_ADDR_LOW;
+   else if (i2c.dev_addr == 0xA2)
+   read_addr = MLX5E_I2C_ADDR_HIGH;
+   else {
+   if_printf(ifp, "Query eeprom failed, "
+   "Invalid Address: %X\n", i2c.dev_addr);
+   error = EINVAL;
+   goto err_i2c;
+   }
error = mlx5_query_eeprom(priv->mdev,
-   MLX5E_I2C_ADDR_LOW, MLX5E_EEPROM_LOW_PAGE,
+   read_addr, MLX5E_EEPROM_LOW_PAGE,
(uint32_t)i2c.offset, (uint32_t)i2c.len, module_num,
(uint32_t *)i2c.data, _read);
if (error) {
@@ -2499,7 +2510,7 @@ out:
 
if (i2c.len > MLX5_EEPROM_MAX_BYTES) {
error = mlx5_query_eeprom(priv->mdev,
-   MLX5E_I2C_ADDR_LOW, MLX5E_EEPROM_LOW_PAGE,
+   read_addr, MLX5E_EEPROM_LOW_PAGE,
(uint32_t)(i2c.offset + size_read),
(uint32_t)(i2c.len - size_read), module_num,
(uint32_t *)(i2c.data + size_read), _read);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293158 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:58:16 2016
New Revision: 293158
URL: https://svnweb.freebsd.org/changeset/base/293158

Log:
  MFC r292949:
  Add support for modifying coalescing parameters runtime.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Jan  4 09:56:57 2016
(r293157)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Jan  4 09:58:16 2016
(r293158)
@@ -789,5 +789,6 @@ voidmlx5e_create_stats(struct sysctl_ct
 struct sysctl_oid_list *, const char *,
 const char **, unsigned, u64 *);
 void   mlx5e_send_nop(struct mlx5e_sq *, u32, bool);
+intmlx5e_refresh_channel_params(struct mlx5e_priv *);
 
 #endif /* _MLX5_EN_H_ */

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:56:57 
2016(r293157)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:58:16 
2016(r293158)
@@ -69,12 +69,49 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
} else {
error = 0;
}
-
/* check if device is gone */
if (priv->gone) {
error = ENXIO;
goto done;
}
+   /* import RX coal time */
+   if (priv->params_ethtool.rx_coalesce_usecs < 1)
+   priv->params_ethtool.rx_coalesce_usecs = 0;
+   else if (priv->params_ethtool.rx_coalesce_usecs >
+   MLX5E_FLD_MAX(cqc, cq_period)) {
+   priv->params_ethtool.rx_coalesce_usecs =
+   MLX5E_FLD_MAX(cqc, cq_period);
+   }
+   priv->params.rx_cq_moderation_usec = 
priv->params_ethtool.rx_coalesce_usecs;
+
+   /* import RX coal pkts */
+   if (priv->params_ethtool.rx_coalesce_pkts < 1)
+   priv->params_ethtool.rx_coalesce_pkts = 0;
+   else if (priv->params_ethtool.rx_coalesce_pkts >
+   MLX5E_FLD_MAX(cqc, cq_max_count)) {
+   priv->params_ethtool.rx_coalesce_pkts =
+   MLX5E_FLD_MAX(cqc, cq_max_count);
+   }
+   priv->params.rx_cq_moderation_pkts = 
priv->params_ethtool.rx_coalesce_pkts;
+
+   /* import TX coal time */
+   if (priv->params_ethtool.tx_coalesce_usecs < 1)
+   priv->params_ethtool.tx_coalesce_usecs = 0;
+   else if (priv->params_ethtool.tx_coalesce_usecs >
+   MLX5E_FLD_MAX(cqc, cq_period)) {
+   priv->params_ethtool.tx_coalesce_usecs =
+   MLX5E_FLD_MAX(cqc, cq_period);
+   }
+   priv->params.tx_cq_moderation_usec = 
priv->params_ethtool.tx_coalesce_usecs;
+
+   /* import TX coal pkts */
+   if (priv->params_ethtool.tx_coalesce_pkts < 1)
+   priv->params_ethtool.tx_coalesce_pkts = 0;
+   else if (priv->params_ethtool.tx_coalesce_pkts >
+   MLX5E_FLD_MAX(cqc, cq_max_count)) {
+   priv->params_ethtool.tx_coalesce_pkts = MLX5E_FLD_MAX(cqc, 
cq_max_count);
+   }
+   priv->params.tx_cq_moderation_pkts = 
priv->params_ethtool.tx_coalesce_pkts;
 
if (>params_ethtool.arg[arg2] == 
>params_ethtool.rx_pauseframe_control ||
>params_ethtool.arg[arg2] == 
>params_ethtool.tx_pauseframe_control) {
@@ -92,9 +129,19 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
}
 
was_opened = test_bit(MLX5E_STATE_OPENED, >state);
-   if (was_opened)
-   mlx5e_close_locked(priv->ifp);
+   if (was_opened) {
+   u64 *xarg = priv->params_ethtool.arg + arg2;
 
+   if (xarg == >params_ethtool.tx_coalesce_pkts ||
+   xarg == >params_ethtool.rx_coalesce_pkts ||
+   xarg == >params_ethtool.tx_coalesce_usecs ||
+   xarg == >params_ethtool.rx_coalesce_usecs) {
+   /* avoid downing and upping the network interface */
+   error = mlx5e_refresh_channel_params(priv);
+   goto done;
+   }
+   mlx5e_close_locked(priv->ifp);
+   }
/* import TX queue size */
if (priv->params_ethtool.tx_queue_size <
(1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) {
@@ -145,45 +192,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params_ethtool.tx_coalesce_mode = 1;
priv->params.tx_cq_moderation_mode = 
priv->params_ethtool.tx_coalesce_mode;
 
-   /* import RX coal time */
-   if (priv->params_ethtool.rx_coalesce_usecs < 1)
-   priv->params_ethtool.rx_coalesce_usecs = 0;
-   else if (priv->params_ethtool.rx_coalesce_usecs >
-  

svn commit: r293153 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:47:20 2016
New Revision: 293153
URL: https://svnweb.freebsd.org/changeset/base/293153

Log:
  MFC r292835:
  Make the eeprom dump function more readable and rename variables for
  better clarity.
  
  Submitted by: Daria Genzel 
  Differential Revision:https://reviews.freebsd.org/D4551
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:38:33 
2016(r293152)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cMon Jan  4 09:47:20 
2016(r293153)
@@ -319,34 +319,33 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv
 static void
 mlx5e_print_eeprom(struct mlx5e_eeprom *eeprom)
 {
-   int i, j = 0;
-   int row = 0;
+   int row;
+   int index_in_row;
+   int byte_to_write = 0;
+   int line_length = 16;
 
printf("\nOffset\t\tValues\n");
-   printf("--\t\t--\n");
-   while (row < eeprom->len) {
-   printf("0x%04x\t\t", row);
-   for (i = 0; i < 16; i++) {
-   printf("%02x ", ((u8 *)eeprom->data)[j]);
-   j++;
-   row++;
+   printf("--\t\t--");
+   while (byte_to_write < eeprom->len) {
+   printf("\n0x%04X\t\t", byte_to_write);
+   for (index_in_row = 0; index_in_row < line_length; 
index_in_row++) {
+   printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]);
+   byte_to_write++;
}
-   printf("\n");
}
 
if (eeprom->page_valid) {
row = MLX5E_EEPROM_HIGH_PAGE_OFFSET;
-   printf("\nUpper Page 0x03\n");
+   printf("\n\nUpper Page 0x03\n");
printf("\nOffset\t\tValues\n");
-   printf("--\t\t--\n");
+   printf("--\t\t--");
while (row < MLX5E_EEPROM_PAGE_LENGTH) {
-   printf("0x%04x\t\t", row);
-   for (i = 0; i < 16; i++) {
-   printf("%02x ", ((u8 *)eeprom->data)[j]);
-   j++;
+   printf("\n0x%04X\t\t", row);
+   for (index_in_row = 0; index_in_row < line_length; 
index_in_row++) {
+   printf("%02X ", ((u8 
*)eeprom->data)[byte_to_write]);
+   byte_to_write++;
row++;
}
-   printf("\n");
}
}
 }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293156 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:55:21 2016
New Revision: 293156
URL: https://svnweb.freebsd.org/changeset/base/293156

Log:
  MFC r292946:
  10G ER/LR should present itself as LR.
  
  MFC after:1 week
  Submitted by: Shahar Klein 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Jan  4 09:52:40 2016
(r293155)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Jan  4 09:55:21 2016
(r293156)
@@ -700,7 +700,7 @@ enum mlx5e_link_mode {
MLX5E_56GBASE_R4 = 8,
MLX5E_10GBASE_CR = 12,
MLX5E_10GBASE_SR = 13,
-   MLX5E_10GBASE_ER = 14,
+   MLX5E_10GBASE_LR = 14,
MLX5E_40GBASE_SR4 = 15,
MLX5E_40GBASE_LR4 = 16,
MLX5E_100GBASE_CR4 = 20,

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jan  4 09:52:40 
2016(r293155)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Jan  4 09:55:21 
2016(r293156)
@@ -106,8 +106,8 @@ static const struct {
.subtype = IFM_10G_SR,
.baudrate = IF_Gbps(10ULL),
},
-   [MLX5E_10GBASE_ER] = {
-   .subtype = IFM_10G_ER,
+   [MLX5E_10GBASE_LR] = {
+   .subtype = IFM_10G_LR,
.baudrate = IF_Gbps(10ULL),
},
[MLX5E_40GBASE_SR4] = {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293146 - stable/10/sys/dev/usb/controller

2016-01-03 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 07:27:58 2016
New Revision: 293146
URL: https://svnweb.freebsd.org/changeset/base/293146

Log:
  MFC r291199:
  Fix compile warning about shifting signed negative constant.

Modified:
  stable/10/sys/dev/usb/controller/uhci.h

Modified: stable/10/sys/dev/usb/controller/uhci.h
==
--- stable/10/sys/dev/usb/controller/uhci.h Mon Jan  4 07:11:15 2016
(r293145)
+++ stable/10/sys/dev/usb/controller/uhci.h Mon Jan  4 07:27:58 2016
(r293146)
@@ -97,7 +97,7 @@ struct uhci_td {
 #defineUHCI_TD_GET_ENDPT(s)(((s) >> 15) & 0xf)
 #defineUHCI_TD_SET_DT(t)   ((t) << 19)
 #defineUHCI_TD_GET_DT(s)   (((s) >> 19) & 1)
-#defineUHCI_TD_SET_MAXLEN(l)   (((l)-1) << 21)
+#defineUHCI_TD_SET_MAXLEN(l)   (((l)-1U) << 21)
 #defineUHCI_TD_GET_MAXLEN(s)   s) >> 21) + 1) & 0x7ff)
 #defineUHCI_TD_MAXLEN_MASK 0xffe0
volatile uint32_t td_buffer;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293151 - stable/10/sys/ofed/include/linux

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:37:05 2016
New Revision: 293151
URL: https://svnweb.freebsd.org/changeset/base/293151

Log:
  MFC r289563,r291481,r292537,r292538,r292542,r292543,r292544 and r292834:
  
  Update the LinuxKPI:
  - Add more functions and types.
  - Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE().
  - Implement sleepable RCU mechanism using shared exclusive locks.
  - Minor workqueue cleanup:
- Make some functions global instead of inline to ease debugging.
- Fix some minor style issues.
  - In the zero delay case in queue_delayed_work() use the return value
from taskqueue_enqueue() instead of reading "ta_pending" unlocked and
also ensure the callout is stopped before proceeding.
  - Implement drain_workqueue() function.
  - Reduce memory consumption when allocating kobject strings in the
LinuxKPI. Compute string length before allocating memory instead of
using fixed size allocations. Make kobject_set_name_vargs() global
instead of inline to save some bytes when compiling.
  
  Sponsored by: Mellanox Technologies

Added:
  stable/10/sys/ofed/include/linux/srcu.h   (contents, props changed)
Modified:
  stable/10/sys/ofed/include/linux/compiler.h
  stable/10/sys/ofed/include/linux/file.h
  stable/10/sys/ofed/include/linux/kobject.h
  stable/10/sys/ofed/include/linux/linux_compat.c
  stable/10/sys/ofed/include/linux/types.h
  stable/10/sys/ofed/include/linux/workqueue.h
Directory Properties:
  stable/10/   (props changed)
  stable/10/sys/gnu/dts/   (props changed)

Modified: stable/10/sys/ofed/include/linux/compiler.h
==
--- stable/10/sys/ofed/include/linux/compiler.h Mon Jan  4 08:41:13 2016
(r293150)
+++ stable/10/sys/ofed/include/linux/compiler.h Mon Jan  4 09:37:05 2016
(r293151)
@@ -2,7 +2,8 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
+ * Copyright (c) 2015 François Tigeot
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -62,5 +63,28 @@
 #define typeof(x)  __typeof(x)
 
 #defineuninitialized_var(x)x = x
+#define__read_mostly __attribute__((__section__(".data.read_mostly")))
+#define__always_unused __unused
+#define__must_check__result_use_check
+
+#define__printf(a,b)   __printflike(a,b)
+
+#definebarrier()   __asm__ __volatile__("": : 
:"memory")
+
+#defineACCESS_ONCE(x)  (*(volatile __typeof(x) *)&(x))
+  
+#defineWRITE_ONCE(x,v) do {\
+   barrier();  \
+   ACCESS_ONCE(x) = (v);   \
+   barrier();  \
+} while (0)
+
+#defineREAD_ONCE(x) ({ \
+   __typeof(x) __var;  \
+   barrier();  \
+   __var = ACCESS_ONCE(x); \
+   barrier();  \
+   __var;  \
+})
 
 #endif /* _LINUX_COMPILER_H_ */

Modified: stable/10/sys/ofed/include/linux/file.h
==
--- stable/10/sys/ofed/include/linux/file.h Mon Jan  4 08:41:13 2016
(r293150)
+++ stable/10/sys/ofed/include/linux/file.h Mon Jan  4 09:37:05 2016
(r293151)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -119,6 +119,21 @@ get_unused_fd(void)
return fd;
 }
 
+static inline int
+get_unused_fd_flags(int flags)
+{
+   struct file *file;
+   int error;
+   int fd;
+
+   error = falloc(curthread, , , flags);
+   if (error)
+   return -error;
+   /* drop the extra reference */
+   fdrop(file, curthread);
+   return fd;
+}
+
 static inline struct linux_file *
 alloc_file(int mode, const struct file_operations *fops)
 {

Modified: stable/10/sys/ofed/include/linux/kobject.h
==
--- stable/10/sys/ofed/include/linux/kobject.h  Mon Jan  4 08:41:13 2016
(r293150)
+++ stable/10/sys/ofed/include/linux/kobject.h  Mon Jan  4 09:37:05 2016
(r293151)
@@ -87,29 +87,7 @@ kobject_get(struct kobject *kobj)
return kobj;
 }
 
-static inline int
-kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list args)
-{
-   char *old;
-   char *name;
-
-   old = kobj->name;
-
-   

svn commit: r293152 - stable/10

2016-01-04 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan  4 09:38:33 2016
New Revision: 293152
URL: https://svnweb.freebsd.org/changeset/base/293152

Log:
  Add missed mergeinfo.

Modified:
Directory Properties:
  stable/10/   (props changed)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r291064 - stable/10/sys/dev/usb/controller

2015-11-19 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov 19 09:57:41 2015
New Revision: 291064
URL: https://svnweb.freebsd.org/changeset/base/291064

Log:
  MFC r290542:
  Avoid using the bounce buffer when the source or destination buffer is
  32-bits aligned. Merge the two bounce buffers into a single one. Some
  rough tests showed that the DWC OTG throughput on RPI2 increased by
  10% after this patch.

Modified:
  stable/10/sys/dev/usb/controller/dwc_otg.c
  stable/10/sys/dev/usb/controller/dwc_otg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Thu Nov 19 09:54:28 2015
(r291063)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Thu Nov 19 09:57:41 2015
(r291064)
@@ -182,6 +182,110 @@ dwc_otg_get_hw_ep_profile(struct usb_dev
 }
 
 static void
+dwc_otg_write_fifo(struct dwc_otg_softc *sc, struct usb_page_cache *pc,
+uint32_t offset, uint32_t fifo, uint32_t count)
+{
+   uint32_t temp;
+
+   /* round down length to nearest 4-bytes */
+   temp = count & ~3;
+
+   /* check if we can write the data directly */
+   if (temp != 0 && usb_pc_buffer_is_aligned(pc, offset, temp, 3)) {
+   struct usb_page_search buf_res;
+
+   /* pre-subtract length */
+   count -= temp;
+
+   /* iterate buffer list */
+   do {
+   /* get current buffer pointer */
+   usbd_get_page(pc, offset, _res);
+
+   if (buf_res.length > temp)
+   buf_res.length = temp;
+
+   /* transfer data into FIFO */
+   bus_space_write_region_4(sc->sc_io_tag, sc->sc_io_hdl,
+   fifo, buf_res.buffer, buf_res.length / 4);
+
+   offset += buf_res.length;
+   fifo += buf_res.length;
+   temp -= buf_res.length;
+   } while (temp != 0);
+   }
+
+   /* check for remainder */
+   if (count != 0) {
+   /* clear topmost word before copy */
+   sc->sc_bounce_buffer[(count - 1) / 4] = 0;
+
+   /* copy out data */
+   usbd_copy_out(pc, offset,
+   sc->sc_bounce_buffer, count);
+
+   /* transfer data into FIFO */
+   bus_space_write_region_4(sc->sc_io_tag,
+   sc->sc_io_hdl, fifo, sc->sc_bounce_buffer,
+   (count + 3) / 4);
+   }
+}
+
+static void
+dwc_otg_read_fifo(struct dwc_otg_softc *sc, struct usb_page_cache *pc,
+uint32_t offset, uint32_t count)
+{
+   uint32_t temp;
+
+   /* round down length to nearest 4-bytes */
+   temp = count & ~3;
+
+   /* check if we can read the data directly */
+   if (temp != 0 && usb_pc_buffer_is_aligned(pc, offset, temp, 3)) {
+   struct usb_page_search buf_res;
+
+   /* pre-subtract length */
+   count -= temp;
+
+   /* iterate buffer list */
+   do {
+   /* get current buffer pointer */
+   usbd_get_page(pc, offset, _res);
+
+   if (buf_res.length > temp)
+   buf_res.length = temp;
+
+   /* transfer data from FIFO */
+   bus_space_read_region_4(sc->sc_io_tag, sc->sc_io_hdl,
+   sc->sc_current_rx_fifo, buf_res.buffer, 
buf_res.length / 4);
+
+   offset += buf_res.length;
+   sc->sc_current_rx_fifo += buf_res.length;
+   sc->sc_current_rx_bytes -= buf_res.length;
+   temp -= buf_res.length;
+   } while (temp != 0);
+   }
+
+   /* check for remainder */
+   if (count != 0) {
+   /* read data into bounce buffer */
+   bus_space_read_region_4(sc->sc_io_tag, sc->sc_io_hdl,
+   sc->sc_current_rx_fifo,
+   sc->sc_bounce_buffer, (count + 3) / 4);
+
+   /* store data into proper buffer */
+   usbd_copy_in(pc, offset, sc->sc_bounce_buffer, count);
+
+   /* round length up to nearest 4 bytes */
+   count = (count + 3) & ~3;
+
+   /* update counters */
+   sc->sc_current_rx_bytes -= count;
+   sc->sc_current_rx_fifo += count;
+   }
+}
+
+static void
 dwc_otg_tx_fifo_reset(struct dwc_otg_softc *sc, uint32_t value)
 {
uint32_t temp;
@@ -580,6 +684,14 @@ dwc_otg_common_rx_ack(struct dwc_otg_sof
sc->sc_irq_mask |= GINTMSK_RXFLVLMSK;
DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask);
 
+   if (sc->sc_current_rx_bytes != 0) {
+   /* need to dump remaining data */
+   

svn commit: r291062 - stable/10/sys/dev/usb

2015-11-19 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov 19 09:52:46 2015
New Revision: 291062
URL: https://svnweb.freebsd.org/changeset/base/291062

Log:
  MFC r290489:
  Add helper function to check if a USB page cache buffer is properly
  aligned to reduce the use of bounce buffers in PIO mode.

Modified:
  stable/10/sys/dev/usb/usb_busdma.c
  stable/10/sys/dev/usb/usb_busdma.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_busdma.c
==
--- stable/10/sys/dev/usb/usb_busdma.c  Thu Nov 19 08:04:05 2015
(r291061)
+++ stable/10/sys/dev/usb/usb_busdma.c  Thu Nov 19 09:52:46 2015
(r291062)
@@ -134,6 +134,35 @@ usbd_get_page(struct usb_page_cache *pc,
 }
 
 /**
+ *  usb_pc_buffer_is_aligned - verify alignment
+ * 
+ * This function is used to check if a page cache buffer is properly
+ * aligned to reduce the use of bounce buffers in PIO mode.
+ **/
+uint8_t
+usb_pc_buffer_is_aligned(struct usb_page_cache *pc, usb_frlength_t offset,
+usb_frlength_t len, usb_frlength_t mask)
+{
+   struct usb_page_search buf_res;
+
+   while (len != 0) {
+
+   usbd_get_page(pc, offset, _res);
+
+   if (buf_res.length > len)
+   buf_res.length = len;
+   if (USB_P2U(buf_res.buffer) & mask)
+   return (0);
+   if (buf_res.length & mask)
+   return (0);
+
+   offset += buf_res.length;
+   len -= buf_res.length;
+   }
+   return (1);
+}
+
+/**
  *  usbd_copy_in - copy directly to DMA-able memory
  **/
 void

Modified: stable/10/sys/dev/usb/usb_busdma.h
==
--- stable/10/sys/dev/usb/usb_busdma.h  Thu Nov 19 08:04:05 2015
(r291061)
+++ stable/10/sys/dev/usb/usb_busdma.h  Thu Nov 19 09:52:46 2015
(r291062)
@@ -159,5 +159,8 @@ voidusb_pc_cpu_flush(struct usb_page_ca
 void   usb_pc_cpu_invalidate(struct usb_page_cache *pc);
 void   usb_pc_dmamap_destroy(struct usb_page_cache *pc);
 void   usb_pc_free_mem(struct usb_page_cache *pc);
+uint8_tusb_pc_buffer_is_aligned(struct usb_page_cache *pc,
+   usb_frlength_t offset, usb_frlength_t len,
+   usb_frlength_t mask);
 
 #endif /* _USB_BUSDMA_H_ */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r291184 - in stable/10/sys: dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 modules/mlx5en

2015-11-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 23 09:32:32 2015
New Revision: 291184
URL: https://svnweb.freebsd.org/changeset/base/291184

Log:
  MFC r290650, r290709, r291067, r291068, r291069 and r291070:
  Add mlx5 and mlx5en driver(s) for ConnectX-4 and ConnectX-4LX cards
  from Mellanox Technologies. The current driver supports ethernet
  speeds up to and including 100 GBit/s. Infiniband support will be
  done later.
  
  The code added is not compiled by default, which will be done by a
  separate commit.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4177
  Differential Revision:https://reviews.freebsd.org/D4178
  Differential Revision:https://reviews.freebsd.org/D4179
  Differential Revision:https://reviews.freebsd.org/D4180

Added:
  stable/10/sys/dev/mlx5/
 - copied from r290650, head/sys/dev/mlx5/
  stable/10/sys/modules/mlx5/
 - copied from r290650, head/sys/modules/mlx5/
  stable/10/sys/modules/mlx5en/
 - copied from r290650, head/sys/modules/mlx5en/
Modified:
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  stable/10/sys/dev/mlx5/mlx5_en/tcp_tlro.c
  stable/10/sys/dev/mlx5/mlx5_en/tcp_tlro.h
  stable/10/sys/modules/mlx5/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Tue Nov 10 12:20:22 2015
(r290650)
+++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c  Mon Nov 23 09:32:32 
2015(r291184)
@@ -115,7 +115,7 @@ static void print_health_info(struct mlx
printf("mlx5_core: INFO: ""ext_sync 0x%04x\n", read_be16(>ext_sync));
 }
 
-static void poll_health(uintptr_t data)
+static void poll_health(unsigned long data)
 {
struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data;
struct mlx5_core_health *health = >priv.health;
@@ -155,7 +155,7 @@ void mlx5_start_health_poll(struct mlx5_
health->health = >iseg->health;
health->health_counter = >iseg->health_counter;
 
-   setup_timer(>timer, poll_health, (uintptr_t)dev);
+   setup_timer(>timer, poll_health, (unsigned long)dev);
mod_timer(>timer,
  round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL));
 }

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Tue Nov 10 12:20:22 2015
(r290650)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Nov 23 09:32:32 2015
(r291184)
@@ -74,9 +74,9 @@
 #defineMLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE0xd
 
 /* freeBSD HW LRO is limited by 16KB - the size of max mbuf */
-#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES
+#defineMLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES
 #defineMLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC  0x10
-#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE0x3
+#defineMLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3
 #defineMLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS  0x20
 #defineMLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC  0x10
 #defineMLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS  0x20
@@ -89,13 +89,14 @@
 ((swmtu) + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN))
 #defineMLX5E_SW2MB_MTU(swmtu) \
 (MLX5E_SW2HW_MTU(swmtu) + MLX5E_NET_IP_ALIGN)
-#define MLX5E_MTU_MIN  72  /* Min 
MTU allowed by the kernel */
-#define MLX5E_MTU_MAX  MIN(ETHERMTU_JUMBO, MJUM16BYTES)/* Max 
MTU of Ethernet jumbo frames */
+#defineMLX5E_MTU_MIN   72  /* Min MTU allowed by the 
kernel */
+#defineMLX5E_MTU_MAX   MIN(ETHERMTU_JUMBO, MJUM16BYTES)
/* Max MTU of Ethernet
+* 
jumbo frames */
 
 #defineMLX5E_BUDGET_MAX8192/* RX and TX */
 #defineMLX5E_RX_BUDGET_MAX 256
 #defineMLX5E_SQ_BF_BUDGET  16
-#define MLX5E_SQ_TX_QUEUE_SIZE 4096/* SQ drbr queue size */
+#defineMLX5E_SQ_TX_QUEUE_SIZE  4096/* SQ drbr queue size */
 
 #defineMLX5E_MAX_TX_NUM_TC 8   /* units */
 #defineMLX5E_MAX_TX_HEADER 128 /* bytes */
@@ -141,6 +142,7 @@ typedef void (mlx5e_cq_comp_t)(struct ml
   m(+1, u64 rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast 
bytes") \
   m(+1, u64 tx_broadcast_packets, "tx_broadcast_packets", "Transmitted 
broadcast packets") \
   m(+1, u64 

svn commit: r291202 - stable/10/sys/dev/ti

2015-11-23 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Nov 23 13:36:41 2015
New Revision: 291202
URL: https://svnweb.freebsd.org/changeset/base/291202

Log:
  MFC r284722 and r284724:
  Fix endless recursion in ti(4)'s ti_ifmedia_upd(), found by clang 3.7.0.

Modified:
  stable/10/sys/dev/ti/if_ti.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ti/if_ti.c
==
--- stable/10/sys/dev/ti/if_ti.cMon Nov 23 13:30:13 2015
(r291201)
+++ stable/10/sys/dev/ti/if_ti.cMon Nov 23 13:36:41 2015
(r291202)
@@ -3335,7 +3335,7 @@ ti_ifmedia_upd(struct ifnet *ifp)
 
sc = ifp->if_softc;
TI_LOCK(sc);
-   error = ti_ifmedia_upd(ifp);
+   error = ti_ifmedia_upd_locked(sc);
TI_UNLOCK(sc);
 
return (error);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r291250 - stable/10/sys/dev/usb

2015-11-24 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 24 12:17:00 2015
New Revision: 291250
URL: https://svnweb.freebsd.org/changeset/base/291250

Log:
  MFC r290326:
  Relax the BUS_DMA_KEEP_PG_OFFSET requirement to allow optimising
  allocation of DMA bounce buffers.
  
  Discussed with:   ian @

Modified:
  stable/10/sys/dev/usb/usb_busdma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_busdma.c
==
--- stable/10/sys/dev/usb/usb_busdma.c  Tue Nov 24 12:11:56 2015
(r291249)
+++ stable/10/sys/dev/usb/usb_busdma.c  Tue Nov 24 12:17:00 2015
(r291250)
@@ -474,9 +474,13 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
pc->page_offset_buf = rem;
pc->page_offset_end += rem;
 #ifdef USB_DEBUG
-   if (rem != (USB_P2U(pc->buffer) & (USB_PAGE_SIZE - 1))) {
+   if (nseg > 1 &&
+   ((segs->ds_addr + segs->ds_len) & (USB_PAGE_SIZE - 1)) !=
+   ((segs + 1)->ds_addr & (USB_PAGE_SIZE - 1))) {
/*
-* This check verifies that the physical address is correct:
+* This check verifies there is no page offset hole
+* between the first and second segment. See the
+* BUS_DMA_KEEP_PG_OFFSET flag.
 */
DPRINTFN(0, "Page offset was not preserved\n");
error = 1;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r291254 - stable/10/sys/dev/usb/input

2015-11-24 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 24 12:28:36 2015
New Revision: 291254
URL: https://svnweb.freebsd.org/changeset/base/291254

Log:
  MFC r291146:
  Add support for Kana and Eisu keys to the USB keyboard driver.
  
  PR:   204709

Modified:
  stable/10/sys/dev/usb/input/ukbd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/input/ukbd.c
==
--- stable/10/sys/dev/usb/input/ukbd.c  Tue Nov 24 12:25:34 2015
(r291253)
+++ stable/10/sys/dev/usb/input/ukbd.c  Tue Nov 24 12:28:36 2015
(r291254)
@@ -302,6 +302,10 @@ static const struct ukbd_mods ukbd_mods[
  * 0x68: F13
  * 0x69: F14
  * 0x6a: F15
+ * 
+ * USB Apple Keyboard JIS generates:
+ * 0x90: Kana
+ * 0x91: Eisu
  */
 static const uint8_t ukbd_trtab[256] = {
0, 0, 0, 0, 30, 48, 46, 32, /* 00 - 07 */
@@ -322,7 +326,7 @@ static const uint8_t ukbd_trtab[256] = {
109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */
121, 120, NN, NN, NN, NN, NN, 123,  /* 80 - 87 */
124, 125, 126, 127, 128, NN, NN, NN,/* 88 - 8F */
-   NN, NN, NN, NN, NN, NN, NN, NN, /* 90 - 97 */
+   129, 130, NN, NN, NN, NN, NN, NN,   /* 90 - 97 */
NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */
NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */
NN, NN, NN, NN, NN, NN, NN, NN, /* A8 - AF */
@@ -2070,7 +2074,7 @@ ukbd_key2scan(struct ukbd_softc *sc, int
0x166,  /* Sun Type 6 Find */
0x167,  /* Sun Type 6 Cut */
0x125,  /* Sun Type 6 Mute */
-   /* 120 - 128 */
+   /* 120 - 130 */
0x11f,  /* Sun Type 6 VolumeDown */
0x11e,  /* Sun Type 6 VolumeUp */
0x120,  /* Sun Type 6 PowerDown */
@@ -2082,6 +2086,8 @@ ukbd_key2scan(struct ukbd_softc *sc, int
0x79,   /* Keyboard Intl' 4 (Henkan) */
0x7b,   /* Keyboard Intl' 5 (Muhenkan) */
0x5c,   /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */
+   0x71,   /* Apple Keyboard JIS (Kana) */
+   0x72,   /* Apple Keyboard JIS (Eisu) */
};
 
if ((code >= 89) && (code < (int)(89 + (sizeof(scan) / 
sizeof(scan[0]) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r291253 - stable/10/usr.sbin/bluetooth/bthidd

2015-11-24 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 24 12:25:34 2015
New Revision: 291253
URL: https://svnweb.freebsd.org/changeset/base/291253

Log:
  MFC r291145:
  Fix scancodes for Kana and Eisu keys.
  
  PR:   204709

Modified:
  stable/10/usr.sbin/bluetooth/bthidd/kbd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bluetooth/bthidd/kbd.c
==
--- stable/10/usr.sbin/bluetooth/bthidd/kbd.c   Tue Nov 24 12:23:15 2015
(r291252)
+++ stable/10/usr.sbin/bluetooth/bthidd/kbd.c   Tue Nov 24 12:25:34 2015
(r291253)
@@ -225,8 +225,8 @@ static int32_t constx[] =
 /* Keyboard Int'l 7 8D */ -1,   /* Unassigned */
 /* Keyboard Int'l 8 8E */ -1,   /* Unassigned */
 /* Keyboard Int'l 9 8F */ -1,   /* Unassigned */
-/* Keyboard Lang 1  90 */ 0x71, /* eisu */
-/* Keyboard Lang 2  91 */ 0x72, /* kana */
+/* Keyboard Lang 1  90 */ 0x71, /* Kana */
+/* Keyboard Lang 2  91 */ 0x72, /* Eisu */
 /* Keyboard Lang 3  92 */ 0x78, /* F8 */
 /* Keyboard Lang 4  93 */ 0x77, /* F7 */
 /* Keyboard Lang 5  94 */ 0x76, /* F6 */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r293735 - stable/10/sys/dev/usb/controller

2016-01-12 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jan 12 08:49:40 2016
New Revision: 293735
URL: https://svnweb.freebsd.org/changeset/base/293735

Log:
  MFC r293192:
  Fix for directly connected FULL or LOW speed USB devices.

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

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Tue Jan 12 08:32:53 2016
(r293734)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Tue Jan 12 08:49:40 2016
(r293735)
@@ -457,6 +457,18 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
return (0);
 }
 
+static uint8_t
+dwc_otg_uses_split(struct usb_device *udev)
+{
+   /*
+* When a LOW or FULL speed device is connected directly to
+* the USB port we don't use split transactions:
+*/ 
+   return (udev->speed != USB_SPEED_HIGH &&
+   udev->parent_hs_hub != NULL &&
+   udev->parent_hs_hub->parent_hub != NULL);
+}
+
 static void
 dwc_otg_update_host_frame_interval(struct dwc_otg_softc *sc)
 {
@@ -3325,16 +3337,16 @@ dwc_otg_setup_standard_chain(struct usb_
else
hcchar |= (td->ep_type << HCCHAR_EPTYPE_SHIFT);
 
-   if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_LOW)
-   hcchar |= HCCHAR_LSPDDEV;
if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN)
hcchar |= HCCHAR_EPDIR_IN;
 
switch (xfer->xroot->udev->speed) {
-   case USB_SPEED_FULL:
case USB_SPEED_LOW:
+   hcchar |= HCCHAR_LSPDDEV;
+   /* FALLTHROUGH */
+   case USB_SPEED_FULL:
/* check if root HUB port is running High Speed */
-   if (xfer->xroot->udev->parent_hs_hub != NULL) {
+   if (dwc_otg_uses_split(xfer->xroot->udev)) {
hcsplt = HCSPLT_SPLTENA |
(xfer->xroot->udev->hs_port_no <<
HCSPLT_PRTADDR_SHIFT) |
@@ -4156,7 +4168,10 @@ dwc_otg_device_isoc_start(struct usb_xfe
framenum = DSTS_SOFFN_GET(temp);
}
 
-   if (xfer->xroot->udev->parent_hs_hub != NULL)
+   /*
+* Check if port is doing 8000 or 1000 frames per second:
+*/
+   if (sc->sc_flags.status_high_speed)
framenum /= 8;
 
framenum &= DWC_OTG_FRAME_MASK;
@@ -4833,7 +4848,7 @@ dwc_otg_xfer_setup(struct usb_setup_para
td = USB_ADD_BYTES(parm->buf, parm->size[0]);
 
/* compute shared bandwidth resource index for TT */
-   if (parm->udev->parent_hs_hub != NULL && 
parm->udev->speed != USB_SPEED_HIGH) {
+   if (dwc_otg_uses_split(parm->udev)) {
if 
(parm->udev->parent_hs_hub->ddesc.bDeviceProtocol == UDPROTO_HSHUBMTT)
td->tt_index = parm->udev->device_index;
else
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301250 - stable/10/sys/dev/usb

2016-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  3 08:49:04 2016
New Revision: 301250
URL: https://svnweb.freebsd.org/changeset/base/301250

Log:
  MFC r299060:
  Extend the UQ_NO_STRINGS quirk to also cover the USB language string
  descriptor. This fixes enumeration of some older Samsung Galaxy S3
  phones.

Modified:
  stable/10/sys/dev/usb/usb_device.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_device.c
==
--- stable/10/sys/dev/usb/usb_device.c  Fri Jun  3 08:35:07 2016
(r301249)
+++ stable/10/sys/dev/usb/usb_device.c  Fri Jun  3 08:49:04 2016
(r301250)
@@ -1777,7 +1777,9 @@ usb_alloc_device(device_t parent_dev, st
 
scratch_ptr = udev->scratch.data;
 
-   if (udev->ddesc.iManufacturer ||
+   if (udev->flags.no_strings) {
+   err = USB_ERR_INVAL;
+   } else if (udev->ddesc.iManufacturer ||
udev->ddesc.iProduct ||
udev->ddesc.iSerialNumber) {
/* read out the language ID string */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301260 - stable/10/sys/dev/mlx5/mlx5_en

2016-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  3 09:07:40 2016
New Revision: 301260
URL: https://svnweb.freebsd.org/changeset/base/301260

Log:
  MFC r300282:
  Verify one sysctl parameter at a time. When a mlx5en sysctl parameter
  is updated only verify the changed one instead of all.
  
  No functional change.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cFri Jun  3 09:05:49 
2016(r301259)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cFri Jun  3 09:07:40 
2016(r301260)
@@ -84,6 +84,9 @@ mlx5e_ethtool_sync_tx_completion_fact(st
priv->params_ethtool.tx_completion_fact = max;
 }
 
+#defineMLX5_PARAM_OFFSET(n)\
+__offsetof(struct mlx5e_priv, params_ethtool.n)
+
 static int
 mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 {
@@ -110,129 +113,222 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
error = ENXIO;
goto done;
}
-   /* import RX coal time */
-   if (priv->params_ethtool.rx_coalesce_usecs < 1)
-   priv->params_ethtool.rx_coalesce_usecs = 0;
-   else if (priv->params_ethtool.rx_coalesce_usecs >
-   MLX5E_FLD_MAX(cqc, cq_period)) {
-   priv->params_ethtool.rx_coalesce_usecs =
-   MLX5E_FLD_MAX(cqc, cq_period);
-   }
-   priv->params.rx_cq_moderation_usec = 
priv->params_ethtool.rx_coalesce_usecs;
-
-   /* import RX coal pkts */
-   if (priv->params_ethtool.rx_coalesce_pkts < 1)
-   priv->params_ethtool.rx_coalesce_pkts = 0;
-   else if (priv->params_ethtool.rx_coalesce_pkts >
-   MLX5E_FLD_MAX(cqc, cq_max_count)) {
-   priv->params_ethtool.rx_coalesce_pkts =
-   MLX5E_FLD_MAX(cqc, cq_max_count);
-   }
-   priv->params.rx_cq_moderation_pkts = 
priv->params_ethtool.rx_coalesce_pkts;
-
-   /* import TX coal time */
-   if (priv->params_ethtool.tx_coalesce_usecs < 1)
-   priv->params_ethtool.tx_coalesce_usecs = 0;
-   else if (priv->params_ethtool.tx_coalesce_usecs >
-   MLX5E_FLD_MAX(cqc, cq_period)) {
-   priv->params_ethtool.tx_coalesce_usecs =
-   MLX5E_FLD_MAX(cqc, cq_period);
-   }
-   priv->params.tx_cq_moderation_usec = 
priv->params_ethtool.tx_coalesce_usecs;
-
-   /* import TX coal pkts */
-   if (priv->params_ethtool.tx_coalesce_pkts < 1)
-   priv->params_ethtool.tx_coalesce_pkts = 0;
-   else if (priv->params_ethtool.tx_coalesce_pkts >
-   MLX5E_FLD_MAX(cqc, cq_max_count)) {
-   priv->params_ethtool.tx_coalesce_pkts = MLX5E_FLD_MAX(cqc, 
cq_max_count);
-   }
-   priv->params.tx_cq_moderation_pkts = 
priv->params_ethtool.tx_coalesce_pkts;
-
was_opened = test_bit(MLX5E_STATE_OPENED, >state);
-   if (was_opened) {
-   u64 *xarg = priv->params_ethtool.arg + arg2;
 
-   if (xarg == >params_ethtool.tx_coalesce_pkts ||
-   xarg == >params_ethtool.rx_coalesce_pkts ||
-   xarg == >params_ethtool.tx_coalesce_usecs ||
-   xarg == >params_ethtool.rx_coalesce_usecs) {
-   /* avoid downing and upping the network interface */
+   switch (MLX5_PARAM_OFFSET(arg[arg2])) {
+   case MLX5_PARAM_OFFSET(rx_coalesce_usecs):
+   /* import RX coal time */
+   if (priv->params_ethtool.rx_coalesce_usecs < 1)
+   priv->params_ethtool.rx_coalesce_usecs = 0;
+   else if (priv->params_ethtool.rx_coalesce_usecs >
+   MLX5E_FLD_MAX(cqc, cq_period)) {
+   priv->params_ethtool.rx_coalesce_usecs =
+   MLX5E_FLD_MAX(cqc, cq_period);
+   }
+   priv->params.rx_cq_moderation_usec =
+   priv->params_ethtool.rx_coalesce_usecs;
+
+   /* check to avoid down and up the network interface */
+   if (was_opened)
error = mlx5e_refresh_channel_params(priv);
-   goto done;
+   break;
+
+   case MLX5_PARAM_OFFSET(rx_coalesce_pkts):
+   /* import RX coal pkts */
+   if (priv->params_ethtool.rx_coalesce_pkts < 1)
+   priv->params_ethtool.rx_coalesce_pkts = 0;
+   else if (priv->params_ethtool.rx_coalesce_pkts >
+   MLX5E_FLD_MAX(cqc, cq_max_count)) {
+   priv->params_ethtool.rx_coalesce_pkts =
+   MLX5E_FLD_MAX(cqc, cq_max_count);
}
-   mlx5e_close_locked(priv->ifp);
-   }
-   /* 

svn commit: r301258 - stable/10/sys/dev/mlx5/mlx5_en

2016-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  3 09:03:44 2016
New Revision: 301258
URL: https://svnweb.freebsd.org/changeset/base/301258

Log:
  MFC r300277:
  Implement TX completion event interleaving.
  
  This patch implements a sysctl which allows setting a factor, N, for
  how many work queue elements can be generated before requiring a
  completion event. When a completion event happens the code simulates N
  completion events instead of only one. When draining a transmit queue,
  N-1 NOPs are transmitted at most, to force generation of the final
  completion event.  Further a timer is running every HZ ticks to flush
  any remaining data off the transmit queue when the tx_completion_fact
  > 1.
  
  The goal of this feature is to reduce the PCI bandwidth needed when
  transmitting data.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Jun  3 09:03:10 2016
(r301257)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Jun  3 09:03:44 2016
(r301258)
@@ -393,6 +393,8 @@ struct mlx5e_params {
   m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining 
tx packets") \
   m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx 
packets to join") \
   m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \
+  m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion 
event ratio") \
+  m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum 
completion event ratio") \
   m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \
   m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled")
 
@@ -498,6 +500,13 @@ struct mlx5e_sq {
/* dirtied @xmit */
u16 pc __aligned(MLX5E_CACHELINE_SIZE);
u16 bf_offset;
+   u16 cev_counter;/* completion event counter */
+   u16 cev_factor; /* completion event factor */
+   u32 cev_next_state; /* next completion event state */
+#defineMLX5E_CEV_STATE_INITIAL 0   /* timer not started */
+#defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */
+#defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */
+   struct callout cev_callout;
struct  mlx5e_sq_stats stats;
 
struct  mlx5e_cq cq;
@@ -789,6 +798,7 @@ voidmlx5e_create_stats(struct sysctl_ct
 struct sysctl_oid_list *, const char *,
 const char **, unsigned, u64 *);
 void   mlx5e_send_nop(struct mlx5e_sq *, u32, bool);
+void   mlx5e_sq_cev_timeout(void *);
 intmlx5e_refresh_channel_params(struct mlx5e_priv *);
 
 #endif /* _MLX5_EN_H_ */

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cFri Jun  3 09:03:10 
2016(r301257)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cFri Jun  3 09:03:44 
2016(r301258)
@@ -48,6 +48,42 @@ mlx5e_create_stats(struct sysctl_ctx_lis
}
 }
 
+static void
+mlx5e_ethtool_sync_tx_completion_fact(struct mlx5e_priv *priv)
+{
+   /*
+* Limit the maximum distance between completion events to
+* half of the currently set TX queue size.
+*
+* The maximum number of queue entries a single IP packet can
+* consume is given by MLX5_SEND_WQE_MAX_WQEBBS.
+*
+* The worst case max value is then given as below:
+*/
+   uint64_t max = priv->params_ethtool.tx_queue_size /
+   (2 * MLX5_SEND_WQE_MAX_WQEBBS);
+
+   /*
+* Update the maximum completion factor value in case the
+* tx_queue_size field changed. Ensure we don't overflow
+* 16-bits.
+*/
+   if (max < 1)
+   max = 1;
+   else if (max > 65535)
+   max = 65535;
+   priv->params_ethtool.tx_completion_fact_max = max;
+
+   /*
+* Verify that the current TX completion factor is within the
+* given limits:
+*/
+   if (priv->params_ethtool.tx_completion_fact < 1)
+   priv->params_ethtool.tx_completion_fact = 1;
+   else if (priv->params_ethtool.tx_completion_fact > max)
+   priv->params_ethtool.tx_completion_fact = max;
+}
+
 static int
 mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
 {
@@ -206,6 +242,14 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params_ethtool.cqe_zipping = 0;
}
}
+
+   if (>params_ethtool.arg[arg2] ==
+   

svn commit: r301261 - stable/10/sys/kern

2016-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  3 09:10:37 2016
New Revision: 301261
URL: https://svnweb.freebsd.org/changeset/base/301261

Log:
  MFC r300489:
  Use DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside
  pause_sbt(). This allows pause() to continue working during a panic()
  which is not invoking KDB. This is useful when debugging graphics
  drivers using the LinuxKPI.

Modified:
  stable/10/sys/kern/kern_synch.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_synch.c
==
--- stable/10/sys/kern/kern_synch.c Fri Jun  3 09:07:40 2016
(r301260)
+++ stable/10/sys/kern/kern_synch.c Fri Jun  3 09:10:37 2016
(r301261)
@@ -362,7 +362,7 @@ pause_sbt(const char *wmesg, sbintime_t 
if (sbt == 0)
sbt = tick_sbt;
 
-   if (cold || kdb_active) {
+   if (cold || kdb_active || SCHEDULER_STOPPED()) {
/*
 * We delay one second at a time to avoid overflowing the
 * system specific DELAY() function(s):
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301253 - stable/10/sys/dev/usb

2016-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  3 08:55:28 2016
New Revision: 301253
URL: https://svnweb.freebsd.org/changeset/base/301253

Log:
  MFC r300667:
  Check for signals when locking the USB enumeration thread from
  userspace, so that USB applications can be killed if an enumeration
  thread should be stuck for various reasons.

Modified:
  stable/10/sys/dev/usb/usb_dev.c
  stable/10/sys/dev/usb/usb_device.c
  stable/10/sys/dev/usb/usb_device.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_dev.c
==
--- stable/10/sys/dev/usb/usb_dev.c Fri Jun  3 08:53:14 2016
(r301252)
+++ stable/10/sys/dev/usb/usb_dev.c Fri Jun  3 08:55:28 2016
(r301253)
@@ -229,7 +229,7 @@ usb_ref_device(struct usb_cdev_privdata 
 * We need to grab the enumeration SX-lock before
 * grabbing the FIFO refs to avoid deadlock at detach!
 */
-   crd->do_unlock = usbd_enum_lock(cpd->udev);
+   crd->do_unlock = usbd_enum_lock_sig(cpd->udev);
 
mtx_lock(_ref_lock);
 
@@ -237,6 +237,12 @@ usb_ref_device(struct usb_cdev_privdata 
 * Set "is_uref" after grabbing the default SX lock
 */
crd->is_uref = 1;
+
+   /* check for signal */
+   if (crd->do_unlock > 1) {
+   crd->do_unlock = 0;
+   goto error;
+   }
}
 
/* check if we are doing an open */

Modified: stable/10/sys/dev/usb/usb_device.c
==
--- stable/10/sys/dev/usb/usb_device.c  Fri Jun  3 08:53:14 2016
(r301252)
+++ stable/10/sys/dev/usb/usb_device.c  Fri Jun  3 08:55:28 2016
(r301253)
@@ -2740,7 +2740,7 @@ usbd_device_attached(struct usb_device *
 /*
  * The following function locks enumerating the given USB device. If
  * the lock is already grabbed this function returns zero. Else a
- * non-zero value is returned.
+ * a value of one is returned.
  */
 uint8_t
 usbd_enum_lock(struct usb_device *udev)
@@ -2759,6 +2759,27 @@ usbd_enum_lock(struct usb_device *udev)
return (1);
 }
 
+#if USB_HAVE_UGEN
+/*
+ * This function is the same like usbd_enum_lock() except a value of
+ * 255 is returned when a signal is pending:
+ */
+uint8_t
+usbd_enum_lock_sig(struct usb_device *udev)
+{
+   if (sx_xlocked(>enum_sx))
+   return (0);
+   if (sx_xlock_sig(>enum_sx))
+   return (255);
+   if (sx_xlock_sig(>sr_sx)) {
+   sx_xunlock(>enum_sx);
+   return (255);
+   }
+   mtx_lock();
+   return (1);
+}
+#endif
+
 /* The following function unlocks enumerating the given USB device. */
 
 void

Modified: stable/10/sys/dev/usb/usb_device.h
==
--- stable/10/sys/dev/usb/usb_device.h  Fri Jun  3 08:53:14 2016
(r301252)
+++ stable/10/sys/dev/usb/usb_device.h  Fri Jun  3 08:55:28 2016
(r301253)
@@ -314,6 +314,9 @@ voidusb_set_device_state(struct usb_dev
 enum usb_dev_state usb_get_device_state(struct usb_device *);
 
 uint8_tusbd_enum_lock(struct usb_device *);
+#if USB_HAVE_UGEN
+uint8_tusbd_enum_lock_sig(struct usb_device *);
+#endif
 void   usbd_enum_unlock(struct usb_device *);
 void   usbd_sr_lock(struct usb_device *);
 void   usbd_sr_unlock(struct usb_device *);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r301259 - stable/10/sys/dev/mlx5/mlx5_en

2016-06-03 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jun  3 09:05:49 2016
New Revision: 301259
URL: https://svnweb.freebsd.org/changeset/base/301259

Log:
  MFC r300280:
  Optimise use of doorbell and remove redundant NOPs
  
  Store the last doorbell write in the mlx5e_sq structure and write the
  doorbell to the hardware when the transmit routine finishes
  transmitting all queued mbufs.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Jun  3 09:03:44 2016
(r301258)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Fri Jun  3 09:05:49 2016
(r301259)
@@ -507,6 +507,10 @@ struct mlx5e_sq {
 #defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */
 #defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */
struct callout cev_callout;
+   union {
+   u32 d32[2];
+   u64 d64;
+   } doorbell;
struct  mlx5e_sq_stats stats;
 
struct  mlx5e_cq cq;
@@ -754,8 +758,7 @@ int mlx5e_add_all_vlan_rules(struct mlx5
 void   mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv);
 
 static inline void
-mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
-struct mlx5e_tx_wqe *wqe, int bf_sz)
+mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe, int bf_sz)
 {
u16 ofst = MLX5_BF_OFFSET + sq->bf_offset;
 
@@ -771,13 +774,13 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
wmb();
 
if (bf_sz) {
-   __iowrite64_copy(sq->uar_bf_map + ofst, >ctrl, bf_sz);
+   __iowrite64_copy(sq->uar_bf_map + ofst, wqe, bf_sz);
 
/* flush the write-combining mapped buffer */
wmb();
 
} else {
-   mlx5_write64((__be32 *)>ctrl, sq->uar_map + ofst, NULL);
+   mlx5_write64(wqe, sq->uar_map + ofst, NULL);
}
 
sq->bf_offset ^= sq->bf_buf_size;
@@ -797,7 +800,7 @@ voidmlx5e_create_ethtool(struct mlx5e_p
 void   mlx5e_create_stats(struct sysctl_ctx_list *,
 struct sysctl_oid_list *, const char *,
 const char **, unsigned, u64 *);
-void   mlx5e_send_nop(struct mlx5e_sq *, u32, bool);
+void   mlx5e_send_nop(struct mlx5e_sq *, u32);
 void   mlx5e_sq_cev_timeout(void *);
 intmlx5e_refresh_channel_params(struct mlx5e_priv *);
 

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Jun  3 09:03:44 
2016(r301258)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Fri Jun  3 09:05:49 
2016(r301259)
@@ -850,7 +850,6 @@ mlx5e_open_rq(struct mlx5e_channel *c,
 struct mlx5e_rq *rq)
 {
int err;
-   int i;
 
err = mlx5e_create_rq(c, param, rq);
if (err)
@@ -866,12 +865,6 @@ mlx5e_open_rq(struct mlx5e_channel *c,
 
c->rq.enabled = 1;
 
-   /*
-* Test send queues, which will trigger
-* "mlx5e_post_rx_wqes()":
-*/
-   for (i = 0; i != c->num_tc; i++)
-   mlx5e_send_nop(>sq[i], 1, true);
return (0);
 
 err_disable_rq:
@@ -1198,9 +1191,16 @@ mlx5e_sq_send_nops_locked(struct mlx5e_s
goto done;
}
}
-   mlx5e_send_nop(sq, 1, true);
+   /* send a single NOP */
+   mlx5e_send_nop(sq, 1);
+   wmb();
}
 done:
+   /* Check if we need to write the doorbell */
+   if (likely(sq->doorbell.d64 != 0)) {
+   mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0);
+   sq->doorbell.d64 = 0;
+   }
return;
 }
 

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Fri Jun  3 09:03:44 2016
(r301258)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Fri Jun  3 09:05:49 2016
(r301259)
@@ -41,7 +41,7 @@ mlx5e_do_send_cqe(struct mlx5e_sq *sq)
 }
 
 void
-mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt, bool notify_hw)
+mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt)
 {
u16 pi = sq->pc & sq->wq.sz_m1;
struct mlx5e_tx_wqe *wqe = mlx5_wq_cyc_get_wqe(>wq, pi);
@@ -55,12 +55,13 @@ mlx5e_send_nop(struct mlx5e_sq *sq, u32 
else
wqe->ctrl.fm_ce_se = 0;
 
+   /* Copy data for doorbell */
+   memcpy(sq->doorbell.d32, >ctrl, sizeof(sq->doorbell.d32));
+
sq->mbuf[pi].mbuf = NULL;
sq->mbuf[pi].num_bytes = 0;
sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
sq->pc += sq->mbuf[pi].num_wqebbs;
-   

svn commit: r295346 - stable/10/sys/conf

2016-02-06 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Feb  6 08:58:10 2016
New Revision: 295346
URL: https://svnweb.freebsd.org/changeset/base/295346

Log:
  MFC r294915:
  Fix generation of dependency rules for the LinuxKPI, the MLX5 driver
  and all of OFED except MLX4[EN/IB].
  
  Sponsored by: Mellanox Technologies
  Approved by:  re (marius)

Modified:
  stable/10/sys/conf/files
  stable/10/sys/conf/kern.post.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/conf/files
==
--- stable/10/sys/conf/filesSat Feb  6 04:13:20 2016(r295345)
+++ stable/10/sys/conf/filesSat Feb  6 08:58:10 2016(r295346)
@@ -3646,128 +3646,91 @@ nlm/sm_inter_xdr.c optional nfslockd | 
 
 # OpenFabrics Enterprise Distribution (Infiniband)
 ofed/include/linux/linux_compat.c  optional ofed | compat_linuxkpi 
\
-   no-depend compile-with "${OFED_C}"
+   compile-with "${OFED_C}"
 ofed/include/linux/linux_idr.c optional ofed | compat_linuxkpi 
\
-   no-depend compile-with "${OFED_C}"
+   compile-with "${OFED_C}"
 ofed/include/linux/linux_radix.c   optional ofed | compat_linuxkpi 
\
-   no-depend compile-with "${OFED_C}"
+   compile-with "${OFED_C}"
 ofed/drivers/infiniband/core/addr.coptional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/agent.c   optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/cache.c   optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 # XXX Mad.c must be ordered before cm.c for sysinit sets to occur in
 # the correct order.
 ofed/drivers/infiniband/core/mad.c optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/cm.c  optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/ 
-Wno-unused-function"
 ofed/drivers/infiniband/core/cma.c optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/device.c  optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/fmr_pool.coptional ofed   
\
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/iwcm.coptional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/local_sa.coptional ofed   
\
no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/mad_rmpp.coptional ofed   
\
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/multicast.c   optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/notice.c  optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/packer.c  optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/sa_query.coptional ofed   
\
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/smi.c optional ofed   \
-   no-depend   \
compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/sysfs.c   optional ofed   \

svn commit: r294917 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-27 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 27 14:55:41 2016
New Revision: 294917
URL: https://svnweb.freebsd.org/changeset/base/294917

Log:
  MFC r294314:
  Allow RX and TX pause frames to be set through ifconfig.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4817

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==
--- stable/10/sys/dev/mlx5/mlx5_en/en.h Wed Jan 27 14:47:00 2016
(r294916)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h Wed Jan 27 14:55:41 2016
(r294917)
@@ -375,11 +375,11 @@ struct mlx5e_params {
boolcqe_zipping_en;
u32 lro_wqe_sz;
u16 rx_hash_log_tbl_sz;
+   u32 tx_pauseframe_control;
+   u32 rx_pauseframe_control;
 };
 
 #defineMLX5E_PARAMS(m) 
\
-  m(+1, u64 tx_pauseframe_control, "tx_pauseframe_control", "Set to enable TX 
pause frames. Clear to disable.") \
-  m(+1, u64 rx_pauseframe_control, "rx_pauseframe_control", "Set to enable RX 
pause frames. Clear to disable.") \
   m(+1, u64 tx_queue_size_max, "tx_queue_size_max", "Max send queue size") \
   m(+1, u64 rx_queue_size_max, "rx_queue_size_max", "Max receive queue size") \
   m(+1, u64 tx_queue_size, "tx_queue_size", "Default send queue size") \

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Jan 27 14:47:00 
2016(r294916)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Jan 27 14:55:41 
2016(r294917)
@@ -113,21 +113,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
}
priv->params.tx_cq_moderation_pkts = 
priv->params_ethtool.tx_coalesce_pkts;
 
-   if (>params_ethtool.arg[arg2] == 
>params_ethtool.rx_pauseframe_control ||
-   >params_ethtool.arg[arg2] == 
>params_ethtool.tx_pauseframe_control) {
-   /* range check parameters */
-   priv->params_ethtool.rx_pauseframe_control =
-   priv->params_ethtool.rx_pauseframe_control ? 1 : 0;
-   priv->params_ethtool.tx_pauseframe_control =
-   priv->params_ethtool.tx_pauseframe_control ? 1 : 0;
-
-   /* update firmware */
-   error = -mlx5_set_port_pause(priv->mdev, 1,
-   priv->params_ethtool.rx_pauseframe_control,
-   priv->params_ethtool.tx_pauseframe_control);
-   goto done;
-   }
-
was_opened = test_bit(MLX5E_STATE_OPENED, >state);
if (was_opened) {
u64 *xarg = priv->params_ethtool.arg + arg2;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Wed Jan 27 14:47:00 
2016(r294916)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Wed Jan 27 14:55:41 
2016(r294917)
@@ -222,8 +222,8 @@ mlx5e_media_status(struct ifnet *dev, st
 
ifmr->ifm_status = priv->media_status_last;
ifmr->ifm_active = priv->media_active_last |
-   (priv->params_ethtool.rx_pauseframe_control ? IFM_ETH_RXPAUSE : 0) |
-   (priv->params_ethtool.tx_pauseframe_control ? IFM_ETH_TXPAUSE : 0);
+   (priv->params.rx_pauseframe_control ? IFM_ETH_RXPAUSE : 0) |
+   (priv->params.tx_pauseframe_control ? IFM_ETH_TXPAUSE : 0);
 
 }
 
@@ -250,6 +250,7 @@ mlx5e_media_change(struct ifnet *dev)
struct mlx5_core_dev *mdev = priv->mdev;
u32 eth_proto_cap;
u32 link_mode;
+   int was_opened;
int locked;
int error;
 
@@ -263,24 +264,45 @@ mlx5e_media_change(struct ifnet *dev)
}
link_mode = mlx5e_find_link_mode(IFM_SUBTYPE(priv->media.ifm_media));
 
+   /* query supported capabilities */
error = mlx5_query_port_proto_cap(mdev, _proto_cap, MLX5_PTYS_EN);
-   if (error) {
+   if (error != 0) {
if_printf(dev, "Query port media capability failed\n");
goto done;
}
-   if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO)
+   /* check for autoselect */
+   if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) {
link_mode = eth_proto_cap;
-   else
+   if (link_mode == 0) {
+   if_printf(dev, "Port media capability is zero\n");
+   error = EINVAL;
+   goto done;
+   }
+   } else {
link_mode = link_mode & eth_proto_cap;
-
-   if (!link_mode) {
-   if_printf(dev, "Not supported link mode 

svn commit: r294918 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-27 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 27 14:57:37 2016
New Revision: 294918
URL: https://svnweb.freebsd.org/changeset/base/294918

Log:
  MFC r294317:
  Declare local variables at top of function.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4939

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Jan 27 14:55:41 2016
(r294917)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Jan 27 14:57:37 2016
(r294918)
@@ -100,20 +100,23 @@ mlx5e_lro_update_hdr(struct mbuf *mb, st
/* TODO: consider vlans, ip options, ... */
struct ether_header *eh;
uint16_t eh_type;
+   uint16_t tot_len;
struct ip6_hdr *ip6 = NULL;
struct ip *ip4 = NULL;
struct tcphdr *th;
uint32_t *ts_ptr;
+   uint8_t l4_hdr_type;
+   int tcp_ack;
 
eh = mtod(mb, struct ether_header *);
eh_type = ntohs(eh->ether_type);
 
-   u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe);
-   int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) ||
+   l4_hdr_type = get_cqe_l4_hdr_type(cqe);
+   tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) ||
(CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type));
 
/* TODO: consider vlan */
-   u16 tot_len = be32_to_cpu(cqe->byte_cnt) - ETHER_HDR_LEN;
+   tot_len = be32_to_cpu(cqe->byte_cnt) - ETHER_HDR_LEN;
 
switch (eh_type) {
case ETHERTYPE_IP:
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r294919 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-27 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 27 14:59:22 2016
New Revision: 294919
URL: https://svnweb.freebsd.org/changeset/base/294919

Log:
  MFC r294318:
  Add clarifying comment about CQE zipping.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4940

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Jan 27 14:57:37 2016
(r294918)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Jan 27 14:59:22 2016
(r294919)
@@ -270,6 +270,11 @@ mlx5e_decompress_cqe(struct mlx5e_cq *cq
 struct mlx5_mini_cqe8 *mini,
 u16 wqe_counter, int i)
 {
+   /*
+* NOTE: The fields which are not set here are copied from the
+* initial and common title. See memcpy() in
+* mlx5e_write_cqe_slot().
+*/
title->byte_cnt = mini->byte_cnt;
title->wqe_counter = cpu_to_be16((wqe_counter + i) & cq->wq.sz_m1);
title->check_sum = mini->checksum;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r294920 - stable/10/sys/dev/mlx5/mlx5_en

2016-01-27 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 27 15:01:08 2016
New Revision: 294920
URL: https://svnweb.freebsd.org/changeset/base/294920

Log:
  MFC r294319:
  Fix an issue where the network adapter could be left in down state
  after changing the HW LRO sysctl when previously in up state.
  
  Sponsored by: Mellanox Technologies
  Differential Revision:https://reviews.freebsd.org/D4941

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Jan 27 14:59:22 
2016(r294919)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.cWed Jan 27 15:01:08 
2016(r294920)
@@ -178,23 +178,21 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params.tx_cq_moderation_mode = 
priv->params_ethtool.tx_coalesce_mode;
 
/* we always agree to turn off HW LRO - but not always to turn on */
-   if (priv->params_ethtool.hw_lro) {
-   if (priv->params_ethtool.hw_lro != 1) {
-   priv->params_ethtool.hw_lro = priv->params.hw_lro_en;
-   error = EINVAL;
-   goto done;
-   }
-   if (priv->ifp->if_capenable & IFCAP_LRO)
-   priv->params.hw_lro_en = !!MLX5_CAP_ETH(priv->mdev, 
lro_cap);
-   else {
-   /* set the correct (0) value to params_ethtool.hw_lro, 
issue a warning and return error */
+   if (priv->params_ethtool.hw_lro != 0) {
+   if ((priv->ifp->if_capenable & IFCAP_LRO) &&
+   MLX5_CAP_ETH(priv->mdev, lro_cap)) {
+   priv->params.hw_lro_en = 1;
+   priv->params_ethtool.hw_lro = 1;
+   } else {
+   priv->params.hw_lro_en = 0;
priv->params_ethtool.hw_lro = 0;
error = EINVAL;
-   if_printf(priv->ifp, "Can't set HW_LRO to a device with 
LRO turned off");
-   goto done;
+
+   if_printf(priv->ifp, "Can't enable HW LRO: "
+   "The HW or SW LRO feature is disabled");
}
} else {
-   priv->params.hw_lro_en = false;
+   priv->params.hw_lro_en = 0;
}
 
if (>params_ethtool.arg[arg2] ==
@@ -208,7 +206,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params_ethtool.cqe_zipping = 0;
}
}
-
if (was_opened)
mlx5e_open_locked(priv->ifp);
 done:
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297640 - stable/10/sbin/ifconfig

2016-04-07 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr  7 07:12:14 2016
New Revision: 297640
URL: https://svnweb.freebsd.org/changeset/base/297640

Log:
  MFC r296902:
  Improve detection of extended QSFP diagnostics.
  
  The standards in the QSFP diagnostics area are not clear when the
  additional measurements are present or not. Use a valid temperature
  reading as an indicator for the presence of voltage and TX/RX power
  measurements.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix
  Differential Revision:https://reviews.freebsd.org/D5391
  Reviewed by:  gallatin

Modified:
  stable/10/sbin/ifconfig/sfp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ifconfig/sfp.c
==
--- stable/10/sbin/ifconfig/sfp.c   Thu Apr  7 07:00:00 2016
(r297639)
+++ stable/10/sbin/ifconfig/sfp.c   Thu Apr  7 07:12:14 2016
(r297640)
@@ -625,14 +625,17 @@ get_sfp_voltage(struct i2c_info *ii, cha
convert_sff_voltage(buf, size, xbuf);
 }
 
-static void
+static int
 get_qsfp_temp(struct i2c_info *ii, char *buf, size_t size)
 {
uint8_t xbuf[2];
 
memset(xbuf, 0, sizeof(xbuf));
read_i2c(ii, SFF_8436_BASE, SFF_8436_TEMP, 2, xbuf);
+   if ((xbuf[0] == 0xFF && xbuf[1] == 0xFF) || (xbuf[0] == 0 && xbuf[1] == 
0))
+   return (-1);
convert_sff_temp(buf, size, xbuf);
+   return (0);
 }
 
 static void
@@ -779,22 +782,9 @@ static void
 print_qsfp_status(struct i2c_info *ii, int verbose)
 {
char buf[80], buf2[40], buf3[40];
-   uint8_t diag_type;
uint32_t bitrate;
int i;
 
-   /* Read diagnostic monitoring type */
-   read_i2c(ii, SFF_8436_BASE, SFF_8436_DIAG_TYPE, 1, (caddr_t)_type);
-   if (ii->error != 0)
-   return;
-
-   /*
-* Read monitoring data it is supplied.
-* XXX: It is not exactly clear from standard
-* how one can specify lack of measurements (passive cables case).
-*/
-   if (diag_type != 0)
-   ii->do_diag = 1;
ii->qsfp = 1;
 
/* Transceiver type */
@@ -817,9 +807,13 @@ print_qsfp_status(struct i2c_info *ii, i
printf("\tnominal bitrate: %u Mbps\n", bitrate);
}
 
-   /* Request current measurements if they are provided: */
-   if (ii->do_diag != 0) {
-   get_qsfp_temp(ii, buf, sizeof(buf));
+   /*
+* The standards in this area are not clear when the
+* additional measurements are present or not. Use a valid
+* temperature reading as an indicator for the presence of
+* voltage and TX/RX power measurements.
+*/
+   if (get_qsfp_temp(ii, buf, sizeof(buf)) == 0) {
get_qsfp_voltage(ii, buf2, sizeof(buf2));
printf("\tmodule temperature: %s voltage: %s\n", buf, buf2);
for (i = 1; i <= 4; i++) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297648 - stable/10/sys/ofed/drivers/infiniband/ulp/ipoib

2016-04-07 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr  7 07:29:57 2016
New Revision: 297648
URL: https://svnweb.freebsd.org/changeset/base/297648

Log:
  MFC r296909:
  Fix witness panic in the ipoib_ioctl() function when unloading the
  ipoib module.
  
  The bpfdetach() function is trying to turn off promiscious mode on the
  network interface it is attached to while holding a mutex. The fix
  consists of ignoring any further calls to the ipoib_ioctl() function
  when the network interface is going to be detached. The ipoib_ioctl()
  function might sleep.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
==
--- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Apr  7 
07:23:21 2016(r297647)
+++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Apr  7 
07:29:57 2016(r297648)
@@ -319,6 +319,8 @@ struct ipoib_dev_priv {
 
unsigned long flags;
 
+   int gone;
+
struct mutex vlan_mutex;
 
struct rb_root  path_tree;

Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.cThu Apr 
 7 07:23:21 2016(r297647)
+++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.cThu Apr 
 7 07:29:57 2016(r297648)
@@ -258,6 +258,10 @@ ipoib_ioctl(struct ifnet *ifp, u_long co
struct ifreq *ifr = (struct ifreq *) data;
int error = 0;
 
+   /* check if detaching */
+   if (priv == NULL || priv->gone != 0)
+   return (ENXIO);
+
switch (command) {
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
@@ -794,6 +798,7 @@ ipoib_detach(struct ipoib_dev_priv *priv
 
dev = priv->dev;
if (!test_bit(IPOIB_FLAG_SUBINTERFACE, >flags)) {
+   priv->gone = 1;
bpfdetach(dev);
if_detach(dev);
if_free(dev);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297643 - stable/10/sys/dev/usb/quirk

2016-04-07 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr  7 07:17:23 2016
New Revision: 297643
URL: https://svnweb.freebsd.org/changeset/base/297643

Log:
  MFC r296342:
  Allow for overlapping quirk device ranges. Prior to this patch only
  the first device entry matching the USB vendor, product and revision
  would be searched for quirks. After this patch all device entries will
  be searched for quirks.

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

Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/10/sys/dev/usb/quirk/usb_quirk.c Thu Apr  7 07:15:53 2016
(r297642)
+++ stable/10/sys/dev/usb/quirk/usb_quirk.c Thu Apr  7 07:17:23 2016
(r297643)
@@ -682,8 +682,6 @@ usb_test_quirk_by_info(const struct usbd
return (1);
}
}
-   /* no quirk found */
-   break;
}
mtx_unlock(_quirk_mtx);
 done:
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297651 - stable/10/sys/ofed/drivers/net/mlx4

2016-04-07 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr  7 07:35:02 2016
New Revision: 297651
URL: https://svnweb.freebsd.org/changeset/base/297651

Log:
  MFC r296910:
  Use hardware computed Toeplitz hash for incoming flowids
  
  Use the Toeplitz hash value as source for the flowid. This makes the
  hash value more suitable for so-called hash bucket algorithms which
  are used in the FreeBSD's TCP/IP stack when RSS is enabled.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/drivers/net/mlx4/en_rx.c
  stable/10/sys/ofed/drivers/net/mlx4/en_tx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_rx.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Apr  7 07:33:40 2016
(r297650)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_rx.c Thu Apr  7 07:35:02 2016
(r297651)
@@ -616,7 +616,8 @@ int mlx4_en_process_rx_cq(struct net_dev
goto next;
}
 
-   mb->m_pkthdr.flowid = cq->ring;
+   /* forward Toeplitz compatible hash value */
+   mb->m_pkthdr.flowid = be32_to_cpu(cqe->immed_rss_invalid);
M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE);
mb->m_pkthdr.rcvif = dev;
if (be32_to_cpu(cqe->vlan_my_qpn) &

Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c
==
--- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Thu Apr  7 07:33:40 2016
(r297650)
+++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Thu Apr  7 07:35:02 2016
(r297651)
@@ -1057,7 +1057,7 @@ mlx4_en_transmit(struct ifnet *dev, stru
 
/* Compute which queue to use */
if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
-   i = m->m_pkthdr.flowid % priv->tx_ring_num;
+   i = (m->m_pkthdr.flowid % 128) % priv->tx_ring_num;
}
else {
i = mlx4_en_select_queue(dev, m);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297228 - stable/10/sys/netpfil/ipfw

2016-03-24 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 24 09:22:58 2016
New Revision: 297228
URL: https://svnweb.freebsd.org/changeset/base/297228

Log:
  MFC r292254:
  
  Properly drain callouts in the IPFW subsystem to avoid use after free
  panics when unloading the dummynet and IPFW modules:
  
  - The callout drain function can sleep and should not be called having
  a non-sleepable lock locked. Remove locks around "ipfw_dyn_uninit(0)".
  
  - Add a new "dn_gone" variable to prevent asynchronous restart of
  dummynet callouts when unloading the dummynet kernel module.
  
  - Call "dn_reschedule()" locked so that "dn_gone" can be set and
  checked atomically with regard to starting a new callout.
  
  PR:   208171
  Requested by: Franco Fichtner (opnsense.org)
  Differential Revision:https://reviews.freebsd.org/D3855

Modified:
  stable/10/sys/netpfil/ipfw/ip_dn_io.c
  stable/10/sys/netpfil/ipfw/ip_dummynet.c
  stable/10/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netpfil/ipfw/ip_dn_io.c
==
--- stable/10/sys/netpfil/ipfw/ip_dn_io.c   Thu Mar 24 08:26:06 2016
(r297227)
+++ stable/10/sys/netpfil/ipfw/ip_dn_io.c   Thu Mar 24 09:22:58 2016
(r297228)
@@ -619,8 +619,8 @@ dummynet_task(void *context, int pending
dn_drain_queue();
}
 
-   DN_BH_WUNLOCK();
dn_reschedule();
+   DN_BH_WUNLOCK();
if (q.head != NULL)
dummynet_send(q.head);
CURVNET_RESTORE();

Modified: stable/10/sys/netpfil/ipfw/ip_dummynet.c
==
--- stable/10/sys/netpfil/ipfw/ip_dummynet.cThu Mar 24 08:26:06 2016
(r297227)
+++ stable/10/sys/netpfil/ipfw/ip_dummynet.cThu Mar 24 09:22:58 2016
(r297228)
@@ -74,6 +74,7 @@ struct schk_new_arg {
 
 /* callout hooks. */
 static struct callout dn_timeout;
+static int dn_gone;
 static struct task dn_task;
 static struct taskqueue*dn_tq = NULL;
 
@@ -89,6 +90,8 @@ void
 dn_reschedule(void)
 {
 
+   if (dn_gone != 0)
+   return;
callout_reset_sbt(_timeout, tick_sbt, 0, dummynet, NULL,
C_HARDCLOCK | C_DIRECT_EXEC);
 }
@@ -2175,9 +2178,11 @@ ip_dn_init(void)
 static void
 ip_dn_destroy(int last)
 {
-   callout_drain(_timeout);
-
DN_BH_WLOCK();
+   /* ensure no more callouts are started */
+   dn_gone = 1;
+
+   /* check for last */
if (last) {
ND("removing last instance\n");
ip_dn_ctl_ptr = NULL;
@@ -2186,6 +2191,8 @@ ip_dn_destroy(int last)
 
dummynet_flush();
DN_BH_WUNLOCK();
+
+   callout_drain(_timeout);
taskqueue_drain(dn_tq, _task);
taskqueue_free(dn_tq);
 

Modified: stable/10/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/10/sys/netpfil/ipfw/ip_fw2.c Thu Mar 24 08:26:06 2016
(r297227)
+++ stable/10/sys/netpfil/ipfw/ip_fw2.c Thu Mar 24 09:22:58 2016
(r297228)
@@ -2704,12 +2704,10 @@ vnet_ipfw_uninit(const void *unused)
V_ip_fw_ctl_ptr = NULL;
IPFW_UH_WLOCK(chain);
IPFW_UH_WUNLOCK(chain);
-   IPFW_UH_WLOCK(chain);
 
-   IPFW_WLOCK(chain);
ipfw_dyn_uninit(0); /* run the callout_drain */
-   IPFW_WUNLOCK(chain);
 
+   IPFW_UH_WLOCK(chain);
ipfw_destroy_tables(chain);
reap = NULL;
IPFW_WLOCK(chain);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r296443 - stable/10/sys/dev/usb/net

2016-03-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Mar  7 09:35:20 2016
New Revision: 296443
URL: https://svnweb.freebsd.org/changeset/base/296443

Log:
  MFC r295608:
  Fix variable assignment inside if-clause in the smsc driver.
  Found by D5245 / PVS.

Modified:
  stable/10/sys/dev/usb/net/if_smsc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/net/if_smsc.c
==
--- stable/10/sys/dev/usb/net/if_smsc.c Mon Mar  7 09:00:27 2016
(r296442)
+++ stable/10/sys/dev/usb/net/if_smsc.c Mon Mar  7 09:35:20 2016
(r296443)
@@ -1341,7 +1341,7 @@ smsc_chip_init(struct smsc_softc *sc)
/* Reset the PHY */
smsc_write_reg(sc, SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST);
 
-   if ((err = smsc_wait_for_bits(sc, SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST) 
!= 0)) {
+   if ((err = smsc_wait_for_bits(sc, SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST)) 
!= 0) {
smsc_warn_printf(sc, "timed-out waiting for phy reset to 
complete\n");
goto init_failed;
}
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r296444 - stable/10/sys/dev/usb

2016-03-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Mar  7 09:37:07 2016
New Revision: 296444
URL: https://svnweb.freebsd.org/changeset/base/296444

Log:
  MFC r295923:
  Be more verbose when truncating number of HID items.
  
  Suggested by: Larry Rosenman 

Modified:
  stable/10/sys/dev/usb/usb_hid.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_hid.c
==
--- stable/10/sys/dev/usb/usb_hid.c Mon Mar  7 09:35:20 2016
(r296443)
+++ stable/10/sys/dev/usb/usb_hid.c Mon Mar  7 09:37:07 2016
(r296444)
@@ -354,7 +354,8 @@ hid_get_item(struct hid_data *s, struct 
/* range check usage count */
if (c->loc.count > 255) {
DPRINTFN(0, "Number of "
-   "items truncated to 255\n");
+   "items(%u) truncated to 
255\n",
+   (unsigned)(c->loc.count));
s->ncount = 255;
} else
s->ncount = c->loc.count;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r296446 - stable/10/sys/dev/usb/controller

2016-03-07 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Mar  7 09:42:16 2016
New Revision: 296446
URL: https://svnweb.freebsd.org/changeset/base/296446

Log:
  MFC r295928:
  Configure the correct bMaxPacketSize for control endpoints before
  requesting the initial complete device descriptor and not as part of
  the subsequent babble error recovery. Babble means that the received
  USB packet was bigger than than configured maximum packet size. This
  only affects enumeration of FULL speed USB devices which use a
  bMaxPacketSize different from 8 bytes. This patch might help fix
  enumeration of USB devices which exhibit USB I/O errors in dmesg
  during boot.

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

Modified: stable/10/sys/dev/usb/controller/xhci.c
==
--- stable/10/sys/dev/usb/controller/xhci.c Mon Mar  7 09:39:35 2016
(r296445)
+++ stable/10/sys/dev/usb/controller/xhci.c Mon Mar  7 09:42:16 2016
(r296446)
@@ -2363,6 +2363,8 @@ xhci_configure_endpoint(struct usb_devic
 
/* store endpoint mode */
pepext->trb_ep_mode = ep_mode;
+   /* store bMaxPacketSize for control endpoints */
+   pepext->trb_ep_maxp = edesc->wMaxPacketSize[0];
usb_pc_cpu_flush(pepext->page_cache);
 
if (ep_mode == USB_EP_MODE_STREAMS) {
@@ -2909,6 +2911,17 @@ xhci_transfer_insert(struct usb_xfer *xf
return (USB_ERR_NOMEM);
}
 
+   /* check if bMaxPacketSize changed */
+   if (xfer->flags_int.control_xfr != 0 &&
+   pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) {
+
+   DPRINTFN(8, "Reconfigure control endpoint\n");
+
+   /* force driver to reconfigure endpoint */
+   pepext->trb_halted = 1;
+   pepext->trb_running = 0;
+   }
+
/* check for stopped condition, after putting transfer on interrupt 
queue */
if (pepext->trb_running == 0) {
struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus);

Modified: stable/10/sys/dev/usb/controller/xhci.h
==
--- stable/10/sys/dev/usb/controller/xhci.h Mon Mar  7 09:39:35 2016
(r296445)
+++ stable/10/sys/dev/usb/controller/xhci.h Mon Mar  7 09:42:16 2016
(r296446)
@@ -383,6 +383,7 @@ struct xhci_endpoint_ext {
uint8_t trb_halted;
uint8_t trb_running;
uint8_t trb_ep_mode;
+   uint8_t trb_ep_maxp;
 };
 
 enum {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r298779 - stable/10/sys/ofed/drivers/infiniband/ulp/ipoib

2016-04-29 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Apr 29 11:29:52 2016
New Revision: 298779
URL: https://svnweb.freebsd.org/changeset/base/298779

Log:
  MFC r298458:
  Add missing set of the current VNET when inputting IP packets in IPoIB.
  
  This fixes a kernel panic when using IPoIB with VIMAGE and infiniband.
  
  PR:   208957
  Sponsored by: Mellanox Technologies
  Tested by:Justin Clift 

Modified:
  stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
==
--- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c  Fri Apr 29 
11:18:48 2016(r298778)
+++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c  Fri Apr 29 
11:29:52 2016(r298779)
@@ -481,6 +481,8 @@ void ipoib_cm_handle_rx_wc(struct ipoib_
int has_srq;
u_short proto;
 
+   CURVNET_SET_QUIET(dev->if_vnet);
+
ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n",
   wr_id, wc->status);
 
@@ -496,7 +498,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_
} else
ipoib_warn(priv, "cm recv completion event with wrid %d 
(> %d)\n",
   wr_id, ipoib_recvq_size);
-   return;
+   goto done;
}
 
p = wc->qp->qp_context;
@@ -520,7 +522,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_
queue_work(ipoib_workqueue, 
>cm.rx_reap_task);
spin_unlock(>lock);
}
-   return;
+   goto done;
}
}
 
@@ -579,6 +581,9 @@ repost:
   "for buf %d\n", wr_id);
}
}
+done:
+   CURVNET_RESTORE();
+   return;
 }
 
 static inline int post_send(struct ipoib_dev_priv *priv,
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r298781 - in stable/10/sys/dev/usb: . quirk

2016-04-29 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Apr 29 11:37:06 2016
New Revision: 298781
URL: https://svnweb.freebsd.org/changeset/base/298781

Log:
  MFC r297696 and r298424:
  Add new USB quirks.
  
  Submitted by: AJ 
  PR:   208623
  Submitted by: Naram Qashat 
  PR:   208642

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

Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c
==
--- stable/10/sys/dev/usb/quirk/usb_quirk.c Fri Apr 29 11:31:27 2016
(r298780)
+++ stable/10/sys/dev/usb/quirk/usb_quirk.c Fri Apr 29 11:37:06 2016
(r298781)
@@ -136,6 +136,8 @@ static struct usb_quirk_entry usb_quirks
USB_QUIRK(CORSAIR, K60, 0x, 0x, UQ_KBD_BOOTPROTO),
/* Quirk for Corsair Vengeance K70 keyboard */
USB_QUIRK(CORSAIR, K70, 0x, 0x, UQ_KBD_BOOTPROTO),
+   /* Quirk for Corsair STRAFE Gaming keyboard */
+   USB_QUIRK(CORSAIR, STRAFE, 0x, 0x, UQ_KBD_BOOTPROTO),
/* umodem(4) device quirks */
USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA),
USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA),
@@ -529,6 +531,9 @@ static struct usb_quirk_entry usb_quirks
 
/* DYMO LabelManager Pnp */
USB_QUIRK(DYMO, LABELMANAGERPNP, 0x, 0x, UQ_MSC_DYMO_EJECT),
+
+   /* Holtek USB gaming keyboard */
+   USB_QUIRK(HOLTEK, F85, 0x, 0x, UQ_KBD_BOOTPROTO),
 };
 #undef USB_QUIRK_VP
 #undef USB_QUIRK

Modified: stable/10/sys/dev/usb/usbdevs
==
--- stable/10/sys/dev/usb/usbdevs   Fri Apr 29 11:31:27 2016
(r298780)
+++ stable/10/sys/dev/usb/usbdevs   Fri Apr 29 11:37:06 2016
(r298781)
@@ -1509,6 +1509,7 @@ product COREGA FETHER_USB_TXC 0x9601  FEt
 /* Corsair products */
 product CORSAIR K600x0a60  Corsair Vengeance K60 keyboard
 product CORSAIR K700x1b09  Corsair Vengeance K70 keyboard
+product CORSAIR STRAFE 0x1b15  Cossair STRAFE Gaming keyboard
 
 /* Creative products */
 product CREATIVE NOMAD_II  0x1002  Nomad II MP3 player
@@ -2266,6 +2267,9 @@ product HIDGLOBAL CM6020  0x1784  Omnikey 
 product HITACHI DVDCAM_DZ_MV100A   0x0004  DVD-CAM DZ-MV100A Camcorder
 product HITACHI DVDCAM_USB 0x001e  DVDCAM USB HS Interface
 
+/* Holtek products */
+product HOLTEK F85 0xa030  Holtek USB gaming keyboard
+
 /* HP products */
 product HP 895C0x0004  DeskJet 895C
 product HP 4100C   0x0101  Scanjet 4100C
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r299258 - in stable/10/sys/dev/mlx5: . mlx5_core mlx5_en

2016-05-09 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May  9 13:09:41 2016
New Revision: 299258
URL: https://svnweb.freebsd.org/changeset/base/299258

Log:
  MFC r298771:
  Add function to detect the presence of a port module and use this
  function to error out early when no port module is present and doing
  eeprom access. This also prevents error codes from filling up in
  dmesg.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix

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

Modified: stable/10/sys/dev/mlx5/driver.h
==
--- stable/10/sys/dev/mlx5/driver.h Mon May  9 12:24:39 2016
(r299257)
+++ stable/10/sys/dev/mlx5/driver.h Mon May  9 13:09:41 2016
(r299258)
@@ -542,6 +542,7 @@ struct mlx5_core_dev {
atomic_tnum_qps;
u32 issi;
struct mlx5_special_contexts special_contexts;
+   unsigned int module_status[MLX5_MAX_PORTS];
 };
 
 enum {
@@ -835,6 +836,7 @@ int mlx5_set_port_mtu(struct mlx5_core_d
 int mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu);
 int mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu);
 
+unsigned int mlx5_query_module_status(struct mlx5_core_dev *dev, int 
module_num);
 int mlx5_query_module_num(struct mlx5_core_dev *dev, int *module_num);
 int mlx5_query_eeprom(struct mlx5_core_dev *dev, int i2c_addr, int page_num,
  int device_addr, int size, int module_num, u32 *data,

Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==
--- stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c  Mon May  9 12:24:39 2016
(r299257)
+++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c  Mon May  9 13:09:41 2016
(r299258)
@@ -581,6 +581,13 @@ static const char *mlx5_port_module_even
}
 }
 
+unsigned int mlx5_query_module_status(struct mlx5_core_dev *dev, int 
module_num)
+{
+   if (module_num < 0 || module_num >= MLX5_MAX_PORTS)
+   return 0;   /* undefined */
+   return dev->module_status[module_num];
+}
+
 static void mlx5_port_module_event(struct mlx5_core_dev *dev,
   struct mlx5_eqe *eqe)
 {
@@ -614,5 +621,8 @@ static void mlx5_port_module_event(struc
default:
device_printf((>dev)->bsddev, "INFO: ""Module %u, unknown 
status", module_num);
}
+   /* store module status */
+   if (module_num < MLX5_MAX_PORTS)
+   dev->module_status[module_num] = module_status;
 }
 

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon May  9 12:24:39 
2016(r299257)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon May  9 13:09:41 
2016(r299258)
@@ -2561,7 +2561,12 @@ out:
"reading is not supported\n");
goto err_i2c;
}
-
+   /* Check if module is present before doing an access */
+   if (mlx5_query_module_status(priv->mdev, module_num) !=
+   MLX5_MODULE_STATUS_PLUGGED) {
+   error = EINVAL;
+   goto err_i2c;
+   }
/*
 * Currently 0XA0 and 0xA2 are the only addresses permitted.
 * The internal conversion is as follows:
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r299259 - stable/10/sys/dev/mlx5/mlx5_en

2016-05-09 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May  9 13:11:00 2016
New Revision: 299259
URL: https://svnweb.freebsd.org/changeset/base/299259

Log:
  MFC r298772:
  Correct some error codes to native FreeBSD ones.
  
  Sponsored by: Mellanox Technologies
  Tested by:Netflix

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon May  9 13:09:41 
2016(r299258)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon May  9 13:11:00 
2016(r299259)
@@ -2559,6 +2559,7 @@ out:
if (error) {
if_printf(ifp, "Query module num failed, eeprom "
"reading is not supported\n");
+   error = EINVAL;
goto err_i2c;
}
/* Check if module is present before doing an access */
@@ -2588,6 +2589,7 @@ out:
if (error) {
if_printf(ifp, "Query eeprom failed, eeprom "
"reading is not supported\n");
+   error = EINVAL;
goto err_i2c;
}
 
@@ -2601,6 +2603,7 @@ out:
if (error) {
if_printf(ifp, "Query eeprom failed, eeprom "
"reading is not supported\n");
+   error = EINVAL;
goto err_i2c;
}
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r299260 - stable/10/etc/devd

2016-05-09 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May  9 13:12:12 2016
New Revision: 299260
URL: https://svnweb.freebsd.org/changeset/base/299260

Log:
  MFC r298783:
  Regenerate usb.conf .

Modified:
  stable/10/etc/devd/usb.conf
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/devd/usb.conf
==
--- stable/10/etc/devd/usb.conf Mon May  9 13:11:00 2016(r299259)
+++ stable/10/etc/devd/usb.conf Mon May  9 13:12:12 2016(r299260)
@@ -1721,7 +1721,7 @@ nomatch 32 {
match "bus" "uhub[0-9]+";
match "mode" "host";
match "vendor" "0x07b8";
-   match "product" "(0x8178|0x8188|0x8189)";
+   match "product" "(0x8178|0x8179|0x8188|0x8189)";
action "kldload -n if_urtwn";
 };
 
@@ -3161,7 +3161,23 @@ nomatch 32 {
match "bus" "uhub[0-9]+";
match "mode" "host";
match "vendor" "0x0df6";
-   match "product" "(0x0052|0x005c|0x0061)";
+   match "product" "0x0052";
+   action "kldload -n if_urtwn";
+};
+
+nomatch 32 {
+   match "bus" "uhub[0-9]+";
+   match "mode" "host";
+   match "vendor" "0x0df6";
+   match "product" "0x0056";
+   action "kldload -n if_axe";
+};
+
+nomatch 32 {
+   match "bus" "uhub[0-9]+";
+   match "mode" "host";
+   match "vendor" "0x0df6";
+   match "product" "(0x005c|0x0061)";
action "kldload -n if_urtwn";
 };
 
@@ -4633,7 +4649,7 @@ nomatch 32 {
match "bus" "uhub[0-9]+";
match "mode" "host";
match "vendor" "0x17e9";
-   match "product" 
"(0x0059|0x0100|0x0117|0x0136|0x0138|0x0141|0x015a|0x0198|0x019b|0x01ba|0x01bb|0x01d4|0x01d7|0x01e2|0x0215|0x024c|0x02a9|0x0377|0x03e0|0x401a)";
+   match "product" 
"(0x0059|0x0100|0x0117|0x0136|0x0138|0x0141|0x015a|0x0198|0x019b|0x01ba|0x01bb|0x01d4|0x01d7|0x01e2|0x0215|0x024c|0x02a9|0x02e9|0x0377|0x03e0|0x401a)";
action "kldload -n udl";
 };
 
@@ -5801,5 +5817,5 @@ nomatch 32 {
action "kldload -n umass";
 };
 
-# 2719 USB entries processed
+# 2722 USB entries processed
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r303993 - stable/10/sys/dev/sound/usb

2016-08-12 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 12 07:57:27 2016
New Revision: 303993
URL: https://svnweb.freebsd.org/changeset/base/303993

Log:
  MFC r301039:
  Add support for simplex USB MIDI devices, which only provide BULK or
  INTERRUPT endpoints for moving data in one direction, like the KeyRig
  49 from M-Audio.
  
  Requested by: Ivan Klymenko 

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

Modified: stable/10/sys/dev/sound/usb/uaudio.c
==
--- stable/10/sys/dev/sound/usb/uaudio.cFri Aug 12 07:57:03 2016
(r303992)
+++ stable/10/sys/dev/sound/usb/uaudio.cFri Aug 12 07:57:27 2016
(r303993)
@@ -663,6 +663,7 @@ static const struct usb_config
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = UMIDI_TX_BUFFER,
+   .flags = {.no_pipe_ok = 1},
.callback = _bulk_write_callback,
},
 
@@ -671,7 +672,7 @@ static const struct usb_config
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.bufsize = 4,   /* bytes */
-   .flags = {.short_xfer_ok = 1,.proxy_buffer = 1,},
+   .flags = {.short_xfer_ok = 1,.proxy_buffer = 1,.no_pipe_ok = 1},
.callback = _bulk_read_callback,
},
 };
@@ -5760,7 +5761,16 @@ umidi_start_write(struct usb_fifo *fifo)
 {
struct umidi_chan *chan = usb_fifo_softc(fifo);
 
-   usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]);
+   if (chan->xfer[UMIDI_TX_TRANSFER] == NULL) {
+   uint8_t buf[1];
+   int actlen;
+   do {
+   /* dump data */
+   usb_fifo_get_data_linear(fifo, buf, 1, , 0);
+   } while (actlen > 0);
+   } else {
+   usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]);
+   }
 }
 
 static void
@@ -5878,6 +5888,11 @@ umidi_probe(device_t dev)
DPRINTF("error=%s\n", usbd_errstr(error));
goto detach;
}
+   if (chan->xfer[UMIDI_TX_TRANSFER] == NULL &&
+   chan->xfer[UMIDI_RX_TRANSFER] == NULL) {
+   DPRINTF("no BULK or INTERRUPT MIDI endpoint(s) found\n");
+   goto detach;
+   }
 
/*
 * Some USB MIDI device makers couldn't resist using
@@ -5891,7 +5906,8 @@ umidi_probe(device_t dev)
 * and 64-byte maximum packet sizes for full-speed bulk
 * endpoints and 512 bytes for high-speed bulk endpoints."
 */
-   if (usbd_xfer_maxp_was_clamped(chan->xfer[UMIDI_TX_TRANSFER]))
+   if (chan->xfer[UMIDI_TX_TRANSFER] != NULL &&
+   usbd_xfer_maxp_was_clamped(chan->xfer[UMIDI_TX_TRANSFER]))
chan->single_command = 1;
 
if (chan->single_command != 0)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r303996 - stable/10/sys/dev/usb/controller

2016-08-12 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Aug 12 08:05:40 2016
New Revision: 303996
URL: https://svnweb.freebsd.org/changeset/base/303996

Log:
  MFC r302371:
  Fix regression issue with XHCI on 32-bit ARMv7 Armada-38x. Make sure
  "struct xhci_dev_ctx_addr" fits into a single 4K page until further.

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

Modified: stable/10/sys/dev/usb/controller/xhci.h
==
--- stable/10/sys/dev/usb/controller/xhci.h Fri Aug 12 08:03:31 2016
(r303995)
+++ stable/10/sys/dev/usb/controller/xhci.h Fri Aug 12 08:05:40 2016
(r303996)
@@ -30,7 +30,7 @@
 
 #defineXHCI_MAX_DEVICESMIN(USB_MAX_DEVICES, 128)
 #defineXHCI_MAX_ENDPOINTS  32  /* hardcoded - do not change */
-#defineXHCI_MAX_SCRATCHPADS1024
+#defineXHCI_MAX_SCRATCHPADS256 /* theoretical max is 1023 */
 #defineXHCI_MAX_EVENTS (16 * 13)
 #defineXHCI_MAX_COMMANDS   (16 * 1)
 #defineXHCI_MAX_RSEG   1
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r304125 - stable/10/sys/dev/usb/input

2016-08-15 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Aug 15 09:00:46 2016
New Revision: 304125
URL: https://svnweb.freebsd.org/changeset/base/304125

Log:
  MFC r303765:
  Keep a reference count on USB keyboard polling to allow recursive
  cngrab() during a panic for example, similar to what the AT-keyboard
  driver is doing.
  
  Found by: Bruce Evans 

Modified:
  stable/10/sys/dev/usb/input/ukbd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/input/ukbd.c
==
--- stable/10/sys/dev/usb/input/ukbd.c  Mon Aug 15 08:58:55 2016
(r304124)
+++ stable/10/sys/dev/usb/input/ukbd.c  Mon Aug 15 09:00:46 2016
(r304125)
@@ -201,6 +201,7 @@ struct ukbd_softc {
int sc_mode;/* input mode (K_XLATE,K_RAW,K_CODE) */
int sc_state;   /* shift/lock key state */
int sc_accents; /* accent key index (> 0) */
+   int sc_polling; /* polling recursion count */
int sc_led_size;
int sc_kbd_size;
 
@@ -1986,7 +1987,16 @@ ukbd_poll(keyboard_t *kbd, int on)
struct ukbd_softc *sc = kbd->kb_data;
 
UKBD_LOCK();
-   if (on) {
+   /*
+* Keep a reference count on polling to allow recursive
+* cngrab() during a panic for example.
+*/
+   if (on)
+   sc->sc_polling++;
+   else
+   sc->sc_polling--;
+
+   if (sc->sc_polling != 0) {
sc->sc_flags |= UKBD_FLAG_POLLING;
sc->sc_poll_thread = curthread;
} else {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r302269 - stable/10/sys/dev/mlx5/mlx5_core

2016-06-29 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 29 10:29:52 2016
New Revision: 302269
URL: https://svnweb.freebsd.org/changeset/base/302269

Log:
  MFC r302139:
  Use correct Q-counter output array.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==
--- stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c   Wed Jun 29 10:25:32 
2016(r302268)
+++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c   Wed Jun 29 10:29:52 
2016(r302269)
@@ -71,7 +71,7 @@ static int mlx5_query_nic_vport_context(
 int mlx5_vport_alloc_q_counter(struct mlx5_core_dev *mdev, int *counter_set_id)
 {
u32 in[MLX5_ST_SZ_DW(alloc_q_counter_in)];
-   u32 out[MLX5_ST_SZ_DW(alloc_q_counter_in)];
+   u32 out[MLX5_ST_SZ_DW(alloc_q_counter_out)];
int err;
 
memset(in, 0, sizeof(in));
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r302266 - stable/10/sys/dev/usb/controller

2016-06-29 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 29 10:21:45 2016
New Revision: 302266
URL: https://svnweb.freebsd.org/changeset/base/302266

Log:
  MFC r302076:
  Update the definition for number of scratch pages to match the latest
  version of the XHCI specification. Make sure the code can handle the
  maximum number of allowed scratch pages.
  
  Submitted by: shichun...@dell.com

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

Modified: stable/10/sys/dev/usb/controller/xhci.c
==
--- stable/10/sys/dev/usb/controller/xhci.c Wed Jun 29 07:55:45 2016
(r302265)
+++ stable/10/sys/dev/usb/controller/xhci.c Wed Jun 29 10:21:45 2016
(r302266)
@@ -215,7 +215,7 @@ static void
 xhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
 {
struct xhci_softc *sc = XHCI_BUS2SC(bus);
-   uint8_t i;
+   uint16_t i;
 
cb(bus, >sc_hw.root_pc, >sc_hw.root_pg,
   sizeof(struct xhci_hw_root), XHCI_PAGE_SIZE);
@@ -223,7 +223,7 @@ xhci_iterate_hw_softc(struct usb_bus *bu
cb(bus, >sc_hw.ctx_pc, >sc_hw.ctx_pg,
   sizeof(struct xhci_dev_ctx_addr), XHCI_PAGE_SIZE);
 
-   for (i = 0; i != XHCI_MAX_SCRATCHPADS; i++) {
+   for (i = 0; i != sc->sc_noscratch; i++) {
cb(bus, >sc_hw.scratch_pc[i], >sc_hw.scratch_pg[i],
XHCI_PAGE_SIZE, XHCI_PAGE_SIZE);
}

Modified: stable/10/sys/dev/usb/controller/xhci.h
==
--- stable/10/sys/dev/usb/controller/xhci.h Wed Jun 29 07:55:45 2016
(r302265)
+++ stable/10/sys/dev/usb/controller/xhci.h Wed Jun 29 10:21:45 2016
(r302266)
@@ -30,7 +30,7 @@
 
 #defineXHCI_MAX_DEVICESMIN(USB_MAX_DEVICES, 128)
 #defineXHCI_MAX_ENDPOINTS  32  /* hardcoded - do not change */
-#defineXHCI_MAX_SCRATCHPADS32
+#defineXHCI_MAX_SCRATCHPADS1024
 #defineXHCI_MAX_EVENTS (16 * 13)
 #defineXHCI_MAX_COMMANDS   (16 * 1)
 #defineXHCI_MAX_RSEG   1
@@ -495,14 +495,15 @@ struct xhci_softc {
uint16_tsc_command_idx;
uint16_tsc_imod_default;
 
+   /* number of scratch pages */
+   uint16_tsc_noscratch;
+
uint8_t sc_event_ccs;
uint8_t sc_command_ccs;
/* number of XHCI device slots */
uint8_t sc_noslot;
/* number of ports on root HUB */
uint8_t sc_noport;
-   /* number of scratch pages */
-   uint8_t sc_noscratch;
/* root HUB device configuration */
uint8_t sc_conf;
/* root HUB port event bitmap, max 256 ports */

Modified: stable/10/sys/dev/usb/controller/xhcireg.h
==
--- stable/10/sys/dev/usb/controller/xhcireg.h  Wed Jun 29 07:55:45 2016
(r302265)
+++ stable/10/sys/dev/usb/controller/xhcireg.h  Wed Jun 29 10:21:45 2016
(r302266)
@@ -52,8 +52,8 @@
 #defineXHCI_HCSPARAMS2 0x08/* RO structual parameters 2 */
 #defineXHCI_HCS2_IST(x)((x) & 0xF)
 #defineXHCI_HCS2_ERST_MAX(x)   (((x) >> 4) & 0xF)
-#defineXHCI_HCS2_SPR(x)(((x) >> 24) & 0x1)
-#defineXHCI_HCS2_SPB_MAX(x)(((x) >> 27) & 0x7F)
+#defineXHCI_HCS2_SPR(x)(((x) >> 26) & 0x1)
+#defineXHCI_HCS2_SPB_MAX(x)x) >> 16) & 0x3E0) | (((x) >> 27) & 
0x1F))
 #defineXHCI_HCSPARAMS3 0x0C/* RO structual parameters 3 */
 #defineXHCI_HCS3_U1_DEL(x) ((x) & 0xFF)
 #defineXHCI_HCS3_U2_DEL(x) (((x) >> 16) & 0x)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r302562 - stable/10/sys/dev/usb/controller

2016-07-11 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jul 11 12:59:23 2016
New Revision: 302562
URL: https://svnweb.freebsd.org/changeset/base/302562

Log:
  MFC r302306:
  Fix detection of USB device disconnects in USB host mode when the USB
  device is connected directly to the USB port of the DWC OTG, in this
  case a RPI-zero.
  
  PR:   210695

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

Modified: stable/10/sys/dev/usb/controller/dwc_otg.c
==
--- stable/10/sys/dev/usb/controller/dwc_otg.c  Mon Jul 11 12:44:58 2016
(r302561)
+++ stable/10/sys/dev/usb/controller/dwc_otg.c  Mon Jul 11 12:59:23 2016
(r302562)
@@ -2981,7 +2981,8 @@ dwc_otg_interrupt(void *arg)
else
sc->sc_flags.status_bus_reset = 0;
 
-   if (hprt & HPRT_PRTENCHNG)
+   if ((hprt & HPRT_PRTENCHNG) &&
+   (hprt & HPRT_PRTENA) == 0)
sc->sc_flags.change_enabled = 1;
 
if (hprt & HPRT_PRTENA)
@@ -4741,6 +4742,8 @@ tr_handle_get_port_status:
 
value = 0;
 
+   if (sc->sc_flags.change_enabled)
+   value |= UPS_C_PORT_ENABLED;
if (sc->sc_flags.change_connect)
value |= UPS_C_CONNECT_STATUS;
if (sc->sc_flags.change_suspend)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r302272 - stable/10/lib/libusb

2016-06-29 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 29 10:43:31 2016
New Revision: 302272
URL: https://svnweb.freebsd.org/changeset/base/302272

Log:
  MFC r301842:
  Implement code to stop all USB endpoints before executing a USB device
  reset command, alternate setting command or set configuration
  command. Else LibUSB v1.0 will not re-open the endpoints which the
  kernel closes and the USB application might wait infinitely for
  transfers to complete.

Modified:
  stable/10/lib/libusb/libusb10.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libusb/libusb10.c
==
--- stable/10/lib/libusb/libusb10.c Wed Jun 29 10:40:34 2016
(r302271)
+++ stable/10/lib/libusb/libusb10.c Wed Jun 29 10:43:31 2016
(r302272)
@@ -51,6 +51,8 @@
 #include "libusb.h"
 #include "libusb10.h"
 
+#defineLIBUSB_NUM_SW_ENDPOINTS (16 * 4)
+
 static pthread_mutex_t default_context_lock = PTHREAD_MUTEX_INITIALIZER;
 struct libusb_context *usbi_default_context = NULL;
 
@@ -442,7 +444,7 @@ libusb_open(libusb_device *dev, libusb_d
if (dev == NULL)
return (LIBUSB_ERROR_INVALID_PARAM);
 
-   err = libusb20_dev_open(pdev, 16 * 4 /* number of endpoints */ );
+   err = libusb20_dev_open(pdev, LIBUSB_NUM_SW_ENDPOINTS);
if (err) {
libusb_unref_device(dev);
return (LIBUSB_ERROR_NO_MEM);
@@ -1489,7 +1491,17 @@ libusb_cancel_transfer(struct libusb_tra
 UNEXPORTED void
 libusb10_cancel_all_transfer(libusb_device *dev)
 {
-   /* TODO */
+   struct libusb20_device *pdev = dev->os_priv;
+   unsigned x;
+
+   for (x = 0; x != LIBUSB_NUM_SW_ENDPOINTS; x++) {
+   struct libusb20_transfer *xfer;
+
+   xfer = libusb20_tr_get_pointer(pdev, x);
+   if (xfer == NULL)
+   continue;
+   libusb20_tr_close(xfer);
+   }
 }
 
 uint16_t
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r302275 - stable/10/lib/libusb

2016-06-29 Thread Hans Petter Selasky
;bDescriptorType;
+   desc->bDevCapabilityType = dev_cap->bDevCapabilityType;
+   desc->bmAttributes =
+   (dev_cap->dev_capability_data[0]) |
+   (dev_cap->dev_capability_data[1] << 8) |
+   (dev_cap->dev_capability_data[2] << 16) |
+   (dev_cap->dev_capability_data[3] << 24);
+
+   *usb_2_0_extension = desc;
+   return (0);
+}
+
+void
+libusb_free_usb_2_0_extension_descriptor(
+struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension)
+{
+
+   free(usb_2_0_extension);
+}
+
+int
+libusb_get_ss_usb_device_capability_descriptor(struct libusb_context *ctx,
+struct libusb_bos_dev_capability_descriptor *dev_cap,
+struct libusb_ss_usb_device_capability_descriptor 
**ss_usb_device_capability)
+{
+   struct libusb_ss_usb_device_capability_descriptor *desc;
+
+   if (dev_cap == NULL || ss_usb_device_capability == NULL ||
+   dev_cap->bDevCapabilityType != LIBUSB_BT_SS_USB_DEVICE_CAPABILITY)
+   return (LIBUSB_ERROR_INVALID_PARAM);
+   if (dev_cap->bLength < LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE)
+   return (LIBUSB_ERROR_IO);
+
+   desc = malloc(sizeof(*desc));
+   if (desc == NULL)
+   return (LIBUSB_ERROR_NO_MEM);
+
+   desc->bLength = LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE;
+   desc->bDescriptorType = dev_cap->bDescriptorType;
+   desc->bDevCapabilityType = dev_cap->bDevCapabilityType;
+   desc->bmAttributes = dev_cap->dev_capability_data[0];
+   desc->wSpeedSupported = dev_cap->dev_capability_data[1] |
+   (dev_cap->dev_capability_data[2] << 8);
+   desc->bFunctionalitySupport = dev_cap->dev_capability_data[3];
+   desc->bU1DevExitLat = dev_cap->dev_capability_data[4];
+   desc->wU2DevExitLat = dev_cap->dev_capability_data[5] |
+   (dev_cap->dev_capability_data[6] << 8);
+
+   *ss_usb_device_capability = desc;
+   return (0);
+}
+
+void
+libusb_free_ss_usb_device_capability_descriptor(
+struct libusb_ss_usb_device_capability_descriptor 
*ss_usb_device_capability)
+{
+
+   free(ss_usb_device_capability);
+}
+
+int
+libusb_get_container_id_descriptor(struct libusb_context *ctx,
+struct libusb_bos_dev_capability_descriptor *dev_cap,
+struct libusb_container_id_descriptor **container_id)
+{
+   struct libusb_container_id_descriptor *desc;
+
+   if (dev_cap == NULL || container_id == NULL ||
+   dev_cap->bDevCapabilityType != LIBUSB_BT_CONTAINER_ID)
+   return (LIBUSB_ERROR_INVALID_PARAM);
+   if (dev_cap->bLength < LIBUSB_BT_CONTAINER_ID_SIZE)
+   return (LIBUSB_ERROR_IO);
+
+   desc = malloc(sizeof(*desc));
+   if (desc == NULL)
+   return (LIBUSB_ERROR_NO_MEM);
+
+   desc->bLength = LIBUSB_BT_CONTAINER_ID_SIZE;
+   desc->bDescriptorType = dev_cap->bDescriptorType;
+   desc->bDevCapabilityType = dev_cap->bDevCapabilityType;
+   desc->bReserved = dev_cap->dev_capability_data[0];
+   memcpy(desc->ContainerID, dev_cap->dev_capability_data + 1,
+   sizeof(desc->ContainerID));
+
+   *container_id = desc;
+   return (0);
+}
+
+void
+libusb_free_container_id_descriptor(
+struct libusb_container_id_descriptor *container_id)
+{
+
+   free(container_id);
+}

Copied: stable/10/lib/libusb/libusb10_hotplug.c (from r302080, 
head/lib/libusb/libusb10_hotplug.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/lib/libusb/libusb10_hotplug.c Wed Jun 29 10:58:36 2016
(r302275, copy of r302080, head/lib/libusb/libusb10_hotplug.c)
@@ -0,0 +1,237 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2016 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+

svn commit: r302270 - in stable/10/sys/dev/mlx5: . mlx5_core mlx5_en

2016-06-29 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 29 10:33:11 2016
New Revision: 302270
URL: https://svnweb.freebsd.org/changeset/base/302270

Log:
  MFC r301545:
  Add SR-IOV guest support to the mlx5en driver.
  
  This patch adds the missing pieces needed for device setup using the
  mlx5en driver inside a virtual machine which is providing hardware
  access through SR-IOV.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/driver.h
  stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/vport.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/driver.h
==
--- stable/10/sys/dev/mlx5/driver.h Wed Jun 29 10:29:52 2016
(r302269)
+++ stable/10/sys/dev/mlx5/driver.h Wed Jun 29 10:33:11 2016
(r302270)
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c
==
--- stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c   Wed Jun 29 10:29:52 
2016(r302269)
+++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_vport.c   Wed Jun 29 10:33:11 
2016(r302270)
@@ -471,6 +471,241 @@ int mlx5_set_nic_vport_promisc(struct ml
return mlx5_modify_nic_vport_context(mdev, in, sizeof(in));
 }
 EXPORT_SYMBOL_GPL(mlx5_set_nic_vport_promisc);
+
+int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
+ u32 vport,
+ enum mlx5_list_type list_type,
+ u8 addr_list[][ETH_ALEN],
+ int *list_size)
+{
+   u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)];
+   void *nic_vport_ctx;
+   int max_list_size;
+   int req_list_size;
+   u8 *mac_addr;
+   int out_sz;
+   void *out;
+   int err;
+   int i;
+
+   req_list_size = *list_size;
+
+   max_list_size = (list_type == MLX5_NIC_VPORT_LIST_TYPE_UC) ?
+   1 << MLX5_CAP_GEN_MAX(dev, log_max_current_uc_list) :
+   1 << MLX5_CAP_GEN_MAX(dev, log_max_current_mc_list);
+
+   if (req_list_size > max_list_size) {
+   mlx5_core_warn(dev, "Requested list size (%d) > (%d) 
max_list_size\n",
+  req_list_size, max_list_size);
+   req_list_size = max_list_size;
+   }
+
+   out_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
+req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
+
+   memset(in, 0, sizeof(in));
+   out = kzalloc(out_sz, GFP_KERNEL);
+   if (!out)
+   return -ENOMEM;
+
+   MLX5_SET(query_nic_vport_context_in, in, opcode,
+MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT);
+   MLX5_SET(query_nic_vport_context_in, in, allowed_list_type, list_type);
+   MLX5_SET(query_nic_vport_context_in, in, vport_number, vport);
+
+   if (vport)
+   MLX5_SET(query_nic_vport_context_in, in, other_vport, 1);
+
+   err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, out_sz);
+   if (err)
+   goto out;
+
+   nic_vport_ctx = MLX5_ADDR_OF(query_nic_vport_context_out, out,
+nic_vport_context);
+   req_list_size = MLX5_GET(nic_vport_context, nic_vport_ctx,
+allowed_list_size);
+
+   *list_size = req_list_size;
+   for (i = 0; i < req_list_size; i++) {
+   mac_addr = MLX5_ADDR_OF(nic_vport_context,
+   nic_vport_ctx,
+   current_uc_mac_address[i]) + 2;
+   ether_addr_copy(addr_list[i], mac_addr);
+   }
+out:
+   kfree(out);
+   return err;
+}
+EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mac_list);
+
+int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
+  enum mlx5_list_type list_type,
+  u8 addr_list[][ETH_ALEN],
+  int list_size)
+{
+   u32 out[MLX5_ST_SZ_DW(modify_nic_vport_context_out)];
+   void *nic_vport_ctx;
+   int max_list_size;
+   int in_sz;
+   void *in;
+   int err;
+   int i;
+
+   max_list_size = list_type == MLX5_NIC_VPORT_LIST_TYPE_UC ?
+1 << MLX5_CAP_GEN(dev, log_max_current_uc_list) :
+1 << MLX5_CAP_GEN(dev, log_max_current_mc_list);
+
+   if (list_size > max_list_size)
+   return -ENOSPC;
+
+   in_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
+   list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
+
+   memset(out, 0, sizeof(out));
+   in = kzalloc(in_sz, GFP_KERNEL);
+   if (!in)
+

svn commit: r302271 - stable/10/sys/ofed/include/linux

2016-06-29 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 29 10:40:34 2016
New Revision: 302271
URL: https://svnweb.freebsd.org/changeset/base/302271

Log:
  MFC r301544:
  Fallback to arc4rand() in the LinuxKPI when read_random() returns
  zero. This can happen for virtual machines.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/ofed/include/linux/etherdevice.h
  stable/10/sys/ofed/include/linux/random.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ofed/include/linux/etherdevice.h
==
--- stable/10/sys/ofed/include/linux/etherdevice.h  Wed Jun 29 10:33:11 
2016(r302270)
+++ stable/10/sys/ofed/include/linux/etherdevice.h  Wed Jun 29 10:40:34 
2016(r302271)
@@ -137,7 +137,8 @@ eth_broadcast_addr(u8 *pa)
 static inline void
 random_ether_addr(u8 * dst)
 {
-   read_random(dst, 6);
+   if (read_random(dst, 6) == 0)
+   arc4rand(dst, 6, 0);
 
dst[0] &= 0xfe;
dst[0] |= 0x02;

Modified: stable/10/sys/ofed/include/linux/random.h
==
--- stable/10/sys/ofed/include/linux/random.h   Wed Jun 29 10:33:11 2016
(r302270)
+++ stable/10/sys/ofed/include/linux/random.h   Wed Jun 29 10:40:34 2016
(r302271)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,11 +31,13 @@
 #define_LINUX_RANDOM_H_
 
 #include 
+#include 
 
 static inline void
 get_random_bytes(void *buf, int nbytes)
 {
-   read_random(buf, nbytes);
+   if (read_random(buf, nbytes) == 0)
+   arc4rand(buf, nbytes, 0);
 }
 
 #endif /* _LINUX_RANDOM_H_ */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


  1   2   3   4   >