+errno_t
+ifnet_set_tso_mtu(
+ ifnet_t interface,
+ sa_family_t family,
+ u_int32_t mtuLen)
+{
+ errno_t error = 0;
+
+ if (interface == NULL) return EINVAL;
+
+ if (mtuLen < interface->if_mtu)
+ return EINVAL;
+
+
+ switch (family) {
+
+ case AF_INET:
+ if (interface->if_hwassist & IFNET_TSO_IPV4)
+ interface->if_tso_v4_mtu = mtuLen;
+ else
+ error = EINVAL;
+ break;
+
+ case AF_INET6:
+ if (interface->if_hwassist & IFNET_TSO_IPV6)
+ interface->if_tso_v6_mtu = mtuLen;
+ else
+ error = EINVAL;
+ break;
+
+ default:
+ error = EPROTONOSUPPORT;
+ }
+
+ return error;
+}
+
+errno_t
+ifnet_get_tso_mtu(
+ ifnet_t interface,
+ sa_family_t family,
+ u_int32_t *mtuLen)
+{
+ errno_t error = 0;
+
+ if (interface == NULL || mtuLen == NULL) return EINVAL;
+
+ switch (family) {
+
+ case AF_INET:
+ if (interface->if_hwassist & IFNET_TSO_IPV4)
+ *mtuLen = interface->if_tso_v4_mtu;
+ else
+ error = EINVAL;
+ break;
+
+ case AF_INET6:
+ if (interface->if_hwassist & IFNET_TSO_IPV6)
+ *mtuLen = interface->if_tso_v6_mtu;
+ else
+ error = EINVAL;
+ break;
+ default:
+ error = EPROTONOSUPPORT;
+ }
+
+ return error;
+}
+
+errno_t
+ifnet_set_wake_flags(ifnet_t interface, u_int32_t properties, u_int32_t mask)
+{
+ int lock;
+ struct kev_msg ev_msg;
+ struct net_event_data ev_data;
+
+ if (interface == NULL)
+ return EINVAL;
+
+ /* Do not accept wacky values */
+ if ((properties & mask) & ~IF_WAKE_VALID_FLAGS)
+ return EINVAL;
+
+ lock = (interface->if_lock != 0);
+
+ if (lock)
+ ifnet_lock_exclusive(interface);
+
+ interface->if_wake_properties = (properties & mask) | (interface->if_wake_properties & ~mask);
+
+ if (lock)
+ ifnet_lock_done(interface);
+
+ (void) ifnet_touch_lastchange(interface);
+
+ /* Notify application of the change */
+ ev_msg.vendor_code = KEV_VENDOR_APPLE;
+ ev_msg.kev_class = KEV_NETWORK_CLASS;
+ ev_msg.kev_subclass = KEV_DL_SUBCLASS;
+
+ ev_msg.event_code = KEV_DL_WAKEFLAGS_CHANGED;
+ strlcpy(&ev_data.if_name[0], interface->if_name, IFNAMSIZ);
+ ev_data.if_family = interface->if_family;
+ ev_data.if_unit = (u_int32_t) interface->if_unit;
+ ev_msg.dv[0].data_length = sizeof(struct net_event_data);
+ ev_msg.dv[0].data_ptr = &ev_data;
+ ev_msg.dv[1].data_length = 0;
+ kev_post_msg(&ev_msg);
+
+ return 0;
+}
+
+u_int32_t
+ifnet_get_wake_flags(ifnet_t interface)
+{
+ return interface == NULL ? 0 : interface->if_wake_properties;
+}
+
+
+
+