summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4v/io
diff options
context:
space:
mode:
authorSriharsha Basavapatna <Sriharsha.Basavapatna@Sun.COM>2009-06-08 14:57:32 -0700
committerSriharsha Basavapatna <Sriharsha.Basavapatna@Sun.COM>2009-06-08 14:57:32 -0700
commitd8a518c84b0b033745c344594c3478e1294f3a9a (patch)
tree316f7abc71b7993be38c826d802168574b795554 /usr/src/uts/sun4v/io
parent22b8c3a898c468940872c5b3bdf0d3d09ce72398 (diff)
downloadillumos-joyent-d8a518c84b0b033745c344594c3478e1294f3a9a.tar.gz
6848822 link state of vswitch interface shows up as 'unknown' in some cases
Diffstat (limited to 'usr/src/uts/sun4v/io')
-rw-r--r--usr/src/uts/sun4v/io/vsw.c22
-rw-r--r--usr/src/uts/sun4v/io/vsw_switching.c21
2 files changed, 27 insertions, 16 deletions
diff --git a/usr/src/uts/sun4v/io/vsw.c b/usr/src/uts/sun4v/io/vsw.c
index e005a3a3d8..8a19ea1054 100644
--- a/usr/src/uts/sun4v/io/vsw.c
+++ b/usr/src/uts/sun4v/io/vsw.c
@@ -116,7 +116,7 @@ static int vsw_m_unicst(void *arg, const uint8_t *);
static int vsw_m_multicst(void *arg, boolean_t, const uint8_t *);
static int vsw_m_promisc(void *arg, boolean_t);
static mblk_t *vsw_m_tx(void *arg, mblk_t *);
-static void vsw_mac_link_update(vsw_t *vswp, link_state_t link_state);
+void vsw_mac_link_update(vsw_t *vswp, link_state_t link_state);
void vsw_mac_rx(vsw_t *vswp, mac_resource_handle_t mrh,
mblk_t *mp, vsw_macrx_flags_t flags);
void vsw_physlink_state_update(vsw_t *vswp);
@@ -145,7 +145,7 @@ extern int vsw_mac_open(vsw_t *vswp);
extern void vsw_mac_close(vsw_t *vswp);
extern void vsw_mac_cleanup_ports(vsw_t *vswp);
extern void vsw_unset_addrs(vsw_t *vswp);
-extern void vsw_setup_layer2_post_process(vsw_t *vswp);
+extern void vsw_setup_switching_post_process(vsw_t *vswp);
extern void vsw_create_vlans(void *arg, int type);
extern void vsw_destroy_vlans(void *arg, int type);
extern void vsw_vlan_add_ids(void *arg, int type);
@@ -1989,17 +1989,16 @@ vsw_linkprop_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node,
}
}
-static void
+void
vsw_mac_link_update(vsw_t *vswp, link_state_t link_state)
{
READ_ENTER(&vswp->if_lockrw);
- if ((vswp->if_state & VSW_IF_UP) == 0) {
- RW_EXIT(&vswp->if_lockrw);
- return;
+
+ if (vswp->if_state & VSW_IF_REG) {
+ mac_link_update(vswp->if_mh, link_state);
}
- RW_EXIT(&vswp->if_lockrw);
- mac_link_update(vswp->if_mh, link_state);
+ RW_EXIT(&vswp->if_lockrw);
}
void
@@ -2183,7 +2182,10 @@ vsw_update_md_prop(vsw_t *vswp, md_t *mdp, mde_cookie_t node)
* Phys link state update is now enabled. Send up an
* update based on the current phys link state.
*/
- vsw_mac_link_update(vswp, vswp->phys_link_state);
+ if (vswp->smode & VSW_LAYER2) {
+ vsw_mac_link_update(vswp,
+ vswp->phys_link_state);
+ }
}
}
@@ -2258,7 +2260,7 @@ vsw_update_md_prop(vsw_t *vswp, md_t *mdp, mde_cookie_t node)
goto fail_update;
}
- vsw_setup_layer2_post_process(vswp);
+ vsw_setup_switching_post_process(vswp);
} else if (updated & MD_macaddr) {
/*
* We enter here if only MD_macaddr is exclusively updated.
diff --git a/usr/src/uts/sun4v/io/vsw_switching.c b/usr/src/uts/sun4v/io/vsw_switching.c
index 4623af9702..86492efcc6 100644
--- a/usr/src/uts/sun4v/io/vsw_switching.c
+++ b/usr/src/uts/sun4v/io/vsw_switching.c
@@ -75,7 +75,7 @@ void vsw_setup_switching_thread(void *arg);
int vsw_setup_switching_start(vsw_t *vswp);
void vsw_setup_switching_stop(vsw_t *vswp);
int vsw_setup_switching(vsw_t *);
-void vsw_setup_layer2_post_process(vsw_t *vswp);
+void vsw_setup_switching_post_process(vsw_t *vswp);
void vsw_switch_frame_nop(vsw_t *vswp, mblk_t *mp, int caller,
vsw_port_t *port, mac_resource_handle_t mrh);
static int vsw_setup_layer2(vsw_t *);
@@ -139,7 +139,8 @@ extern int vsw_mac_multicast_add(vsw_t *vswp, vsw_port_t *port,
mcst_addr_t *mcst_p, int type);
extern void vsw_mac_multicast_remove(vsw_t *vswp, vsw_port_t *port,
mcst_addr_t *mcst_p, int type);
-extern void vsw_physlink_state_update(vsw_t *vswp);
+extern void vsw_mac_link_update(vsw_t *vswp, link_state_t link_state);
+extern void vsw_physlink_update_ports(vsw_t *vswp);
/*
* Tunables used in this file.
@@ -214,7 +215,7 @@ vsw_setup_switching_thread(void *arg)
mutex_exit(&vswp->sw_thr_lock);
rv = vsw_setup_switching(vswp);
if (rv == 0) {
- vsw_setup_layer2_post_process(vswp);
+ vsw_setup_switching_post_process(vswp);
}
mutex_enter(&vswp->sw_thr_lock);
if (rv != EAGAIN) {
@@ -674,11 +675,13 @@ vsw_switch_l3_frame(vsw_t *vswp, mblk_t *mp, int caller,
}
/*
- * Setup mac addrs and hio resources for layer 2 switching only.
+ * Additional initializations that are needed for the specific switching mode.
*/
void
-vsw_setup_layer2_post_process(vsw_t *vswp)
+vsw_setup_switching_post_process(vsw_t *vswp)
{
+ link_state_t link_state = LINK_STATE_UP;
+
if (vswp->smode & VSW_LAYER2) {
/*
* Program unicst, mcst addrs of vsw
@@ -689,9 +692,15 @@ vsw_setup_layer2_post_process(vsw_t *vswp)
/* Start HIO for ports that have already connected */
vsw_hio_start_ports(vswp);
+ if (vswp->pls_update == B_TRUE) {
+ link_state = vswp->phys_link_state;
+ }
+
/* Update physical link info to any ports already connected */
- vsw_physlink_state_update(vswp);
+ vsw_physlink_update_ports(vswp);
}
+
+ vsw_mac_link_update(vswp, link_state);
}
/*