summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorWENTAO YANG <Wentao.Yang@Sun.COM>2008-12-10 16:54:40 -0800
committerWENTAO YANG <Wentao.Yang@Sun.COM>2008-12-10 16:54:40 -0800
commit6b8fc343e520eb7f7ff86860ba68d09bdff1f4fb (patch)
treec771f22381da2ee56b081456933dbc2dbd1b6a8d /usr/src
parent0013e2d3ee8df19e750204fa40ded829084c45f8 (diff)
downloadillumos-joyent-6b8fc343e520eb7f7ff86860ba68d09bdff1f4fb.tar.gz
6782312 NIU hio kstats setup can free the vres which is still on the vres_list of vnet.
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/sun4v/io/vnet.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/usr/src/uts/sun4v/io/vnet.c b/usr/src/uts/sun4v/io/vnet.c
index 64f3c278f5..1d7b9cd706 100644
--- a/usr/src/uts/sun4v/io/vnet.c
+++ b/usr/src/uts/sun4v/io/vnet.c
@@ -1168,8 +1168,20 @@ int vio_net_resource_reg(mac_register_t *macp, vio_net_res_type_t type,
vnetp = vnet_headp;
while (vnetp != NULL) {
if (VNET_MATCH_RES(vresp, vnetp)) {
- WRITE_ENTER(&vnetp->vrwlock);
vresp->vnetp = vnetp;
+
+ /* Setup kstats for hio resource */
+ if (vresp->type == VIO_NET_RES_HYBRID) {
+ vresp->ksp = vnet_hio_setup_kstats(DRV_NAME,
+ "hio", vresp);
+ if (vresp->ksp == NULL) {
+ cmn_err(CE_NOTE, "!vnet%d: Cannot "
+ "create kstats for hio resource",
+ vnetp->instance);
+ }
+ }
+
+ WRITE_ENTER(&vnetp->vrwlock);
vresp->nextp = vnetp->vres_list;
vnetp->vres_list = vresp;
RW_EXIT(&vnetp->vrwlock);
@@ -1184,16 +1196,6 @@ int vio_net_resource_reg(mac_register_t *macp, vio_net_res_type_t type,
return (ENXIO);
}
- /* Setup kstats for hio resource */
- if (vresp->type == VIO_NET_RES_HYBRID) {
- vresp->ksp = vnet_hio_setup_kstats(DRV_NAME, "hio", vresp);
- if (vresp->ksp == NULL) {
- DWARN(NULL, "Cannot create kstats for hio resource");
- kmem_free(vresp, sizeof (vnet_res_t));
- return (ENXIO);
- }
- }
-
*vhp = vresp;
vcb->vio_net_rx_cb = vnet_rx;
vcb->vio_net_tx_update = vnet_tx_update;