Date: Fri, 4 Mar 2016 07:00:38 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296380 - head/sys/dev/hyperv/netvsc Message-ID: <201603040700.u2470c7j061483@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Fri Mar 4 07:00:37 2016 New Revision: 296380 URL: https://svnweb.freebsd.org/changeset/base/296380 Log: hyperv/hn: Pass channel to send done callbacks. Mainly to strigent the data packet send done check. MFC after: 2 weeks Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Mar 4 06:52:11 2016 (r296379) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Mar 4 07:00:37 2016 (r296380) @@ -64,7 +64,7 @@ static int hv_nv_destroy_send_buffer(ne static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); static int hv_nv_connect_to_vsp(struct hv_device *device); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, hv_vm_packet_descriptor *pkt); + struct hv_device *device, struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, @@ -787,7 +787,8 @@ hv_nv_on_device_remove(struct hv_device */ static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, hv_vm_packet_descriptor *pkt) + struct hv_device *device, struct hv_vmbus_channel *chan, + hv_vm_packet_descriptor *pkt) { nvsp_msg *nvsp_msg_pkt; netvsc_packet *net_vsc_pkt; @@ -838,7 +839,7 @@ hv_nv_on_send_completion(netvsc_dev *net } /* Notify the layer above us */ - net_vsc_pkt->compl.send.on_send_completion( + net_vsc_pkt->compl.send.on_send_completion(chan, net_vsc_pkt->compl.send.send_completion_context); } @@ -1065,7 +1066,8 @@ hv_nv_on_channel_callback(void *xchan) desc = (hv_vm_packet_descriptor *)buffer; switch (desc->type) { case HV_VMBUS_PACKET_TYPE_COMPLETION: - hv_nv_on_send_completion(net_dev, device, desc); + hv_nv_on_send_completion(net_dev, device, + chan, desc); break; case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: hv_nv_on_receive(net_dev, device, chan, desc); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Mar 4 06:52:11 2016 (r296379) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Mar 4 07:00:37 2016 (r296380) @@ -1077,8 +1077,9 @@ typedef struct netvsc_dev_ { uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; +struct hv_vmbus_channel; -typedef void (*pfn_on_send_rx_completion)(void *); +typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) #define NETVSC_PACKET_MAXPAGE 32 @@ -1172,8 +1173,6 @@ struct hn_rx_ring { #define HN_TRUST_HCSUM_TCP 0x0002 #define HN_TRUST_HCSUM_UDP 0x0004 -struct hv_vmbus_channel; - struct hn_tx_ring { #ifndef HN_USE_TXDESC_BUFRING struct mtx hn_txlist_spin; Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Mar 4 06:52:11 2016 (r296379) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Mar 4 07:00:37 2016 (r296380) @@ -721,7 +721,7 @@ hn_txdesc_hold(struct hn_txdesc *txd) } static void -hn_tx_done(void *xpkt) +hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) { netvsc_packet *packet = xpkt; struct hn_txdesc *txd; @@ -731,6 +731,11 @@ hn_tx_done(void *xpkt) packet->compl.send.send_completion_tid; txr = txd->txr; + KASSERT(txr->hn_chan == chan, + ("channel mismatch, on channel%u, should be channel%u", + chan->offer_msg.offer.sub_channel_index, + txr->hn_chan->offer_msg.offer.sub_channel_index)); + txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); } Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Mar 4 06:52:11 2016 (r296379) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Mar 4 07:00:37 2016 (r296380) @@ -69,8 +69,8 @@ static int hv_rf_set_packet_filter(rndi static int hv_rf_init_device(rndis_device *device); static int hv_rf_open_device(rndis_device *device); static int hv_rf_close_device(rndis_device *device); -static void hv_rf_on_send_request_completion(void *context); -static void hv_rf_on_send_request_halt_completion(void *context); +static void hv_rf_on_send_request_completion(struct hv_vmbus_channel *, void *context); +static void hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *, void *context); int hv_rf_send_offload_request(struct hv_device *device, rndis_offload_params *offloads); @@ -1158,7 +1158,8 @@ hv_rf_on_close(struct hv_device *device) * RNDIS filter on send request completion callback */ static void -hv_rf_on_send_request_completion(void *context) +hv_rf_on_send_request_completion(struct hv_vmbus_channel *chan __unused, + void *context __unused) { } @@ -1166,7 +1167,8 @@ hv_rf_on_send_request_completion(void *c * RNDIS filter on send request (halt only) completion callback */ static void -hv_rf_on_send_request_halt_completion(void *context) +hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *chan __unused, + void *context) { rndis_request *request = context;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603040700.u2470c7j061483>