changeset 4929:132c9e4daa52

6532784 no-op SIOCSLIFFLAGS from in.mpathd impact performance under stress tests
author rk129064
date Wed, 22 Aug 2007 14:10:13 -0700
parents 7b72c4ee69c0
children 7e43c592ee98
files usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_probe.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_probe.c	Wed Aug 22 11:48:02 2007 -0700
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_probe.c	Wed Aug 22 14:10:13 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1127,7 +1127,7 @@
 		logdebug("check_exception_target(%s %s target %s)\n",
 		    AF_STR(pii->pii_af), pii->pii_name,
 		    pr_addr(pii->pii_af, target->tg_address,
-			abuf, sizeof (abuf)));
+		    abuf, sizeof (abuf)));
 	}
 
 	/*
@@ -2078,7 +2078,7 @@
 	pg = pi->pi_group;
 
 	if (LINK_UP(pi) && phyint_inst_probe_failure_state(pii, &pi_tff) ==
-		PHYINT_OK)
+	    PHYINT_OK)
 		return (PHYINT_OK);
 
 	/*
@@ -2807,6 +2807,7 @@
 {
 	int ifsock;
 	struct lifreq lifr;
+	uint64_t old_flags;
 
 	if (debug & D_FAILOVER) {
 		logdebug("change_lif_flags(%s): flags %llx setfl %d\n",
@@ -2831,10 +2832,18 @@
 			logperror("change_lif_flags: ioctl (get flags)");
 		return (_B_FALSE);
 	}
+
+	old_flags = lifr.lifr_flags;
 	if (setfl)
 		lifr.lifr_flags |= flags;
 	else
 		lifr.lifr_flags &= ~flags;
+
+	if (old_flags == lifr.lifr_flags) {
+		/* No change in the flags. No need to send ioctl */
+		return (_B_TRUE);
+	}
+
 	if (ioctl(ifsock, SIOCSLIFFLAGS, (char *)&lifr) < 0) {
 		if (errno != ENXIO)
 			logperror("change_lif_flags: ioctl (set flags)");