svn commit: r291643 - head/sys/net

2015-12-02 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Dec  2 08:17:31 2015
New Revision: 291643
URL: https://svnweb.freebsd.org/changeset/base/291643

Log:
  Move RTF_PINNED handling to generic route code.
  This eliminates last RTF_RNH_LOCKED rtrequest1_fib() user.

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cWed Dec  2 05:36:45 2015(r291642)
+++ head/sys/net/route.cWed Dec  2 08:17:31 2015(r291643)
@@ -1089,6 +1089,7 @@ rt_unlinkrte(struct radix_node_head *rnh
rt = RNTORT(rn);
RT_LOCK(rt);
RT_ADDREF(rt);
+   rt->rt_flags &= ~RTF_UP;
 
*perror = 0;
 
@@ -1100,8 +1101,6 @@ rt_notifydelete(struct rtentry *rt, stru
 {
struct ifaddr *ifa;
 
-   rt->rt_flags &= ~RTF_UP;
-
/*
 * give the protocol a chance to keep things in sync.
 */
@@ -1434,7 +1433,7 @@ rtrequest1_fib(int req, struct rt_addrin
u_int fibnum)
 {
int error = 0, needlock = 0;
-   struct rtentry *rt;
+   struct rtentry *rt, *rt_old;
 #ifdef FLOWTABLE
struct rtentry *rt0;
 #endif
@@ -1577,6 +1576,26 @@ rtrequest1_fib(int req, struct rt_addrin
 
/* XXX mtu manipulation will be done in rnh_addaddr -- itojun */
rn = rnh->rnh_addaddr(ndst, netmask, rnh, rt->rt_nodes);
+
+   rt_old = NULL;
+   if (rn == NULL && (info->rti_flags & RTF_PINNED) != 0) {
+
+   /*
+* Force removal and re-try addition
+* TODO: better multipath&pinned support
+*/
+   struct sockaddr *info_dst = info->rti_info[RTAX_DST];
+   info->rti_info[RTAX_DST] = ndst;
+   rt_old = rt_unlinkrte(rnh, info, &error);
+   info->rti_info[RTAX_DST] = info_dst;
+   if (rt_old != NULL)
+   rn = rnh->rnh_addaddr(ndst, netmask, rnh,
+   rt->rt_nodes);
+   }
+
+   if (rt_old != NULL)
+   RT_UNLOCK(rt_old);
+
/*
 * If it still failed to go into the tree,
 * then un-make it (this should be a function)
@@ -1598,6 +1617,11 @@ rtrequest1_fib(int req, struct rt_addrin
}
 #endif
 
+   if (rt_old != NULL) {
+   rt_notifydelete(rt_old, info);
+   RTFREE(rt_old);
+   }
+
/*
 * If this protocol has something to add to this then
 * allow it to do that as well.
@@ -1974,32 +1998,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int
info.rti_info[RTAX_NETMASK] = netmask;
error = rtrequest1_fib(cmd, &info, &rt, fibnum);
 
-   if ((error == EEXIST) && (cmd == RTM_ADD)) {
-   /*
-* Interface route addition failed.
-* Atomically delete current prefix generating
-* RTM_DELETE message, and retry adding
-* interface prefix.
-*/
-   rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
-   RADIX_NODE_HEAD_LOCK(rnh);
-
-   /* Delete old prefix */
-   info.rti_ifa = NULL;
-   info.rti_flags = RTF_RNH_LOCKED;
-
-   error = rtrequest1_fib(RTM_DELETE, &info, NULL, fibnum);
-   if (error == 0) {
-   info.rti_ifa = ifa;
-   info.rti_flags = flags | RTF_RNH_LOCKED |
-   (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED;
-   error = rtrequest1_fib(cmd, &info, &rt, fibnum);
-   }
-
-   RADIX_NODE_HEAD_UNLOCK(rnh);
-   }
-
-
if (error == 0 && rt != NULL) {
/*
 * notify any listening routing agents of the change
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291648 - head/sys/dev/ofw

2015-12-02 Thread Michal Meloun
Author: mmel
Date: Wed Dec  2 14:21:16 2015
New Revision: 291648
URL: https://svnweb.freebsd.org/changeset/base/291648

Log:
  OFW: Move code for searching interrupt parent into separate function.
  It can be used by interrupt controller drivers.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/dev/ofw/ofw_bus_subr.c
  head/sys/dev/ofw/ofw_bus_subr.h

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Wed Dec  2 12:58:20 2015
(r291647)
+++ head/sys/dev/ofw/ofw_bus_subr.c Wed Dec  2 14:21:16 2015
(r291648)
@@ -430,6 +430,27 @@ ofw_bus_reg_to_rl(device_t dev, phandle_
return (0);
 }
 
+/*
+ * Get interrupt parent for given node.
+ * Returns 0 if interrupt parent doesn't exist.
+ */
+phandle_t
+ofw_bus_find_iparent(phandle_t node)
+{
+   phandle_t iparent;
+
+   if (OF_searchencprop(node, "interrupt-parent", &iparent,
+   sizeof(iparent)) == -1) {
+   for (iparent = node; iparent != 0;
+   iparent = OF_parent(iparent)) {
+   if (OF_hasprop(iparent, "interrupt-controller"))
+   break;
+   }
+   iparent = OF_xref_from_node(iparent);
+   }
+   return (iparent);
+}
+
 int
 ofw_bus_intr_to_rl(device_t dev, phandle_t node,
 struct resource_list *rl, int *rlen)
@@ -442,18 +463,11 @@ ofw_bus_intr_to_rl(device_t dev, phandle
nintr = OF_getencprop_alloc(node, "interrupts",  sizeof(*intr),
(void **)&intr);
if (nintr > 0) {
-   if (OF_searchencprop(node, "interrupt-parent", &iparent,
-   sizeof(iparent)) == -1) {
-   for (iparent = node; iparent != 0;
-   iparent = OF_parent(iparent)) {
-   if (OF_hasprop(iparent, "interrupt-controller"))
-   break;
-   }
-   if (iparent == 0) {
-   device_printf(dev, "No interrupt-parent found, "
-   "assuming direct parent\n");
-   iparent = OF_parent(node);
-   }
+   iparent = ofw_bus_find_iparent(node);
+   if (iparent == 0) {
+   device_printf(dev, "No interrupt-parent found, "
+   "assuming direct parent\n");
+   iparent = OF_parent(node);
iparent = OF_xref_from_node(iparent);
}
if (OF_searchencprop(OF_node_from_xref(iparent), 

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==
--- head/sys/dev/ofw/ofw_bus_subr.h Wed Dec  2 12:58:20 2015
(r291647)
+++ head/sys/dev/ofw/ofw_bus_subr.h Wed Dec  2 14:21:16 2015
(r291648)
@@ -82,7 +82,7 @@ const char *ofw_bus_get_status(device_t 
 int ofw_bus_status_okay(device_t dev);
 
 /* Helper to get node's interrupt parent */
-void   ofw_bus_find_iparent(phandle_t);
+phandle_t ofw_bus_find_iparent(phandle_t);
 
 /* Helper routine for checking compat prop */
 int ofw_bus_is_compatible(device_t, const char *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291649 - head/sys/arm/arm

2015-12-02 Thread Michal Meloun
Author: mmel
Date: Wed Dec  2 14:22:58 2015
New Revision: 291649
URL: https://svnweb.freebsd.org/changeset/base/291649

Log:
  ARM: Fix of detection of root interrupt controller.
  This fixes detection of root interrupt controller for cases,
  when interrupt parent is not defined at all or it's not defined directly
  in controller node.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/arm/arm/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Wed Dec  2 14:21:16 2015(r291648)
+++ head/sys/arm/arm/gic.c  Wed Dec  2 14:22:58 2015(r291649)
@@ -461,9 +461,13 @@ arm_gic_attach(device_t dev)
goto cleanup;
}
 
-   i = OF_getencprop(ofw_bus_get_node(dev), "interrupt-parent",
-   &pxref, sizeof(pxref));
-   if (i > 0 && xref == pxref) {
+   /*
+* Controller is root if:
+* - doesn't have interrupt parent
+* - his interrupt parent is this controller
+*/
+   pxref = ofw_bus_find_iparent(ofw_bus_get_node(dev));
+   if (pxref == 0 || xref == pxref) {
if (arm_pic_claim_root(dev, xref, arm_gic_intr, sc,
GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) {
device_printf(dev, "could not set PIC as a root\n");
@@ -471,6 +475,12 @@ arm_gic_attach(device_t dev)
goto cleanup;
}
} else {
+   if (sc->gic_res[2] == NULL) {
+   device_printf(dev,
+   "not root PIC must have defined interrupt\n");
+   arm_pic_unregister(dev, xref);
+   goto cleanup;
+   }
if (bus_setup_intr(dev, sc->gic_res[2], INTR_TYPE_CLK,
arm_gic_intr, NULL, sc, &sc->gic_intrhand)) {
device_printf(dev, "could not setup irq handler\n");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291650 - head/sys/arm/include

2015-12-02 Thread Michal Meloun
Author: mmel
Date: Wed Dec  2 14:24:14 2015
New Revision: 291650
URL: https://svnweb.freebsd.org/changeset/base/291650

Log:
  ARM: Define PCI_RES_BUS resource for platforms having NEW_PCIB enabled.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/arm/include/resource.h

Modified: head/sys/arm/include/resource.h
==
--- head/sys/arm/include/resource.h Wed Dec  2 14:22:58 2015
(r291649)
+++ head/sys/arm/include/resource.h Wed Dec  2 14:24:14 2015
(r291650)
@@ -42,5 +42,8 @@
 #defineSYS_RES_MEMORY  3   /* i/o memory */
 #defineSYS_RES_IOPORT  4   /* i/o ports */
 #defineSYS_RES_GPIO5   /* general purpose i/o */
+#ifdef NEW_PCIB
+#define PCI_RES_BUS6   /* PCI bus numbers */
+#endif
 
 #endif /* !_MACHINE_RESOURCE_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291651 - head/sys/netinet

2015-12-02 Thread Michael Tuexen
Author: tuexen
Date: Wed Dec  2 16:29:36 2015
New Revision: 291651
URL: https://svnweb.freebsd.org/changeset/base/291651

Log:
  Adjust the MTU when accepting an SCTP association using
  UDP encapsulation.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Wed Dec  2 14:24:14 2015
(r291650)
+++ head/sys/netinet/sctp_input.c   Wed Dec  2 16:29:36 2015
(r291651)
@@ -521,7 +521,6 @@ sctp_process_init_ack(struct mbuf *m, in
/* calculate the RTO */
net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, 
sctp_align_safe_nocopy,
SCTP_RTT_FROM_NON_DATA);
-
retval = sctp_send_cookie_echo(m, offset, stcb, net);
if (retval < 0) {
/*
@@ -2347,12 +2346,17 @@ sctp_process_cookie_new(struct mbuf *m, 
sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL);
}
(void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
-   if ((netp) && (*netp)) {
+   if ((netp != NULL) && (*netp != NULL)) {
/* calculate the RTT and set the encaps port */
(*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
&cookie->time_entered, sctp_align_unsafe_makecopy,
SCTP_RTT_FROM_NON_DATA);
+#if defined(INET) || defined(INET6)
+   if (((*netp)->port == 0) && (port != 0)) {
+   sctp_pathmtu_adjustment(stcb, (*netp)->mtu - 
sizeof(struct udphdr));
+   }
(*netp)->port = port;
+#endif
}
/* respond with a COOKIE-ACK */
sctp_send_cookie_ack(stcb);
@@ -5845,7 +5849,7 @@ sctp_common_input_processing(struct mbuf
 */
inp = stcb->sctp_ep;
 #if defined(INET) || defined(INET6)
-   if ((net) && (port)) {
+   if ((net != NULL) && (port != 0)) {
if (net->port == 0) {
sctp_pathmtu_adjustment(stcb, net->mtu 
- sizeof(struct udphdr));
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291653 - in head: share/man/man9 sys/fs/devfs sys/sys

2015-12-02 Thread John Baldwin
Author: jhb
Date: Wed Dec  2 18:27:30 2015
New Revision: 291653
URL: https://svnweb.freebsd.org/changeset/base/291653

Log:
  The cdevpriv_dtr_t typedef was not able to be used in a function prototype
  like the various d_*_t typedefs since it declared a function pointer rather
  than a function.  Add a new d_priv_dtor_t typedef that declares the function
  and can be used as a function prototype.  The previous typedef wasn't
  useful outside of the cdevpriv implementation, so retire it.
  
  The name d_priv_dtor_t was chosen to be more consistent with cdev methods
  since it is commonly used in place of d_close_t even though it is not a
  direct pointer in struct cdevsw.
  
  Reviewed by:  kib, imp
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D4340

Modified:
  head/share/man/man9/devfs_set_cdevpriv.9
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/sys/conf.h

Modified: head/share/man/man9/devfs_set_cdevpriv.9
==
--- head/share/man/man9/devfs_set_cdevpriv.9Wed Dec  2 17:26:37 2015
(r291652)
+++ head/share/man/man9/devfs_set_cdevpriv.9Wed Dec  2 18:27:30 2015
(r291653)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 20, 2015
+.Dd December 2, 2015
 .Dt DEVFS_CDEVPRIV 9
 .Os
 .Sh NAME
@@ -36,12 +36,12 @@
 .In sys/param.h
 .In sys/conf.h
 .Bd -literal
-typedefvoid (*cdevpriv_dtr_t)(void *data);
+typedefvoid d_priv_dtor_t(void *data);
 .Ed
 .Ft int
 .Fn devfs_get_cdevpriv "void **datap"
 .Ft int
-.Fn devfs_set_cdevpriv "void *priv" "cdevpriv_dtr_t dtr"
+.Fn devfs_set_cdevpriv "void *priv" "d_priv_dtor_t *dtr"
 .Ft void
 .Fn devfs_clear_cdevpriv "void"
 .Sh DESCRIPTION

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Wed Dec  2 17:26:37 2015
(r291652)
+++ head/sys/fs/devfs/devfs_vnops.c Wed Dec  2 18:27:30 2015
(r291653)
@@ -151,7 +151,7 @@ devfs_get_cdevpriv(void **datap)
 }
 
 int
-devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t priv_dtr)
+devfs_set_cdevpriv(void *priv, d_priv_dtor_t *priv_dtr)
 {
struct file *fp;
struct cdev_priv *cdp;

Modified: head/sys/sys/conf.h
==
--- head/sys/sys/conf.h Wed Dec  2 17:26:37 2015(r291652)
+++ head/sys/sys/conf.h Wed Dec  2 18:27:30 2015(r291653)
@@ -277,9 +277,9 @@ voidsetconf(void);
 
 #definedev2unit(d) ((d)->si_drv0)
 
-typedefvoid (*cdevpriv_dtr_t)(void *data);
+typedef void d_priv_dtor_t(void *data);
 intdevfs_get_cdevpriv(void **datap);
-intdevfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);
+intdevfs_set_cdevpriv(void *priv, d_priv_dtor_t *dtr);
 void   devfs_clear_cdevpriv(void);
 void   devfs_fpdrop(struct file *fp);  /* XXX This is not public KPI */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291654 - head/sys/dev/isp

2015-12-02 Thread Alexander Motin
Author: mav
Date: Wed Dec  2 20:22:50 2015
New Revision: 291654
URL: https://svnweb.freebsd.org/changeset/base/291654

Log:
  Add initial support for 16Gbps FC QLogic chips.
  
  I still don't know how to read NVRAM there, so WWNs and other parameters
  are incorrect, but other then that driver seems like attaching normally.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/ispmbox.h
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Wed Dec  2 18:27:30 2015(r291653)
+++ head/sys/dev/isp/isp.c  Wed Dec  2 20:22:50 2015(r291654)
@@ -277,6 +277,9 @@ isp_reset(ispsoftc_t *isp, int do_load_d
case ISP_HA_FC_2500:
btype = "2532";
break;
+   case ISP_HA_FC_2600:
+   btype = "2031";
+   break;
default:
break;
}
@@ -761,6 +764,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
code_org = ISP_CODE_ORG;
}
 
+   isp->isp_loaded_fw = 0;
if (dodnld && IS_24XX(isp)) {
const uint32_t *ptr = isp->isp_mdvec->dv_ispfw;
int wordload;
@@ -956,8 +960,17 @@ isp_reset(ispsoftc_t *isp, int do_load_d
ISP_RESET0(isp);
return;
}
+   } else if (IS_26XX(isp)) {
+   MBSINIT(&mbs, MBOX_LOAD_FLASH_FIRMWARE, MBLOGALL, 500);
+   mbs.ibitm = 0x01;
+   mbs.obitm = 0x07;
+   isp_mboxcmd(isp, &mbs);
+   if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+   isp_prt(isp, ISP_LOGERR, "Flash F/W load failed");
+   ISP_RESET0(isp);
+   return;
+   }
} else {
-   isp->isp_loaded_fw = 0;
isp_prt(isp, ISP_LOGDEBUG2, "skipping f/w download");
}
 
@@ -966,7 +979,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 */
if (isp->isp_loaded_fw) {
MBSINIT(&mbs, MBOX_VERIFY_CHECKSUM, MBLOGNONE, 0);
-   mbs.param[0] = MBOX_VERIFY_CHECKSUM;
if (IS_24XX(isp)) {
mbs.param[1] = code_org >> 16;
mbs.param[2] = code_org;
@@ -998,9 +1010,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d
} else {
mbs.param[3] = 1;
}
-   if (IS_25XX(isp)) {
-   mbs.ibits |= 0x10;
-   }
} else if (IS_2322(isp)) {
mbs.param[1] = code_org;
if (isp->isp_loaded_fw) {
@@ -1861,16 +1870,16 @@ isp_fibre_init(ispsoftc_t *isp)
icbp->icb_idelaytimer = 10;
}
icbp->icb_zfwoptions = fcp->isp_zfwoptions;
-   if (isp->isp_confopts & ISP_CFG_ONEGB) {
+   if (isp->isp_confopts & ISP_CFG_1GB) {
icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
-   icbp->icb_zfwoptions |= ICBZOPT_RATE_ONEGB;
-   } else if (isp->isp_confopts & ISP_CFG_TWOGB) {
+   icbp->icb_zfwoptions |= ICBZOPT_RATE_1GB;
+   } else if (isp->isp_confopts & ISP_CFG_2GB) {
icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
-   icbp->icb_zfwoptions |= ICBZOPT_RATE_TWOGB;
+   icbp->icb_zfwoptions |= ICBZOPT_RATE_2GB;
} else {
switch (icbp->icb_zfwoptions & 
ICBZOPT_RATE_MASK) {
-   case ICBZOPT_RATE_ONEGB:
-   case ICBZOPT_RATE_TWOGB:
+   case ICBZOPT_RATE_1GB:
+   case ICBZOPT_RATE_2GB:
case ICBZOPT_RATE_AUTO:
break;
default:
@@ -2126,14 +2135,16 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24;
}
icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_AUTO;
-   if (isp->isp_confopts & ISP_CFG_ONEGB) {
-   icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_ONEGB;
-   } else if (isp->isp_confopts & ISP_CFG_TWOGB) {
-   icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_TWOGB;
-   } else if (isp->isp_confopts & ISP_CFG_FOURGB) {
-   icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_FOURGB;
-   } else if (IS_25XX(isp) && (isp->isp_confopts & ISP_CFG_EIGHTGB)) {
-   icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_EIGHTGB;
+   if (isp->isp_confopts & ISP_CFG_1GB) {
+   icbp->icb_fwoptions3

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

2015-12-02 Thread Mateusz Guzik
On Mon, Nov 30, 2015 at 09:24:12AM +, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Mon Nov 30 09:24:12 2015
> New Revision: 291481
> URL: https://svnweb.freebsd.org/changeset/base/291481
> 
> Log:
>   Add more functions and types to the LinuxKPI.
>   
>   MFC after:  1 week
>   Sponsored by:   Mellanox Technologies
> 
> Modified:
>   head/sys/compat/linuxkpi/common/include/linux/file.h
>   head/sys/compat/linuxkpi/common/include/linux/workqueue.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/linux/file.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/file.h  Mon Nov 30 
> 09:13:04 2015(r291480)
> +++ head/sys/compat/linuxkpi/common/include/linux/file.h  Mon Nov 30 
> 09:24:12 2015(r291481)
> @@ -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
> @@ -125,6 +125,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, &file, &fd, flags);
> + if (error)
> + return -error;
> + /* drop the extra reference */
> + fdrop(file, curthread);
> + return fd;
> +}
> +

This does not look right.

AFAIR Linux drivers are not going to install fds into kernel threads. So
this would be used for a userspace thread, but then it would completely
insecure.

Linux model is to reserve a slot in the fd table, obtain a 'file' object
and install it as the last step.

FreeBSD installs the file right away, but this means an extra reference
has to be held in case something else using the table closes the fd.

As such, this fdrop can lead to a use-after-free as the file can be
freed from this poin.

I'm afraid there is no way around patching improted consumers.

-- 
Mateusz Guzik 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2015-12-02 Thread Hans Petter Selasky

On 12/02/15 21:29, Mateusz Guzik wrote:

On Mon, Nov 30, 2015 at 09:24:12AM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Mon Nov 30 09:24:12 2015
New Revision: 291481
URL: https://svnweb.freebsd.org/changeset/base/291481

Log:
   Add more functions and types to the LinuxKPI.

   MFC after:   1 week
   Sponsored by:Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/file.h
==
--- head/sys/compat/linuxkpi/common/include/linux/file.hMon Nov 30 
09:13:04 2015(r291480)
+++ head/sys/compat/linuxkpi/common/include/linux/file.hMon Nov 30 
09:24:12 2015(r291481)
@@ -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
@@ -125,6 +125,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, &file, &fd, flags);
+   if (error)
+   return -error;
+   /* drop the extra reference */
+   fdrop(file, curthread);
+   return fd;
+}
+


This does not look right.

AFAIR Linux drivers are not going to install fds into kernel threads. So
this would be used for a userspace thread, but then it would completely
insecure.

Linux model is to reserve a slot in the fd table, obtain a 'file' object
and install it as the last step.

FreeBSD installs the file right away, but this means an extra reference
has to be held in case something else using the table closes the fd.

As such, this fdrop can lead to a use-after-free as the file can be
freed from this poin.

I'm afraid there is no way around patching improted consumers.



Hi Mateusz,

Thanks for your input. Yes, there is a potential race there, but no 
use-after-free from what I can see, because the LinuxKPI always retrieve 
the file pointer by the file number using "fget_unlocked()".


I'll look into if we can delay the fdrop() until after the fd_install().

--HPS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2015-12-02 Thread Mateusz Guzik
On Wed, Dec 02, 2015 at 09:47:43PM +0100, Hans Petter Selasky wrote:
> On 12/02/15 21:29, Mateusz Guzik wrote:
> >On Mon, Nov 30, 2015 at 09:24:12AM +, Hans Petter Selasky wrote:
> >>Author: hselasky
> >>Date: Mon Nov 30 09:24:12 2015
> >>New Revision: 291481
> >>URL: https://svnweb.freebsd.org/changeset/base/291481
> >>
> >>Log:
> >>   Add more functions and types to the LinuxKPI.
> >>
> >>   MFC after:   1 week
> >>   Sponsored by:Mellanox Technologies
> >>
> >>Modified:
> >>   head/sys/compat/linuxkpi/common/include/linux/file.h
> >>   head/sys/compat/linuxkpi/common/include/linux/workqueue.h
> >>
> >>Modified: head/sys/compat/linuxkpi/common/include/linux/file.h
> >>==
> >>--- head/sys/compat/linuxkpi/common/include/linux/file.hMon Nov 30 
> >>09:13:04 2015(r291480)
> >>+++ head/sys/compat/linuxkpi/common/include/linux/file.hMon Nov 30 
> >>09:24:12 2015(r291481)
> >>@@ -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
> >>@@ -125,6 +125,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, &file, &fd, flags);
> >>+   if (error)
> >>+   return -error;
> >>+   /* drop the extra reference */
> >>+   fdrop(file, curthread);
> >>+   return fd;
> >>+}
> >>+
> >
> >This does not look right.
> >
> >AFAIR Linux drivers are not going to install fds into kernel threads. So
> >this would be used for a userspace thread, but then it would completely
> >insecure.
> >
> >Linux model is to reserve a slot in the fd table, obtain a 'file' object
> >and install it as the last step.
> >
> >FreeBSD installs the file right away, but this means an extra reference
> >has to be held in case something else using the table closes the fd.
> >
> >As such, this fdrop can lead to a use-after-free as the file can be
> >freed from this poin.
> >
> >I'm afraid there is no way around patching improted consumers.
> >
> 
> Hi Mateusz,
> 
> Thanks for your input. Yes, there is a potential race there, but no
> use-after-free from what I can see, because the LinuxKPI always
> retrieve the file pointer by the file number using "fget_unlocked()".
> 
> I'll look into if we can delay the fdrop() until after the fd_install().
> 

I grepped an example consumer:

> ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file,
>   struct ib_device *ib_dev,
>   const char __user *buf, int in_len,
>   int out_len)
> {   
> struct ib_uverbs_create_comp_channel   cmd;
> struct ib_uverbs_create_comp_channel_resp  resp;
> struct file   *filp;
> int ret;
> 
> if (out_len < sizeof resp)
> return -ENOSPC;
> 
> if (copy_from_user(&cmd, buf, sizeof cmd))
> return -EFAULT;
> 
> ret = get_unused_fd_flags(O_CLOEXEC);
> if (ret < 0)
> return ret;
> resp.fd = ret;
> 

So this is supposed to get the slot.

> filp = ib_uverbs_alloc_event_file(file, ib_dev, 0);

file object is allocated separately.

> if (IS_ERR(filp)) {
> put_unused_fd(resp.fd);
> return PTR_ERR(filp);
> }
> 
> if (copy_to_user((void __user *) (unsigned long) cmd.response,
>  &resp, sizeof resp)) {
> put_unused_fd(resp.fd);
> fput(filp);
> return -EFAULT;
> }
> 
> fd_install(resp.fd, filp);

And here is the install.

> return in_len;
> }   

If you drop, and have some magic to grab the file obtained from
get_unused_fd_flags, the file object is unsafe to use.

In general, I don't see how you can get around having to edit such
functions. If they get edited, you can just use the FreeBSD scheme.

Fortunately as far as error handling goes, it behaves the same way.

-- 
Mateusz Guzik 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2015-12-02 Thread Hans Petter Selasky

On 12/02/15 21:54, Mateusz Guzik wrote:

On Wed, Dec 02, 2015 at 09:47:43PM +0100, Hans Petter Selasky wrote:

On 12/02/15 21:29, Mateusz Guzik wrote:

On Mon, Nov 30, 2015 at 09:24:12AM +, Hans Petter Selasky wrote:

Author: hselasky
Date: Mon Nov 30 09:24:12 2015
New Revision: 291481
URL: https://svnweb.freebsd.org/changeset/base/291481

Log:
   Add more functions and types to the LinuxKPI.

   MFC after:   1 week
   Sponsored by:Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/file.h
==
--- head/sys/compat/linuxkpi/common/include/linux/file.hMon Nov 30 
09:13:04 2015(r291480)
+++ head/sys/compat/linuxkpi/common/include/linux/file.hMon Nov 30 
09:24:12 2015(r291481)
@@ -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
@@ -125,6 +125,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, &file, &fd, flags);
+   if (error)
+   return -error;
+   /* drop the extra reference */
+   fdrop(file, curthread);
+   return fd;
+}
+


This does not look right.

AFAIR Linux drivers are not going to install fds into kernel threads. So
this would be used for a userspace thread, but then it would completely
insecure.

Linux model is to reserve a slot in the fd table, obtain a 'file' object
and install it as the last step.

FreeBSD installs the file right away, but this means an extra reference
has to be held in case something else using the table closes the fd.

As such, this fdrop can lead to a use-after-free as the file can be
freed from this poin.

I'm afraid there is no way around patching improted consumers.



Hi Mateusz,

Thanks for your input. Yes, there is a potential race there, but no
use-after-free from what I can see, because the LinuxKPI always
retrieve the file pointer by the file number using "fget_unlocked()".

I'll look into if we can delay the fdrop() until after the fd_install().



I grepped an example consumer:


ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file,
   struct ib_device *ib_dev,
   const char __user *buf, int in_len,
   int out_len)
{
 struct ib_uverbs_create_comp_channel   cmd;
 struct ib_uverbs_create_comp_channel_resp  resp;
 struct file   *filp;
 int ret;

 if (out_len < sizeof resp)
 return -ENOSPC;

 if (copy_from_user(&cmd, buf, sizeof cmd))
 return -EFAULT;

 ret = get_unused_fd_flags(O_CLOEXEC);
 if (ret < 0)
 return ret;
 resp.fd = ret;



So this is supposed to get the slot.


 filp = ib_uverbs_alloc_event_file(file, ib_dev, 0);


file object is allocated separately.


 if (IS_ERR(filp)) {
 put_unused_fd(resp.fd);
 return PTR_ERR(filp);
 }

 if (copy_to_user((void __user *) (unsigned long) cmd.response,
  &resp, sizeof resp)) {
 put_unused_fd(resp.fd);
 fput(filp);
 return -EFAULT;
 }

 fd_install(resp.fd, filp);


And here is the install.


 return in_len;
}


If you drop, and have some magic to grab the file obtained from
get_unused_fd_flags, the file object is unsafe to use.

In general, I don't see how you can get around having to edit such
functions. If they get edited, you can just use the FreeBSD scheme.

Fortunately as far as error handling goes, it behaves the same way.



Hi,

I've made a patch here:

https://reviews.freebsd.org/D4351

Does it make sense?

--HPS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291657 - in head/usr.sbin/pw: . tests

2015-12-02 Thread Baptiste Daroussin
Author: bapt
Date: Wed Dec  2 22:01:37 2015
New Revision: 291657
URL: https://svnweb.freebsd.org/changeset/base/291657

Log:
  Fix handling of numeric-only names with pw lock
  Add a regression test about it
  
  PR:   204968
  MFC after:1 week

Modified:
  head/usr.sbin/pw/pw_user.c
  head/usr.sbin/pw/tests/pw_lock.sh

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Wed Dec  2 21:56:01 2015(r291656)
+++ head/usr.sbin/pw/pw_user.c  Wed Dec  2 22:01:37 2015(r291657)
@@ -274,7 +274,7 @@ pw_userlock(char *arg1, int mode)
char *passtmp = NULL;
char *name;
bool locked = false;
-   uid_t id;
+   uid_t id = (uid_t)-1;
 
if (geteuid() != 0)
errx(EX_NOPERM, "you must be root");
@@ -282,16 +282,19 @@ pw_userlock(char *arg1, int mode)
if (arg1 == NULL)
errx(EX_DATAERR, "username or id required");
 
-   if (arg1[strspn(arg1, "0123456789")] == '\0') {
-   id = pw_checkid(arg1, UID_MAX);
-   name = NULL;
-   } else
-   name = arg1;
-
-   pwd = (name != NULL) ? GETPWNAM(pw_checkname(name, 0)) : GETPWUID(id);
+   name = arg1;
+   if (arg1[strspn(name, "0123456789")] == '\0')
+   id = pw_checkid(name, UID_MAX);
+
+   pwd = GETPWNAM(pw_checkname(name, 0));
+   if (pwd == NULL && id != (uid_t)-1) {
+   pwd = GETPWUID(id);
+   if (pwd != NULL)
+   name = pwd->pw_name;
+   }
if (pwd == NULL) {
-   if (name == NULL)
-   errx(EX_NOUSER, "no such uid `%ju'", (uintmax_t) id);
+   if (id == (uid_t)-1)
+   errx(EX_NOUSER, "no such name or uid `%ju'", 
(uintmax_t) id);
errx(EX_NOUSER, "no such user `%s'", name);
}
 

Modified: head/usr.sbin/pw/tests/pw_lock.sh
==
--- head/usr.sbin/pw/tests/pw_lock.sh   Wed Dec  2 21:56:01 2015
(r291656)
+++ head/usr.sbin/pw/tests/pw_lock.sh   Wed Dec  2 22:01:37 2015
(r291657)
@@ -16,7 +16,27 @@ user_locking_body() {
grep "^test:\*:1001:" $HOME/master.passwd
 }
 
+atf_test_case numeric_locking cleanup
+numeric_locking_body() {
+   populate_etc_skel
+   ${PW} useradd test || atf_fail "Creating test user"
+   ${PW} lock 1001 || atf_fail "Locking the user"
+   atf_check -s exit:0 -o match:"^test:\*LOCKED\*\*:1001:" \
+   grep "^test:\*LOCKED\*\*:1001:" $HOME/master.passwd
+   ${PW} unlock 1001 || atf_fail "Unlocking the user"
+   atf_check -s exit:0 -o match:"^test:\*:1001:" \
+   grep "^test:\*:1001:" $HOME/master.passwd
+   # Now numeric names
+   ${PW} useradd -n 1001 || atf_fail "Creating test user"
+   ${PW} lock 1001 || atf_fail "Locking the user"
+   atf_check -s exit:0 -o match:"^1001:\*LOCKED\*\*:1002:" \
+   grep "^1001:\*LOCKED\*\*:1002:" $HOME/master.passwd
+   ${PW} unlock 1001 || atf_fail "Unlocking the user"
+   atf_check -s exit:0 -o match:"^1001:\*:1002:" \
+   grep "^1001:\*:1002:" $HOME/master.passwd
+}
 
 atf_init_test_cases() {
atf_add_test_case user_locking
+   atf_add_test_case numeric_locking
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291658 - head/usr.sbin/pw

2015-12-02 Thread Baptiste Daroussin
Author: bapt
Date: Wed Dec  2 22:35:25 2015
New Revision: 291658
URL: https://svnweb.freebsd.org/changeset/base/291658

Log:
  pw_checkname since the beginning if too strict on GECOS field,
  relax it a bit so gecos can be used to store multibytes data.
  
  This was unseen before FreeBSD 10.2 as this validation function was motly 
unused
  since FreeBSD 10.2 the usage of this function has been generalized to improve
  validation.
  
  Reported by:  des
  MFC after:1 week

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Wed Dec  2 22:01:37 2015(r291657)
+++ head/usr.sbin/pw/pw_user.c  Wed Dec  2 22:35:25 2015(r291658)
@@ -642,7 +642,8 @@ pw_checkname(char *name, int gecos)
}
if (!reject) {
while (*ch) {
-   if (strchr(badchars, *ch) != NULL || *ch < ' ' ||
+   if (strchr(badchars, *ch) != NULL ||
+   (!gecos && *ch < ' ') ||
*ch == 127) {
reject = 1;
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291659 - head/sys/netinet

2015-12-02 Thread Michael Tuexen
Author: tuexen
Date: Wed Dec  2 22:44:42 2015
New Revision: 291659
URL: https://svnweb.freebsd.org/changeset/base/291659

Log:
  Minor cleanup. No functional change.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed Dec  2 22:35:25 2015
(r291658)
+++ head/sys/netinet/sctp_output.c  Wed Dec  2 22:44:42 2015
(r291659)
@@ -12053,7 +12053,7 @@ sctp_send_str_reset_req(struct sctp_tcb 
oldstream = stcb->asoc.strmout;
/* get some more */
SCTP_MALLOC(stcb->asoc.strmout, struct sctp_stream_out *,
-   ((stcb->asoc.streamoutcnt + adding_o) * sizeof(struct 
sctp_stream_out)),
+   (stcb->asoc.streamoutcnt + adding_o) * sizeof(struct 
sctp_stream_out),
SCTP_M_STRMO);
if (stcb->asoc.strmout == NULL) {
uint8_t x;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291665 - in head: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys/dev/cxgbe/tom

2015-12-02 Thread John Baldwin
Author: jhb
Date: Thu Dec  3 00:02:01 2015
New Revision: 291665
URL: https://svnweb.freebsd.org/changeset/base/291665

Log:
  Add support for configuring additional virtual interfaces (VIs) on a port.
  
  Each virtual interface has its own MAC address, queues, and statistics.
  The dedicated netmap interfaces (ncxgbeX / ncxlX) were already implemented
  as additional VIs on each port.  This change allows additional non-netmap
  interfaces to be configured on each port.  Additional virtual interfaces
  use the naming scheme vcxgbeX or vcxlX.
  
  Additional VIs are enabled by setting the hw.cxgbe.num_vis tunable to a
  value greater than 1 before loading the cxgbe(4) or cxl(4) driver.
  NB: The first VI on each port is the "main" interface (cxgbeX or cxlX).
  
  T4/T5 NICs provide a limited number of MAC addresses for each physical port.
  As a result, a maximum of six VIs can be configured on each port (including
  the "main" interface and the netmap interface when netmap is enabled).
  
  One user-visible result is that when netmap is enabled, packets received
  or transmitted via the netmap interface are no longer counted in the stats
  for the "main" interface, but are not accounted to the netmap interface.
  
  The netmap interfaces now also have a new-bus device and export various
  information sysctl nodes via dev.n(cxgbe|cxl).X.
  
  The cxgbetool 'clearstats' command clears the stats for all VIs on the
  specified port along with the port's stats.  There is currently no way to
  clear the stats of an individual VI.
  
  Reviewed by:  np
  MFC after:1 month
  Sponsored by: Chelsio

Modified:
  head/share/man/man4/cxgbe.4
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/iw_cxgbe/provider.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_netmap.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/share/man/man4/cxgbe.4
==
--- head/share/man/man4/cxgbe.4 Wed Dec  2 23:54:59 2015(r291664)
+++ head/share/man/man4/cxgbe.4 Thu Dec  3 00:02:01 2015(r291665)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 20, 2014
+.Dd December 2, 2015
 .Dt CXGBE 4
 .Os
 .Sh NAME
@@ -170,6 +170,16 @@ number of CPU cores in the system, which
 .It Va hw.cxgbe.nofldrxq1g
 The number of TOE rx queues to use for a 1Gb port.
 The default is 1.
+.It Va hw.cxgbe.num_vis
+The number of virtual interfaces (VIs) created for each port.
+Each virtual interface creates a separate network interface.
+The first virtual interface on each port is required and represents
+the primary network interface on the port.
+Additional virtual interfaces on a port are named vcxgbe (T4) or
+vcxl (T5) and only use a single rx and tx queue.
+Additional virtual interfaces use a single pair of queues
+for rx and tx as well an additional pair of queues for TOE rx and tx.
+The default is 1.
 .It Va hw.cxgbe.holdoff_timer_idx_10G
 .It Va hw.cxgbe.holdoff_timer_idx_1G
 The timer index value to use to delay interrupts.

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hWed Dec  2 23:54:59 2015
(r291664)
+++ head/sys/dev/cxgbe/adapter.hThu Dec  3 00:02:01 2015
(r291665)
@@ -198,34 +198,34 @@ enum {
CXGBE_BUSY  = (1 << 9),
 
/* port flags */
-   DOOMED  = (1 << 0),
-   PORT_INIT_DONE  = (1 << 1),
-   PORT_SYSCTL_CTX = (1 << 2),
HAS_TRACEQ  = (1 << 3),
+
+   /* VI flags */
+   DOOMED  = (1 << 0),
+   VI_INIT_DONE= (1 << 1),
+   VI_SYSCTL_CTX   = (1 << 2),
INTR_RXQ= (1 << 4), /* All NIC rxq's take interrupts */
INTR_OFLD_RXQ   = (1 << 5), /* All TOE rxq's take interrupts */
-   INTR_NM_RXQ = (1 << 6), /* All netmap rxq's take interrupts */
-   INTR_ALL= (INTR_RXQ | INTR_OFLD_RXQ | INTR_NM_RXQ),
+   INTR_ALL= (INTR_RXQ | INTR_OFLD_RXQ),
+   VI_NETMAP   = (1 << 6),
 
/* adapter debug_flags */
DF_DUMP_MBOX= (1 << 0),
 };
 
-#define IS_DOOMED(pi)  ((pi)->flags & DOOMED)
-#define SET_DOOMED(pi) do {(pi)->flags |= DOOMED;} while (0)
+#define IS_DOOMED(vi)  ((vi)->flags & DOOMED)
+#define SET_DOOMED(vi) do {(vi)->flags |= DOOMED;} while (0)
 #define IS_BUSY(sc)((sc)->flags & CXGBE_BUSY)
 #define SET_BUSY(sc)   do {(sc)->flags |= CXGBE_BUSY;} while (0)
 #define CLR_BUSY(sc)   do {(sc)->flags &= ~CXGBE_BUSY;} while (0)
 
-struct port_info {
+struct vi_info {
device_t dev;
-   struct adapter *adapter;
+   struct port_info *pi;
 
struct ifnet *ifp;
struct ifmedia media;
 
-   struct mtx pi_lock;
-   char lockname[1

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

2015-12-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Dec  3 00:06:59 2015
New Revision: 291666
URL: https://svnweb.freebsd.org/changeset/base/291666

Log:
  Fix build on GCC 5.2 where, at least on PPC64, the compiler would "optimize"
  the malloc() + memset() in the local implementation of calloc() into a call
  to calloc(), helpfully turning it into an infinite loop. Clean up some
  unneeded flags on PPC64 while here.
  
  MFC after:1 month

Modified:
  head/libexec/rtld-elf/Makefile

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Thu Dec  3 00:02:01 2015
(r291665)
+++ head/libexec/rtld-elf/Makefile  Thu Dec  3 00:06:59 2015
(r291666)
@@ -13,7 +13,7 @@ SRCS= rtld_start.S \
malloc.c xmalloc.c debug.c libmap.c
 MAN=   rtld.1
 CSTD?= gnu99
-CFLAGS+=   -Wall -DFREEBSD_ELF -DIN_RTLD
+CFLAGS+=   -Wall -DFREEBSD_ELF -DIN_RTLD -fno-builtin
 CFLAGS+=   -I${SRCTOP}/lib/csu/common
 .if exists(${.CURDIR}/${MACHINE_ARCH})
 RTLD_ARCH= ${MACHINE_ARCH}
@@ -22,7 +22,6 @@ RTLD_ARCH=${MACHINE_CPUARCH}
 .endif
 CFLAGS+=   -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
 .if ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+=   -mcall-aixdesc
 LDFLAGS+=  -nostdlib -e _rtld_start
 .else
 LDFLAGS+=  -nostdlib -e .rtld_start
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291667 - in head/sys/boot/powerpc: . boot1.chrp

2015-12-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Dec  3 00:08:50 2015
New Revision: 291667
URL: https://svnweb.freebsd.org/changeset/base/291667

Log:
  Clean up PowerPC bootloader compiler flags to fix the build with GCC 5.2
  and binutils 2.25.

Modified:
  head/sys/boot/powerpc/Makefile.inc
  head/sys/boot/powerpc/boot1.chrp/Makefile

Modified: head/sys/boot/powerpc/Makefile.inc
==
--- head/sys/boot/powerpc/Makefile.inc  Thu Dec  3 00:06:59 2015
(r291666)
+++ head/sys/boot/powerpc/Makefile.inc  Thu Dec  3 00:08:50 2015
(r291667)
@@ -2,7 +2,6 @@
 
 .if ${MACHINE_ARCH} == "powerpc64"
 CFLAGS+=   -m32 -mcpu=powerpc
-LDFLAGS+=  -m elf32ppc_fbsd
 .endif
 
 .include "../Makefile.inc"

Modified: head/sys/boot/powerpc/boot1.chrp/Makefile
==
--- head/sys/boot/powerpc/boot1.chrp/Makefile   Thu Dec  3 00:06:59 2015
(r291666)
+++ head/sys/boot/powerpc/boot1.chrp/Makefile   Thu Dec  3 00:08:50 2015
(r291667)
@@ -12,7 +12,7 @@ SRCS= boot1.c ashldi3.c syncicache.c
 
 MAN=
 
-CFLAGS= -ffreestanding -msoft-float -Os \
+CFLAGS= -ffreestanding -msoft-float \
-I${.CURDIR}/../../common -I${.CURDIR}/../../../ \
-D_STANDALONE
 LDFLAGS=-nostdlib -static -Wl,-N
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291668 - in head: lib/csu/powerpc64 libexec/rtld-elf libexec/rtld-elf/powerpc64 sys/powerpc/include sys/powerpc/powerpc

2015-12-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Dec  3 00:10:57 2015
New Revision: 291668
URL: https://svnweb.freebsd.org/changeset/base/291668

Log:
  Provide support for ELFv2 userland if using a newer compiler (recent clang
  or gcc) and binutils >= 2.24. Not enabled by default.

Modified:
  head/lib/csu/powerpc64/crti.S
  head/libexec/rtld-elf/powerpc64/reloc.c
  head/libexec/rtld-elf/powerpc64/rtld_start.S
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h
  head/sys/powerpc/include/asm.h
  head/sys/powerpc/powerpc/sigcode64.S

Modified: head/lib/csu/powerpc64/crti.S
==
--- head/lib/csu/powerpc64/crti.S   Thu Dec  3 00:08:50 2015
(r291667)
+++ head/lib/csu/powerpc64/crti.S   Thu Dec  3 00:10:57 2015
(r291668)
@@ -26,34 +26,59 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#ifdef _CALL_ELF
+.abiversion _CALL_ELF
+#endif
+
.section .init,"ax",@progbits
-   .align  2
+   .p2align2
.globl  _init
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
.section ".opd","aw"
-   .align  3
+   .p2align3
 _init:
.quad   .L._init,.TOC.@tocbase,0
.previous
.type   _init,@function
 
-   .align 4
+   .p2align 4
 .L._init:
+#else
+   .p2align 4
+   .globl  _init
+   .type   _init,@function
+_init:
+   addis   %r2, %r12, (.TOC.-_init)@ha
+   addi%r2, %r2, (.TOC.-_init)@l
+   .localentry _init, .-_init
+#endif
stdu 1,-48(1)
mflr 0
std 0,64(1)
 
+/* Fini */
.section .fini,"ax",@progbits
-   .align  2
+   .p2align2
.globl  _fini
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
.section ".opd","aw"
-   .align  3
+   .p2align3
 _fini:
.quad   .L._fini,.TOC.@tocbase,0
.previous
.type   _fini,@function
 
-   .align 4
+   .p2align 4
 .L._fini:
+#else
+   .p2align 4
+   .globl  _fini
+   .type   _fini,@function
+_fini:
+   addis   %r2, %r12, (.TOC.-_fini)@ha
+   addi%r2, %r2, (.TOC.-_fini)@l
+   .localentry _fini, .-_fini
+#endif
stdu 1,-48(1)
mflr 0
std 0,64(1)

Modified: head/libexec/rtld-elf/powerpc64/reloc.c
==
--- head/libexec/rtld-elf/powerpc64/reloc.c Thu Dec  3 00:08:50 2015
(r291667)
+++ head/libexec/rtld-elf/powerpc64/reloc.c Thu Dec  3 00:10:57 2015
(r291668)
@@ -43,11 +43,13 @@
 #include "debug.h"
 #include "rtld.h"
 
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
 struct funcdesc {
Elf_Addr addr;
Elf_Addr toc;
Elf_Addr env;
 };
+#endif
 
 /*
  * Process the R_PPC_COPY relocations
@@ -336,11 +338,14 @@ static int
 reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela)
 {
Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
Elf_Addr *glink;
+#endif
long reloff;
 
reloff = rela - obj->pltrela;
 
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
if (obj->priv == NULL)
obj->priv = xmalloc(obj->pltrelasize);
glink = obj->priv + reloff*sizeof(Elf_Addr)*2;
@@ -351,6 +356,10 @@ reloc_plt_object(Obj_Entry *obj, const E
((struct funcdesc *)(where))->env = (Elf_Addr)glink;
*(glink++) = (Elf_Addr)obj;
*(glink++) = reloff*sizeof(Elf_Rela);
+#else
+   dbg(" reloc_plt_object: where=%p,reloff=%lx,glink=%#lx", (void *)where, 
reloff, obj->glink);
+   *where = (Elf_Addr)obj->glink + 4*reloff + 32;
+#endif
 
return (0);
 }
@@ -416,7 +425,11 @@ reloc_jmpslots(Obj_Entry *obj, int flags
 
if (def == &sym_zero) {
/* Zero undefined weak symbols */
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
bzero(where, sizeof(struct funcdesc));
+#else
+   *where = 0;
+#endif
} else {
reloc_jmpslot(where, target, defobj, obj,
(const Elf_Rel *) rela);
@@ -436,9 +449,6 @@ Elf_Addr
 reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *defobj,
  const Obj_Entry *obj, const Elf_Rel *rel)
 {
-   dbg(" reloc_jmpslot: where=%p, target=%p (%#lx + %#lx)",
-   (void *)wherep, (void *)target, *(Elf_Addr *)target,
-   (Elf_Addr)defobj->relocbase);
 
/*
 * At the PLT entry pointed at by `wherep', construct
@@ -446,6 +456,11 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr
 * address.
 */
 
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
+   dbg(" reloc_jmpslot: where=%p, target=%p (%#lx + %#lx)",
+   (void *)wherep, (void *)target, *(Elf_Addr *)target,
+   (Elf_Addr)defobj->relocbase);
+
memcpy(wherep, (void *)target, sizeof(struct funcdesc));
if (((struct funcdesc *)(wherep))->addr < (Elf_Addr)defobj->relocbase

svn commit: r291671 - head/sys/kern

2015-12-02 Thread Kirk McKusick
Author: mckusick
Date: Thu Dec  3 02:04:22 2015
New Revision: 291671
URL: https://svnweb.freebsd.org/changeset/base/291671

Log:
  We need to zero out the union of pointers in a freed vnode structure.
  
  PR:204949
  Fix from:  Mateusz Guzik
  Tested by: Jason Unovitch

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cThu Dec  3 02:00:36 2015(r291670)
+++ head/sys/kern/vfs_subr.cThu Dec  3 02:04:22 2015(r291671)
@@ -2782,6 +2782,7 @@ _vdrop(struct vnode *vp, bool locked)
/* XXX Elsewhere we detect an already freed vnode via NULL v_op. */
vp->v_op = NULL;
 #endif
+   bzero(&vp->v_un, sizeof(vp->v_un));
vp->v_iflag = 0;
vp->v_vflag = 0;
bo->bo_flag = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291676 - head/sys/dev/mii

2015-12-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Dec  3 05:27:39 2015
New Revision: 291676
URL: https://svnweb.freebsd.org/changeset/base/291676

Log:
  Disable EEE(Energy Efficient Ethernet) for RTL8211F PHY.
  It seems the EEE made RX MAC enter LPI(Low Power Idle) mode such
  that dwc(4) was not able to receive packets.  Ideally dwc(4) should
  be able to use EEE to save power during periods of low link
  utilization(i.e. gating off clock).  Due to lack of dwc(4)
  datasheet it's not easy to take required steps for EEE on LPI
  enter/exit events.  Disabling EEE in PHY seems to be easy
  workaround until dwc(4) supports EEE.
  
  Updating EEE advertisement register on RTL8211F seems to have no
  effect until reprogramming MII_ANAR, MII_100T2CR and MII_BMCR
  with auto-negotiation. It's not clear whether it's related with
  mii_phy_reset()'s BMCR_ISO handling for RTL8211F though.
  It seems rgephy_reset() needs careful investigation for newer
  RealTek PHYs.
  
  Ganbold submitted working version based on NetBSD change and
  tested lots of changes I made. Thanks a lot!
  
  Submitted by: ganbold (initial version)
  In collaboration with:ganbold

Modified:
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rgephyreg.h

Modified: head/sys/dev/mii/rgephy.c
==
--- head/sys/dev/mii/rgephy.c   Thu Dec  3 04:35:44 2015(r291675)
+++ head/sys/dev/mii/rgephy.c   Thu Dec  3 05:27:39 2015(r291676)
@@ -90,6 +90,7 @@ static void   rgephy_reset(struct mii_soft
 static int rgephy_linkup(struct mii_softc *);
 static voidrgephy_loop(struct mii_softc *);
 static voidrgephy_load_dspcode(struct mii_softc *);
+static voidrgephy_disable_eee(struct mii_softc *);
 
 static const struct mii_phydesc rgephys[] = {
MII_PHY_DESC(REALTEK, RTL8169S),
@@ -517,10 +518,9 @@ rgephy_reset(struct mii_softc *sc)
switch (sc->mii_mpd_rev) {
case RGEPHY_8211F:
pcr = PHY_READ(sc, RGEPHY_F_MII_PCR1);
-   if ((pcr & RGEPHY_F_PCR1_MDI_MM) != 0) {
-   pcr &= ~RGEPHY_F_PCR1_MDI_MM;
-   PHY_WRITE(sc, RGEPHY_F_MII_PCR1, pcr);
-   }
+   pcr &= ~(RGEPHY_F_PCR1_MDI_MM | RGEPHY_F_PCR1_ALDPS_EN);
+   PHY_WRITE(sc, RGEPHY_F_MII_PCR1, pcr);
+   rgephy_disable_eee(sc);
break;
case RGEPHY_8211C:
if ((sc->mii_flags & MIIF_PHYPRIV0) == 0) {
@@ -548,3 +548,29 @@ rgephy_reset(struct mii_softc *sc)
DELAY(1000);
rgephy_load_dspcode(sc);
 }
+
+static void
+rgephy_disable_eee(struct mii_softc *sc)
+{
+   uint16_t anar;
+
+   PHY_WRITE(sc, RGEPHY_F_EPAGSR, 0x);
+   PHY_WRITE(sc, MII_MMDACR, MMDACR_FN_ADDRESS |
+   (MMDACR_DADDRMASK & RGEPHY_F_MMD_DEV_7));
+   PHY_WRITE(sc, MII_MMDAADR, RGEPHY_F_MMD_EEEAR);
+   PHY_WRITE(sc, MII_MMDACR, MMDACR_FN_DATANPI |
+   (MMDACR_DADDRMASK & RGEPHY_F_MMD_DEV_7));
+   PHY_WRITE(sc, MII_MMDAADR, 0x);
+   PHY_WRITE(sc, MII_MMDACR, 0x);
+   /*
+* XXX
+* Restart auto-negotiation to take changes effect.
+* This may result in link establishment.
+*/
+   anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
+   PHY_WRITE(sc, RGEPHY_MII_ANAR, anar);
+   PHY_WRITE(sc, RGEPHY_MII_1000CTL, RGEPHY_1000CTL_AHD |
+   RGEPHY_1000CTL_AFD);
+   PHY_WRITE(sc, RGEPHY_MII_BMCR, RGEPHY_BMCR_RESET |
+   RGEPHY_BMCR_AUTOEN | RGEPHY_BMCR_STARTNEG);
+}

Modified: head/sys/dev/mii/rgephyreg.h
==
--- head/sys/dev/mii/rgephyreg.hThu Dec  3 04:35:44 2015
(r291675)
+++ head/sys/dev/mii/rgephyreg.hThu Dec  3 05:27:39 2015
(r291676)
@@ -183,4 +183,20 @@
 #defineRGEPHY_F_SSR_MDI0x0002  /* MDI/MDIX */
 #defineRGEPHY_F_SSR_JABBER 0x0001  /* Jabber */
 
+/* RTL8211F */
+#defineRGEPHY_F_EPAGSR 0x1F/* Extension page select 
register */
+
+/* RTL8211F */
+#defineRGEPHY_F_MMD_DEV_7  0x07
+
+/* RTL8211F MMD device 7 */
+#defineRGEPHY_F_MMD_EEEAR  0x3C/* EEE advertisement */
+#defineEEEAR_1000T 0x0004  /* adv. 1000baseT EEE */
+#defineEEEAR_100TX 0x0002  /* adv. 100baseTX EEE */
+
+/* RTL8211F MMD device 7 */
+#defineRGEPHY_F_MMD_EEELPAR0x3D/* EEE link partner abilities */
+#defineEEELPAR_1000T   0x0004  /* link partner 1000baseT EEE 
capable */
+#defineEEELPAR_100TX   0x0002  /* link partner 100baseTX EEE 
capable */
+
 #endif /* _DEV_RGEPHY_MIIREG_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2015-12-02 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Dec  3 07:13:13 2015
New Revision: 291677
URL: https://svnweb.freebsd.org/changeset/base/291677

Log:
  sfxge: add MCDI logging support to common code
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days
  Differential Revision: https://reviews.freebsd.org/D4331

Modified:
  head/sys/dev/sfxge/common/efsys.h
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_check.h
  head/sys/dev/sfxge/common/efx_mcdi.c
  head/sys/dev/sfxge/common/hunt_mcdi.c
  head/sys/dev/sfxge/common/siena_mcdi.c

Modified: head/sys/dev/sfxge/common/efsys.h
==
--- head/sys/dev/sfxge/common/efsys.h   Thu Dec  3 05:27:39 2015
(r291676)
+++ head/sys/dev/sfxge/common/efsys.h   Thu Dec  3 07:13:13 2015
(r291677)
@@ -245,6 +245,7 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b
 #endif
 
 #defineEFSYS_OPT_MCDI 1
+#defineEFSYS_OPT_MCDI_LOGGING 0
 
 #defineEFSYS_OPT_MAC_FALCON_GMAC 0
 #defineEFSYS_OPT_MAC_FALCON_XMAC 0

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Thu Dec  3 05:27:39 2015
(r291676)
+++ head/sys/dev/sfxge/common/efx.h Thu Dec  3 07:13:13 2015
(r291677)
@@ -201,12 +201,25 @@ typedef enum efx_mcdi_exception_e {
EFX_MCDI_EXCEPTION_MC_BADASSERT,
 } efx_mcdi_exception_t;
 
+#if EFSYS_OPT_MCDI_LOGGING
+typedef enum efx_log_msg_e
+{
+   EFX_LOG_INVALID,
+   EFX_LOG_MCDI_REQUEST,
+   EFX_LOG_MCDI_RESPONSE,
+} efx_log_msg_t;
+#endif /* EFSYS_OPT_MCDI_LOGGING */
+
 typedef struct efx_mcdi_transport_s {
void*emt_context;
efsys_mem_t *emt_dma_mem;
void(*emt_execute)(void *, efx_mcdi_req_t *);
void(*emt_ev_cpl)(void *);
void(*emt_exception)(void *, efx_mcdi_exception_t);
+#if EFSYS_OPT_MCDI_LOGGING
+   void(*emt_logger)(void *, efx_log_msg_t,
+   void *, size_t, void *, size_t);
+#endif /* EFSYS_OPT_MCDI_LOGGING */
 } efx_mcdi_transport_t;
 
 extern __checkReturn   efx_rc_t

Modified: head/sys/dev/sfxge/common/efx_check.h
==
--- head/sys/dev/sfxge/common/efx_check.h   Thu Dec  3 05:27:39 2015
(r291676)
+++ head/sys/dev/sfxge/common/efx_check.h   Thu Dec  3 07:13:13 2015
(r291677)
@@ -146,6 +146,13 @@
 # error "HUNTINGTON requires MCDI"
 #endif
 
+/* Support MCDI logging */
+#if EFSYS_OPT_MCDI_LOGGING
+# if !EFSYS_OPT_MCDI
+#  error "MCDI_LOGGING requires MCDI"
+# endif
+#endif /* EFSYS_OPT_MCDI_LOGGING */
+
 /* Support LM87 monitor */
 #if EFSYS_OPT_MON_LM87
 # if !EFSYS_OPT_FALCON

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cThu Dec  3 05:27:39 2015
(r291676)
+++ head/sys/dev/sfxge/common/efx_mcdi.cThu Dec  3 07:13:13 2015
(r291677)
@@ -468,9 +468,8 @@ efx_mcdi_ev_cpl(
} else {
emrp->emr_out_length_used = outlen;
emrp->emr_rc = 0;
-
-   emcop->emco_request_copyout(enp, emrp);
}
+   emcop->emco_request_copyout(enp, emrp);
 
emtp->emt_ev_cpl(emtp->emt_context);
 }

Modified: head/sys/dev/sfxge/common/hunt_mcdi.c
==
--- head/sys/dev/sfxge/common/hunt_mcdi.c   Thu Dec  3 05:27:39 2015
(r291676)
+++ head/sys/dev/sfxge/common/hunt_mcdi.c   Thu Dec  3 07:13:13 2015
(r291677)
@@ -143,6 +143,7 @@ hunt_mcdi_request_copyin(
efsys_mem_t *esmp = emtp->emt_dma_mem;
efx_mcdi_header_type_t hdr_type;
efx_dword_t dword;
+   efx_dword_t hdr[2];
unsigned int xflags;
unsigned int pos;
size_t offset;
@@ -160,7 +161,7 @@ hunt_mcdi_request_copyin(
 
if (hdr_type == EFX_MCDI_HEADER_TYPE_V2) {
/* Construct MCDI v2 header */
-   EFX_POPULATE_DWORD_8(dword,
+   EFX_POPULATE_DWORD_8(hdr[0],
MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_DATALEN, 0,
@@ -169,17 +170,17 @@ hunt_mcdi_request_copyin(
MCDI_HEADER_ERROR, 0,
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_XFLAGS, xflags);
-   EFSYS_MEM_WRITED(esmp, offset, &dword);
-   offset += sizeof (dword);
+   EFSYS_MEM_WRITED(esmp, offset, &hdr[0]);
+   offset += sizeof (efx_dword_t);
 
-   EFX_POPULATE_DWORD_2(dword,
+   EFX_POPULATE_DWORD_2(hdr[1],
MC_CMD_V2_EXTN_IN_EXTENDED_

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

2015-12-02 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Dec  3 07:22:53 2015
New Revision: 291678
URL: https://svnweb.freebsd.org/changeset/base/291678

Log:
  sfxge: sync TLV layout headers with firmwaresrc for event merging config
  
  Submitted by:   Tom Millington 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days

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

Modified: head/sys/dev/sfxge/common/ef10_tlv_layout.h
==
--- head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Dec  3 07:13:13 2015
(r291677)
+++ head/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Dec  3 07:22:53 2015
(r291678)
@@ -330,7 +330,7 @@ struct tlv_tmp_gubbins {
   uint64_t tx1_tags; /* Bitmap */
   uint64_t dl_tags;  /* Bitmap */
   uint32_t flags;
-#define TLV_DPCPU_TX_STRIPE (1) /* TX striping is on */
+#define TLV_DPCPU_TX_STRIPE (1) /* No longer used, has no effect */
 #define TLV_DPCPU_BIU_TAGS  (2) /* Use BIU tag manager */
 #define TLV_DPCPU_TX0_TAGS  (4) /* tx0_tags is valid */
 #define TLV_DPCPU_TX1_TAGS  (8) /* tx1_tags is valid */
@@ -688,4 +688,42 @@ struct tlv_ocsd {
 #define TLV_OCSD_ENABLED 1 /* Default */
 };
 
+/* Descriptor cache config.
+ *
+ * Sets the sizes of the TX and RX descriptor caches as a power of 2. It also
+ * sets the total number of VIs. When the number of VIs is reduced VIs are 
taken
+ * away from the highest numbered port first, so a vi_count of 1024 means 1024
+ * VIs on the first port and 0 on the second (on a Torino).
+ */
+
+#define TLV_TAG_DESCRIPTOR_CACHE_CONFIG(0x101d)
+
+struct tlv_descriptor_cache_config {
+  uint32_t tag;
+  uint32_t length;
+  uint8_t rx_desc_cache_size;
+  uint8_t tx_desc_cache_size;
+  uint16_t vi_count;
+};
+#define TLV_DESC_CACHE_DEFAULT (0xff)
+#define TLV_VI_COUNT_DEFAULT   (0x)
+
+/* RX event merging config (read batching).
+ *
+ * Sets the global maximum number of events for the merging bins, and the
+ * global timeout configuration for the bins.
+ */
+
+#define TLV_TAG_RX_EVENT_MERGING_CONFIG(0x101e)
+
+struct tlv_rx_event_merging_config {
+  uint32_t  tag;
+  uint32_t  length;
+  uint32_t  max_events;
+#define TLV_RX_EVENT_MERGING_CONFIG_MAX_EVENTS_MAX ((1 << 4) - 1)
+  uint32_t  timeout_ns;
+};
+#define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7
+#define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 8740
+
 #endif /* CI_MGMT_TLV_LAYOUT_H */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2015-12-02 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Dec  3 07:24:59 2015
New Revision: 291679
URL: https://svnweb.freebsd.org/changeset/base/291679

Log:
  sfxge: add markers for autogenerated defines
  
  Move use defines outside.
  
  Submitted by:   Guido Barzini 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days

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

Modified: head/sys/dev/sfxge/common/efx_regs_ef10.h
==
--- head/sys/dev/sfxge/common/efx_regs_ef10.h   Thu Dec  3 07:22:53 2015
(r291678)
+++ head/sys/dev/sfxge/common/efx_regs_ef10.h   Thu Dec  3 07:24:59 2015
(r291679)
@@ -37,6 +37,14 @@
 extern "C" {
 #endif
 
+/**
+ * NOTE: the line below marks the start of the autogenerated section
+ * EF10 registers and descriptors
+ *
+ **
+ */
+
+
 /*
  * BIU_HW_REV_ID_REG(32bit):
  *
@@ -182,30 +190,6 @@ extern "C" {
 #defineERF_DZ_TX_DESC_LWORD_LBN 0
 #defineERF_DZ_TX_DESC_LWORD_WIDTH 32
 
-/*
- * The workaround for bug 35388 requires multiplexing writes through
- * the ERF_DZ_TX_DESC_WPTR address.
- * TX_DESC_UPD: 0ppp   (bit 11 lost)
- * EVQ_RPTR:1000, 1001 (split into high and low bits)
- * EVQ_TMR: 11mm   (bits 8:13 of value lost)
- */
-#defineER_DD_EVQ_INDIRECT_OFST (ER_DZ_TX_DESC_UPD_REG_OFST + 2 * 4)
-#defineER_DD_EVQ_INDIRECT_STEP ER_DZ_TX_DESC_UPD_REG_STEP
-#defineERF_DD_EVQ_IND_RPTR_FLAGS_LBN 8
-#defineERF_DD_EVQ_IND_RPTR_FLAGS_WIDTH 4
-#defineEFE_DD_EVQ_IND_RPTR_FLAGS_HIGH 8
-#defineEFE_DD_EVQ_IND_RPTR_FLAGS_LOW 9
-#defineERF_DD_EVQ_IND_RPTR_LBN 0
-#defineERF_DD_EVQ_IND_RPTR_WIDTH 8
-#defineERF_DD_EVQ_IND_TIMER_FLAGS_LBN 10
-#defineERF_DD_EVQ_IND_TIMER_FLAGS_WIDTH 2
-#defineEFE_DD_EVQ_IND_TIMER_FLAGS 3
-#defineERF_DD_EVQ_IND_TIMER_MODE_LBN 8
-#defineERF_DD_EVQ_IND_TIMER_MODE_WIDTH 2
-#defineERF_DD_EVQ_IND_TIMER_VAL_LBN 0
-#defineERF_DD_EVQ_IND_TIMER_VAL_WIDTH 8
-
-
 /* ES_DRIVER_EV */
 #defineESF_DZ_DRV_CODE_LBN 60
 #defineESF_DZ_DRV_CODE_WIDTH 4
@@ -2935,6 +2919,35 @@ extern "C" {
 #defineESE_DZ_TO_PORT_B 0x2
 #defineESE_DZ_TO_PORT_A 0x1
 #defineESE_DZ_PM_IPI_NOOP 0x0
+
+/*
+ * NOTE: the comment line above marks the end of the autogenerated section
+ */
+
+/*
+ * The workaround for bug 35388 requires multiplexing writes through
+ * the ERF_DZ_TX_DESC_WPTR address.
+ * TX_DESC_UPD: 0ppp   (bit 11 lost)
+ * EVQ_RPTR:1000, 1001 (split into high and low bits)
+ * EVQ_TMR: 11mm   (bits 8:13 of value lost)
+ */
+#defineER_DD_EVQ_INDIRECT_OFST (ER_DZ_TX_DESC_UPD_REG_OFST + 2 * 4)
+#defineER_DD_EVQ_INDIRECT_STEP ER_DZ_TX_DESC_UPD_REG_STEP
+#defineERF_DD_EVQ_IND_RPTR_FLAGS_LBN 8
+#defineERF_DD_EVQ_IND_RPTR_FLAGS_WIDTH 4
+#defineEFE_DD_EVQ_IND_RPTR_FLAGS_HIGH 8
+#defineEFE_DD_EVQ_IND_RPTR_FLAGS_LOW 9
+#defineERF_DD_EVQ_IND_RPTR_LBN 0
+#defineERF_DD_EVQ_IND_RPTR_WIDTH 8
+#defineERF_DD_EVQ_IND_TIMER_FLAGS_LBN 10
+#defineERF_DD_EVQ_IND_TIMER_FLAGS_WIDTH 2
+#defineEFE_DD_EVQ_IND_TIMER_FLAGS 3
+#defineERF_DD_EVQ_IND_TIMER_MODE_LBN 8
+#defineERF_DD_EVQ_IND_TIMER_MODE_WIDTH 2
+#defineERF_DD_EVQ_IND_TIMER_VAL_LBN 0
+#defineERF_DD_EVQ_IND_TIMER_VAL_WIDTH 8
+
+
 #ifdef __cplusplus
 }
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2015-12-02 Thread Andrew Rybchenko
Author: arybchik
Date: Thu Dec  3 07:28:57 2015
New Revision: 291680
URL: https://svnweb.freebsd.org/changeset/base/291680

Log:
  sfxge: remove internal register definitions that should not be used by host 
code
  
  Submitted by:   Guido Barzini 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  2 days

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

Modified: head/sys/dev/sfxge/common/efx_regs_ef10.h
==
--- head/sys/dev/sfxge/common/efx_regs_ef10.h   Thu Dec  3 07:24:59 2015
(r291679)
+++ head/sys/dev/sfxge/common/efx_regs_ef10.h   Thu Dec  3 07:28:57 2015
(r291680)
@@ -44,7 +44,6 @@ extern "C" {
  **
  */
 
-
 /*
  * BIU_HW_REV_ID_REG(32bit):
  *
@@ -190,6 +189,7 @@ extern "C" {
 #defineERF_DZ_TX_DESC_LWORD_LBN 0
 #defineERF_DZ_TX_DESC_LWORD_WIDTH 32
 
+
 /* ES_DRIVER_EV */
 #defineESF_DZ_DRV_CODE_LBN 60
 #defineESF_DZ_DRV_CODE_WIDTH 4
@@ -226,1310 +226,6 @@ extern "C" {
 #defineESF_DZ_EV_DATA_WIDTH 60
 
 
-/* ES_FF_UMSG_CPU2DL_DESC_FETCH */
-#defineESF_DZ_C2DDF_DSCR_CACHE_RPTR_LBN 208
-#defineESF_DZ_C2DDF_DSCR_CACHE_RPTR_WIDTH 6
-#defineESF_DZ_C2DDF_QID_LBN 160
-#defineESF_DZ_C2DDF_QID_WIDTH 11
-#defineESF_DZ_C2DDF_DSCR_BASE_PAGE_ID_LBN 64
-#defineESF_DZ_C2DDF_DSCR_BASE_PAGE_ID_WIDTH 18
-#defineESF_DZ_C2DDF_DSCR_HW_RPTR_LBN 48
-#defineESF_DZ_C2DDF_DSCR_HW_RPTR_WIDTH 12
-#defineESF_DZ_C2DDF_DSCR_HW_WPTR_LBN 32
-#defineESF_DZ_C2DDF_DSCR_HW_WPTR_WIDTH 12
-#defineESF_DZ_C2DDF_OID_LBN 16
-#defineESF_DZ_C2DDF_OID_WIDTH 12
-#defineESF_DZ_C2DDF_DSCR_SIZE_LBN 13
-#defineESF_DZ_C2DDF_DSCR_SIZE_WIDTH 3
-#defineESE_DZ_C2DDF_DSCR_SIZE_512 7
-#defineESE_DZ_C2DDF_DSCR_SIZE_1K 6
-#defineESE_DZ_C2DDF_DSCR_SIZE_2K 5
-#defineESE_DZ_C2DDF_DSCR_SIZE_4K 4
-#defineESF_DZ_C2DDF_BIU_ARGS_LBN 0
-#defineESF_DZ_C2DDF_BIU_ARGS_WIDTH 13
-
-
-/* ES_FF_UMSG_CPU2DL_DESC_PUSH */
-#defineESF_DZ_C2DDP_DSCR_HW_RPTR_LBN 224
-#defineESF_DZ_C2DDP_DSCR_HW_RPTR_WIDTH 12
-#defineESF_DZ_C2DDP_DESC_DW0_LBN 128
-#defineESF_DZ_C2DDP_DESC_DW0_WIDTH 32
-#defineESF_DZ_C2DDP_DESC_DW1_LBN 160
-#defineESF_DZ_C2DDP_DESC_DW1_WIDTH 32
-#defineESF_DZ_C2DDP_DESC_LBN 128
-#defineESF_DZ_C2DDP_DESC_WIDTH 64
-#defineESF_DZ_C2DDP_QID_LBN 64
-#defineESF_DZ_C2DDP_QID_WIDTH 11
-#defineESF_DZ_C2DDP_DSCR_HW_WPTR_LBN 32
-#defineESF_DZ_C2DDP_DSCR_HW_WPTR_WIDTH 12
-#defineESF_DZ_C2DDP_OID_LBN 16
-#defineESF_DZ_C2DDP_OID_WIDTH 12
-#defineESF_DZ_C2DDP_DSCR_SIZE_LBN 0
-#defineESF_DZ_C2DDP_DSCR_SIZE_WIDTH 3
-#defineESE_DZ_C2DDF_DSCR_SIZE_512 7
-#defineESE_DZ_C2DDF_DSCR_SIZE_1K 6
-#defineESE_DZ_C2DDF_DSCR_SIZE_2K 5
-#defineESE_DZ_C2DDF_DSCR_SIZE_4K 4
-
-
-/* ES_FF_UMSG_CPU2DL_GPRD */
-#defineESF_DZ_C2DG_ENCODED_HOST_ADDR_DW0_LBN 64
-#defineESF_DZ_C2DG_ENCODED_HOST_ADDR_DW0_WIDTH 32
-#defineESF_DZ_C2DG_ENCODED_HOST_ADDR_DW1_LBN 96
-#defineESF_DZ_C2DG_ENCODED_HOST_ADDR_DW1_WIDTH 16
-#defineESF_DZ_C2DG_ENCODED_HOST_ADDR_LBN 64
-#defineESF_DZ_C2DG_ENCODED_HOST_ADDR_WIDTH 48
-#defineESF_DZ_C2DG_SMC_ADDR_LBN 16
-#defineESF_DZ_C2DG_SMC_ADDR_WIDTH 16
-#defineESF_DZ_C2DG_BIU_ARGS_LBN 0
-#defineESF_DZ_C2DG_BIU_ARGS_WIDTH 14
-
-
-/* ES_FF_UMSG_CPU2EV_SOFT */
-#defineESF_DZ_C2ES_TBD_LBN 0
-#defineESF_DZ_C2ES_TBD_WIDTH 1
-
-
-/* ES_FF_UMSG_CPU2EV_TXCMPLT */
-#defineESF_DZ_C2ET_EV_SOFT2_LBN 48
-#defineESF_DZ_C2ET_EV_SOFT2_WIDTH 16
-#defineESF_DZ_C2ET_EV_CODE_LBN 42
-#defineESF_DZ_C2ET_EV_CODE_WIDTH 4
-#defineESF_DZ_C2ET_EV_OVERRIDE_HOLDOFF_LBN 41
-#defineESF_DZ_C2ET_EV_OVERRIDE_HOLDOFF_WIDTH 1
-#defineESF_DZ_C2ET_EV_DROP_EVENT_LBN 40
-#defineESF_DZ_C2ET_EV_DROP_EVENT_WIDTH 1
-#defineESF_DZ_C2ET_EV_CAN_MERGE_LBN 39
-#defineESF_DZ_C2ET_EV_CAN_MERGE_WIDTH 1
-#defineESF_DZ_C2ET_EV_SOFT1_LBN 32
-#defineESF_DZ_C2ET_EV_SOFT1_WIDTH 7
-#defineESF_DZ_C2ET_DSCR_IDX_LBN 16
-#defineESF_DZ_C2ET_DSCR_IDX_WIDTH 16
-#defineESF_DZ_C2ET_EV_QID_LBN 5
-#defineESF_DZ_C2ET_EV_QID_WIDTH 11
-#defineESF_DZ_C2ET_EV_QLABEL_LBN 0
-#defineESF_DZ_C2ET_EV_QLABEL_WIDTH 5
-
-
-/* ES_FF_UMSG_CPU2RXDP_INGR_BUFOP */
-#defineESF_DZ_C2RIB_EV_DISABLE_LBN 191
-#defineESF_DZ_C2RIB_EV_DISABLE_WIDTH 1
-#defineESF_DZ_C2RIB_EV_SOFT_LBN 188
-#defineESF_DZ_C2RIB_EV_SOFT_WIDTH 3
-#defineESF_DZ_C2RIB_EV_DESC_PTR_LBN 176
-#defineESF_DZ_C2RIB_EV_DESC_PTR_WIDTH 12
-#defineESF_DZ_C2RIB_EV_ARG1_LBN 160
-#define

svn commit: r291681 - head/share/mk

2015-12-02 Thread Garrett Cooper
Author: ngie
Date: Thu Dec  3 07:42:00 2015
New Revision: 291681
URL: https://svnweb.freebsd.org/changeset/base/291681

Log:
  Fix a typo in a comment (spacial -> special)
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/src.libnames.mk

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Thu Dec  3 07:28:57 2015
(r291680)
+++ head/share/mk/src.libnames.mk   Thu Dec  3 07:42:00 2015
(r291681)
@@ -272,7 +272,7 @@ _DP_rpcsec_gss= gssapi
 _DP_smb=   kiconv
 _DP_ulog=  md
 
-# Define spacial cases
+# Define special cases
 LDADD_supcplusplus=-lsupc++
 LIBATF_C=  ${DESTDIR}${LIBDIR}/libprivateatf-c.a
 LIBATF_CXX=${DESTDIR}${LIBDIR}/libprivateatf-c++.a
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"