mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-11 23:27:42 +07:00
hyperv: Move state setting for link query
It moves the state setting for query into rndis_filter_receive_response(). All callbacks including query-complete and status-callback are synchronized by channel->inbound_lock. This prevents pentential race between them. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
48330e08fa
commit
1b07da516e
@ -442,6 +442,8 @@ static int netvsc_probe(struct hv_device *dev,
|
||||
if (!net)
|
||||
return -ENOMEM;
|
||||
|
||||
netif_carrier_off(net);
|
||||
|
||||
net_device_ctx = netdev_priv(net);
|
||||
net_device_ctx->device_ctx = dev;
|
||||
hv_set_drvdata(dev, net);
|
||||
@ -473,6 +475,8 @@ static int netvsc_probe(struct hv_device *dev,
|
||||
pr_err("Unable to register netdev.\n");
|
||||
rndis_filter_device_remove(dev);
|
||||
free_netdev(net);
|
||||
} else {
|
||||
schedule_delayed_work(&net_device_ctx->dwork, 0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -243,6 +243,22 @@ static int rndis_filter_send_request(struct rndis_device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rndis_set_link_state(struct rndis_device *rdev,
|
||||
struct rndis_request *request)
|
||||
{
|
||||
u32 link_status;
|
||||
struct rndis_query_complete *query_complete;
|
||||
|
||||
query_complete = &request->response_msg.msg.query_complete;
|
||||
|
||||
if (query_complete->status == RNDIS_STATUS_SUCCESS &&
|
||||
query_complete->info_buflen == sizeof(u32)) {
|
||||
memcpy(&link_status, (void *)((unsigned long)query_complete +
|
||||
query_complete->info_buf_offset), sizeof(u32));
|
||||
rdev->link_state = link_status != 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void rndis_filter_receive_response(struct rndis_device *dev,
|
||||
struct rndis_message *resp)
|
||||
{
|
||||
@ -272,6 +288,10 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
|
||||
sizeof(struct rndis_message) + RNDIS_EXT_LEN) {
|
||||
memcpy(&request->response_msg, resp,
|
||||
resp->msg_len);
|
||||
if (request->request_msg.ndis_msg_type ==
|
||||
RNDIS_MSG_QUERY && request->request_msg.msg.
|
||||
query_req.oid == RNDIS_OID_GEN_MEDIA_CONNECT_STATUS)
|
||||
rndis_set_link_state(dev, request);
|
||||
} else {
|
||||
netdev_err(ndev,
|
||||
"rndis response buffer overflow "
|
||||
@ -620,7 +640,6 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev)
|
||||
ret = rndis_filter_query_device(dev,
|
||||
RNDIS_OID_GEN_MEDIA_CONNECT_STATUS,
|
||||
&link_status, &size);
|
||||
dev->link_state = (link_status != 0) ? true : false;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user