View | Details | Raw Unified | Return to bug 231151 | Differences between
and this patch

Collapse All | Expand All

(-)sys/net/iflib.c (-13 / +26 lines)
Lines 4100-4108 Link Here
4100
}
4100
}
4101
4101
4102
4102
4103
#define IFCAP_FLAGS (IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \
4103
#define IFCAP_FLAGS (IFCAP_HWCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \
4104
		     IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | IFCAP_HWSTATS | \
4104
		     IFCAP_TSO | IFCAP_VLAN_HWTAGGING | IFCAP_HWSTATS | \
4105
		     IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | IFCAP_VLAN_HWTSO)
4105
		     IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | \
4106
		     IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM)
4106
4107
4107
static int
4108
static int
4108
iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
4109
iflib_if_ioctl(if_t ifp, u_long command, caddr_t data)
Lines 4223-4255 Link Here
4223
	}
4224
	}
4224
	case SIOCSIFCAP:
4225
	case SIOCSIFCAP:
4225
	{
4226
	{
4226
		int mask, setmask;
4227
		int mask, setmask, oldmask;
4227
4228
4228
		mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
4229
		oldmask = if_getcapenable(ifp);
4230
		mask = ifr->ifr_reqcap ^ oldmask;
4231
		mask &= ctx->ifc_softc_ctx.isc_capabilities;
4229
		setmask = 0;
4232
		setmask = 0;
4230
#ifdef TCP_OFFLOAD
4233
#ifdef TCP_OFFLOAD
4231
		setmask |= mask & (IFCAP_TOE4|IFCAP_TOE6);
4234
		setmask |= mask & (IFCAP_TOE4|IFCAP_TOE6);
4232
#endif
4235
#endif
4233
		setmask |= (mask & IFCAP_FLAGS);
4236
		setmask |= (mask & IFCAP_FLAGS);
4237
		setmask |= (mask & IFCAP_WOL);
4234
4238
4235
		if (setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6))
4236
			setmask |= (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
4237
		if ((mask & IFCAP_WOL) &&
4238
		    (if_getcapabilities(ifp) & IFCAP_WOL) != 0)
4239
			setmask |= (mask & (IFCAP_WOL_MCAST|IFCAP_WOL_MAGIC));
4240
		if_vlancap(ifp);
4241
		/*
4239
		/*
4240
		 * If we're disabling any RX csum, disable all the ones
4241
		 * the driver supports.  This assumes all supported are
4242
		 * enabled.
4243
		 * 
4244
		 * Otherwise, if they've changed, enable all of them.
4245
		 */
4246
		if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) <
4247
		    (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)))
4248
			setmask &= ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
4249
		else if ((setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) !=
4250
		    (oldmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)))
4251
			setmask |= (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6));
4252
4253
		/*
4242
		 * want to ensure that traffic has stopped before we change any of the flags
4254
		 * want to ensure that traffic has stopped before we change any of the flags
4243
		 */
4255
		 */
4244
		if (setmask) {
4256
		if (setmask) {
4245
			CTX_LOCK(ctx);
4257
			CTX_LOCK(ctx);
4246
			bits = if_getdrvflags(ifp);
4258
			bits = if_getdrvflags(ifp);
4247
			if (bits & IFF_DRV_RUNNING)
4259
			if (bits & IFF_DRV_RUNNING && setmask & ~IFCAP_WOL)
4248
				iflib_stop(ctx);
4260
				iflib_stop(ctx);
4249
			STATE_LOCK(ctx);
4261
			STATE_LOCK(ctx);
4250
			if_togglecapenable(ifp, setmask);
4262
			if_togglecapenable(ifp, setmask);
4251
			STATE_UNLOCK(ctx);
4263
			STATE_UNLOCK(ctx);
4252
			if (bits & IFF_DRV_RUNNING)
4264
			if (bits & IFF_DRV_RUNNING && setmask & ~IFCAP_WOL)
4253
				iflib_init_locked(ctx);
4265
				iflib_init_locked(ctx);
4254
			STATE_LOCK(ctx);
4266
			STATE_LOCK(ctx);
4255
			if_setdrvflags(ifp, bits);
4267
			if_setdrvflags(ifp, bits);
Lines 4256-4261 Link Here
4256
			STATE_UNLOCK(ctx);
4268
			STATE_UNLOCK(ctx);
4257
			CTX_UNLOCK(ctx);
4269
			CTX_UNLOCK(ctx);
4258
		}
4270
		}
4271
		if_vlancap(ifp);
4259
		break;
4272
		break;
4260
	}
4273
	}
4261
	case SIOCGPRIVATE_0:
4274
	case SIOCGPRIVATE_0:

Return to bug 231151