Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff4a4419 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller
Browse files

netvsc: allow get/set of RSS indirection table



Allow setting receive indirection table. Also uses the system standard
for initialization.

Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2b01888d
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -170,6 +170,7 @@ struct rndis_device {


	u8 hw_mac_adr[ETH_ALEN];
	u8 hw_mac_adr[ETH_ALEN];
	u8 rss_key[NETVSC_HASH_KEYLEN];
	u8 rss_key[NETVSC_HASH_KEYLEN];
	u16 ind_table[ITAB_NUM];
};
};




+23 −3
Original line number Original line Diff line number Diff line
@@ -1035,7 +1035,7 @@ static u32 netvsc_get_rxfh_key_size(struct net_device *dev)


static u32 netvsc_rss_indir_size(struct net_device *dev)
static u32 netvsc_rss_indir_size(struct net_device *dev)
{
{
	return 0;
	return ITAB_NUM;
}
}


static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
@@ -1044,10 +1044,16 @@ static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
	struct net_device_context *ndc = netdev_priv(dev);
	struct net_device_context *ndc = netdev_priv(dev);
	struct netvsc_device *ndev = ndc->nvdev;
	struct netvsc_device *ndev = ndc->nvdev;
	struct rndis_device *rndis_dev = ndev->extension;
	struct rndis_device *rndis_dev = ndev->extension;
	int i;


	if (hfunc)
	if (hfunc)
		*hfunc = ETH_RSS_HASH_TOP;	/* Toeplitz */
		*hfunc = ETH_RSS_HASH_TOP;	/* Toeplitz */


	if (indir) {
		for (i = 0; i < ITAB_NUM; i++)
			indir[i] = rndis_dev->ind_table[i];
	}

	if (key)
	if (key)
		memcpy(key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN);
		memcpy(key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN);


@@ -1060,12 +1066,26 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir,
	struct net_device_context *ndc = netdev_priv(dev);
	struct net_device_context *ndc = netdev_priv(dev);
	struct netvsc_device *ndev = ndc->nvdev;
	struct netvsc_device *ndev = ndc->nvdev;
	struct rndis_device *rndis_dev = ndev->extension;
	struct rndis_device *rndis_dev = ndev->extension;
	int i;


	if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
	if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;


	if (!key || memcmp(key, rndis_dev->rss_key, NETVSC_HASH_KEYLEN) == 0)
	if (indir) {
		return 0; /* no change */
		for (i = 0; i < ITAB_NUM; i++)
			if (indir[i] >= dev->num_rx_queues)
				return -EINVAL;

		for (i = 0; i < ITAB_NUM; i++)
			rndis_dev->ind_table[i] = indir[i];
	}

	if (!key) {
		if (!indir)
			return 0;

		key = rndis_dev->rss_key;
	}


	return rndis_filter_set_rss_param(rndis_dev, key, ndev->num_chn);
	return rndis_filter_set_rss_param(rndis_dev, key, ndev->num_chn);
}
}
+7 −2
Original line number Original line Diff line number Diff line
@@ -780,7 +780,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
	/* Set indirection table entries */
	/* Set indirection table entries */
	itab = (u32 *)(rssp + 1);
	itab = (u32 *)(rssp + 1);
	for (i = 0; i < ITAB_NUM; i++)
	for (i = 0; i < ITAB_NUM; i++)
		itab[i] = i % num_queue;
		itab[i] = rdev->ind_table[i];


	/* Set hask key values */
	/* Set hask key values */
	keyp = (u8 *)((unsigned long)rssp + rssp->kashkey_offset);
	keyp = (u8 *)((unsigned long)rssp + rssp->kashkey_offset);
@@ -1035,7 +1035,6 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc)
int rndis_filter_device_add(struct hv_device *dev,
int rndis_filter_device_add(struct hv_device *dev,
			    void *additional_info)
			    void *additional_info)
{
{
	int ret;
	struct net_device *net = hv_get_drvdata(dev);
	struct net_device *net = hv_get_drvdata(dev);
	struct net_device_context *net_device_ctx = netdev_priv(net);
	struct net_device_context *net_device_ctx = netdev_priv(net);
	struct netvsc_device *net_device;
	struct netvsc_device *net_device;
@@ -1053,6 +1052,7 @@ int rndis_filter_device_add(struct hv_device *dev,
	const struct cpumask *node_cpu_mask;
	const struct cpumask *node_cpu_mask;
	u32 num_possible_rss_qs;
	u32 num_possible_rss_qs;
	unsigned long flags;
	unsigned long flags;
	int i, ret;


	rndis_device = get_rndis_device();
	rndis_device = get_rndis_device();
	if (!rndis_device)
	if (!rndis_device)
@@ -1206,6 +1206,11 @@ int rndis_filter_device_add(struct hv_device *dev,
		net_device->num_chn = min(num_possible_rss_qs, num_rss_qs);
		net_device->num_chn = min(num_possible_rss_qs, num_rss_qs);


	num_rss_qs = net_device->num_chn - 1;
	num_rss_qs = net_device->num_chn - 1;

	for (i = 0; i < ITAB_NUM; i++)
		rndis_device->ind_table[i] = ethtool_rxfh_indir_default(i,
							net_device->num_chn);

	net_device->num_sc_offered = num_rss_qs;
	net_device->num_sc_offered = num_rss_qs;


	if (net_device->num_chn == 1)
	if (net_device->num_chn == 1)