Skip to content

Commit

Permalink
Merge branch 'hv_netvsc-Add-init-of-send-table-and-var-renames'
Browse files Browse the repository at this point in the history
Haiyang Zhang says:

====================
hv_netvsc: Add init of send table and var renames

Add initialization of send indirection table. Otherwise it may contain
old info of previous device with different number of channels.

Also, did some variable renaming for easier reading.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 15, 2017
2 parents 5dc8742 + 6b0cbe3 commit c116004
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions drivers/net/hyperv/hyperv_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct rndis_device {

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


Expand Down Expand Up @@ -731,7 +731,7 @@ struct net_device_context {

u32 tx_checksum_mask;

u32 tx_send_table[VRSS_SEND_TAB_SIZE];
u32 tx_table[VRSS_SEND_TAB_SIZE];

/* Ethtool settings */
u8 duplex;
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ static void netvsc_send_table(struct hv_device *hdev,
nvmsg->msg.v5_msg.send_table.offset);

for (i = 0; i < count; i++)
net_device_ctx->tx_send_table[i] = tab[i];
net_device_ctx->tx_table[i] = tab[i];
}

static void netvsc_send_vf(struct net_device_context *net_device_ctx,
Expand Down Expand Up @@ -1255,6 +1255,9 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
if (!net_device)
return ERR_PTR(-ENOMEM);

for (i = 0; i < VRSS_SEND_TAB_SIZE; i++)
net_device_ctx->tx_table[i] = 0;

net_device->ring_size = ring_size;

/* Because the device uses NAPI, all the interrupt batching and
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ static inline int netvsc_get_tx_queue(struct net_device *ndev,
struct sock *sk = skb->sk;
int q_idx;

q_idx = ndc->tx_send_table[netvsc_get_hash(skb, ndc) &
(VRSS_SEND_TAB_SIZE - 1)];
q_idx = ndc->tx_table[netvsc_get_hash(skb, ndc) &
(VRSS_SEND_TAB_SIZE - 1)];

/* If queue index changed record the new value */
if (q_idx != old_idx &&
Expand Down Expand Up @@ -1434,7 +1434,7 @@ static int netvsc_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
rndis_dev = ndev->extension;
if (indir) {
for (i = 0; i < ITAB_NUM; i++)
indir[i] = rndis_dev->ind_table[i];
indir[i] = rndis_dev->rx_table[i];
}

if (key)
Expand Down Expand Up @@ -1464,7 +1464,7 @@ static int netvsc_set_rxfh(struct net_device *dev, const u32 *indir,
return -EINVAL;

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

if (!key) {
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/hyperv/rndis_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev,
/* Set indirection table entries */
itab = (u32 *)(rssp + 1);
for (i = 0; i < ITAB_NUM; i++)
itab[i] = rdev->ind_table[i];
itab[i] = rdev->rx_table[i];

/* Set hask key values */
keyp = (u8 *)((unsigned long)rssp + rssp->kashkey_offset);
Expand Down Expand Up @@ -1284,8 +1284,8 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
net_device->num_chn = min(net_device->max_chn, device_info->num_chn);

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

atomic_set(&net_device->open_chn, 1);
vmbus_set_sc_create_callback(dev->channel, netvsc_sc_open);
Expand Down

0 comments on commit c116004

Please sign in to comment.