hv_netvsc: Add handler for LRO setting change
This patch adds the handler for LRO setting change, so that a user can use ethtool command to enable / disable LRO feature. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c8e4eff467
commit
d6792a5a07
|
@ -185,6 +185,7 @@ struct rndis_device {
|
||||||
|
|
||||||
/* Interface */
|
/* Interface */
|
||||||
struct rndis_message;
|
struct rndis_message;
|
||||||
|
struct ndis_offload_params;
|
||||||
struct netvsc_device;
|
struct netvsc_device;
|
||||||
struct netvsc_channel;
|
struct netvsc_channel;
|
||||||
struct net_device_context;
|
struct net_device_context;
|
||||||
|
@ -218,6 +219,9 @@ void rndis_filter_device_remove(struct hv_device *dev,
|
||||||
struct netvsc_device *nvdev);
|
struct netvsc_device *nvdev);
|
||||||
int rndis_filter_set_rss_param(struct rndis_device *rdev,
|
int rndis_filter_set_rss_param(struct rndis_device *rdev,
|
||||||
const u8 *key);
|
const u8 *key);
|
||||||
|
int rndis_filter_set_offload_params(struct net_device *ndev,
|
||||||
|
struct netvsc_device *nvdev,
|
||||||
|
struct ndis_offload_params *req_offloads);
|
||||||
int rndis_filter_receive(struct net_device *ndev,
|
int rndis_filter_receive(struct net_device *ndev,
|
||||||
struct netvsc_device *net_dev,
|
struct netvsc_device *net_dev,
|
||||||
struct netvsc_channel *nvchan,
|
struct netvsc_channel *nvchan,
|
||||||
|
|
|
@ -1006,6 +1006,8 @@ static void netvsc_init_settings(struct net_device *dev)
|
||||||
|
|
||||||
ndc->speed = SPEED_UNKNOWN;
|
ndc->speed = SPEED_UNKNOWN;
|
||||||
ndc->duplex = DUPLEX_FULL;
|
ndc->duplex = DUPLEX_FULL;
|
||||||
|
|
||||||
|
dev->features = NETIF_F_LRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int netvsc_get_link_ksettings(struct net_device *dev,
|
static int netvsc_get_link_ksettings(struct net_device *dev,
|
||||||
|
@ -1733,6 +1735,33 @@ static int netvsc_set_ringparam(struct net_device *ndev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int netvsc_set_features(struct net_device *ndev,
|
||||||
|
netdev_features_t features)
|
||||||
|
{
|
||||||
|
netdev_features_t change = features ^ ndev->features;
|
||||||
|
struct net_device_context *ndevctx = netdev_priv(ndev);
|
||||||
|
struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev);
|
||||||
|
struct ndis_offload_params offloads;
|
||||||
|
|
||||||
|
if (!nvdev || nvdev->destroy)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
if (!(change & NETIF_F_LRO))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memset(&offloads, 0, sizeof(struct ndis_offload_params));
|
||||||
|
|
||||||
|
if (features & NETIF_F_LRO) {
|
||||||
|
offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED;
|
||||||
|
offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED;
|
||||||
|
} else {
|
||||||
|
offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_DISABLED;
|
||||||
|
offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rndis_filter_set_offload_params(ndev, nvdev, &offloads);
|
||||||
|
}
|
||||||
|
|
||||||
static u32 netvsc_get_msglevel(struct net_device *ndev)
|
static u32 netvsc_get_msglevel(struct net_device *ndev)
|
||||||
{
|
{
|
||||||
struct net_device_context *ndev_ctx = netdev_priv(ndev);
|
struct net_device_context *ndev_ctx = netdev_priv(ndev);
|
||||||
|
@ -1776,6 +1805,7 @@ static const struct net_device_ops device_ops = {
|
||||||
.ndo_start_xmit = netvsc_start_xmit,
|
.ndo_start_xmit = netvsc_start_xmit,
|
||||||
.ndo_change_rx_flags = netvsc_change_rx_flags,
|
.ndo_change_rx_flags = netvsc_change_rx_flags,
|
||||||
.ndo_set_rx_mode = netvsc_set_rx_mode,
|
.ndo_set_rx_mode = netvsc_set_rx_mode,
|
||||||
|
.ndo_set_features = netvsc_set_features,
|
||||||
.ndo_change_mtu = netvsc_change_mtu,
|
.ndo_change_mtu = netvsc_change_mtu,
|
||||||
.ndo_validate_addr = eth_validate_addr,
|
.ndo_validate_addr = eth_validate_addr,
|
||||||
.ndo_set_mac_address = netvsc_set_mac_addr,
|
.ndo_set_mac_address = netvsc_set_mac_addr,
|
||||||
|
|
|
@ -716,7 +716,7 @@ int rndis_filter_set_device_mac(struct netvsc_device *nvdev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
rndis_filter_set_offload_params(struct net_device *ndev,
|
rndis_filter_set_offload_params(struct net_device *ndev,
|
||||||
struct netvsc_device *nvdev,
|
struct netvsc_device *nvdev,
|
||||||
struct ndis_offload_params *req_offloads)
|
struct ndis_offload_params *req_offloads)
|
||||||
|
@ -1246,8 +1246,13 @@ static int rndis_netdev_set_hwcaps(struct rndis_device *rndis_device,
|
||||||
if (hwcaps.rsc.ip4 && hwcaps.rsc.ip6) {
|
if (hwcaps.rsc.ip4 && hwcaps.rsc.ip6) {
|
||||||
net->hw_features |= NETIF_F_LRO;
|
net->hw_features |= NETIF_F_LRO;
|
||||||
|
|
||||||
offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED;
|
if (net->features & NETIF_F_LRO) {
|
||||||
offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED;
|
offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED;
|
||||||
|
offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED;
|
||||||
|
} else {
|
||||||
|
offloads.rsc_ip_v4 = NDIS_OFFLOAD_PARAMETERS_RSC_DISABLED;
|
||||||
|
offloads.rsc_ip_v6 = NDIS_OFFLOAD_PARAMETERS_RSC_DISABLED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In case some hw_features disappeared we need to remove them from
|
/* In case some hw_features disappeared we need to remove them from
|
||||||
|
|
Loading…
Reference in New Issue