Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | #define HN_RNDIS_MSG_LEN \ | ||||
RNDIS_TSO_PPI_SIZE + \ | RNDIS_TSO_PPI_SIZE + \ | ||||
RNDIS_CSUM_PPI_SIZE) | RNDIS_CSUM_PPI_SIZE) | ||||
#define HN_RNDIS_MSG_BOUNDARY PAGE_SIZE | #define HN_RNDIS_MSG_BOUNDARY PAGE_SIZE | ||||
#define HN_RNDIS_MSG_ALIGN CACHE_LINE_SIZE | #define HN_RNDIS_MSG_ALIGN CACHE_LINE_SIZE | ||||
#define HN_TX_DATA_BOUNDARY PAGE_SIZE | #define HN_TX_DATA_BOUNDARY PAGE_SIZE | ||||
#define HN_TX_DATA_MAXSIZE IP_MAXPACKET | #define HN_TX_DATA_MAXSIZE IP_MAXPACKET | ||||
#define HN_TX_DATA_SEGSIZE PAGE_SIZE | #define HN_TX_DATA_SEGSIZE PAGE_SIZE | ||||
#define HN_TX_DATA_SEGCNT_MAX \ | /* -1 for RNDIS packet message */ | ||||
(NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) | #define HN_TX_DATA_SEGCNT_MAX (NETVSC_PACKET_MAXPAGE - 1) | ||||
#define HN_DIRECT_TX_SIZE_DEF 128 | #define HN_DIRECT_TX_SIZE_DEF 128 | ||||
#define HN_EARLY_TXEOF_THRESH 8 | #define HN_EARLY_TXEOF_THRESH 8 | ||||
struct hn_txdesc { | struct hn_txdesc { | ||||
#ifndef HN_USE_TXDESC_BUFRING | #ifndef HN_USE_TXDESC_BUFRING | ||||
SLIST_ENTRY(hn_txdesc) link; | SLIST_ENTRY(hn_txdesc) link; | ||||
▲ Show 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | netvsc_detach(device_t dev) | ||||
* unloading. | * unloading. | ||||
*/ | */ | ||||
/* | /* | ||||
* XXXKYS: Need to stop outgoing traffic and unregister | * XXXKYS: Need to stop outgoing traffic and unregister | ||||
* the netdevice. | * the netdevice. | ||||
*/ | */ | ||||
hv_rf_on_device_remove(sc, HV_RF_NV_DESTROY_CHANNEL); | hv_rf_on_device_remove(sc); | ||||
hn_stop_tx_tasks(sc); | hn_stop_tx_tasks(sc); | ||||
ifmedia_removeall(&sc->hn_media); | ifmedia_removeall(&sc->hn_media); | ||||
hn_destroy_rx_data(sc); | hn_destroy_rx_data(sc); | ||||
hn_destroy_tx_data(sc); | hn_destroy_tx_data(sc); | ||||
if (sc->hn_tx_taskq != hn_tx_taskq) | if (sc->hn_tx_taskq != hn_tx_taskq) | ||||
▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | KASSERT(freed != 0, | ||||
("fail to free txd upon txdma error")); | ("fail to free txd upon txdma error")); | ||||
txr->hn_txdma_failed++; | txr->hn_txdma_failed++; | ||||
if_inc_counter(txr->hn_sc->hn_ifp, IFCOUNTER_OERRORS, 1); | if_inc_counter(txr->hn_sc->hn_ifp, IFCOUNTER_OERRORS, 1); | ||||
return error; | return error; | ||||
} | } | ||||
*m_head0 = m_head; | *m_head0 = m_head; | ||||
txr->hn_gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; | /* +1 RNDIS packet message */ | ||||
txr->hn_gpa_cnt = nsegs + 1; | |||||
/* send packet with page buffer */ | /* send packet with page buffer */ | ||||
txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr); | txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr); | ||||
txr->hn_gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; | txr->hn_gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; | ||||
txr->hn_gpa[0].gpa_len = rndis_msg_size; | txr->hn_gpa[0].gpa_len = rndis_msg_size; | ||||
/* | /* | ||||
* Fill the page buffers with mbuf info starting at index | * Fill the page buffers with mbuf info after the page | ||||
* HV_RF_NUM_TX_RESERVED_PAGE_BUFS. | * buffer for RNDIS packet message. | ||||
*/ | */ | ||||
for (i = 0; i < nsegs; ++i) { | for (i = 0; i < nsegs; ++i) { | ||||
struct vmbus_gpa *gpa = &txr->hn_gpa[ | struct vmbus_gpa *gpa = &txr->hn_gpa[i + 1]; | ||||
i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS]; | |||||
gpa->gpa_page = atop(segs[i].ds_addr); | gpa->gpa_page = atop(segs[i].ds_addr); | ||||
gpa->gpa_ofs = segs[i].ds_addr & PAGE_MASK; | gpa->gpa_ofs = segs[i].ds_addr & PAGE_MASK; | ||||
gpa->gpa_len = segs[i].ds_len; | gpa->gpa_len = segs[i].ds_len; | ||||
} | } | ||||
send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; | send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; | ||||
send_buf_section_size = 0; | send_buf_section_size = 0; | ||||
▲ Show 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | if (retry_cnt == 0) { | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | } | ||||
/* We must remove and add back the device to cause the new | /* We must remove and add back the device to cause the new | ||||
* MTU to take effect. This includes tearing down, but not | * MTU to take effect. This includes tearing down, but not | ||||
* deleting the channel, then bringing it back up. | * deleting the channel, then bringing it back up. | ||||
*/ | */ | ||||
error = hv_rf_on_device_remove(sc, HV_RF_NV_RETAIN_CHANNEL); | error = hv_rf_on_device_remove(sc); | ||||
if (error) { | if (error) { | ||||
NV_LOCK(sc); | NV_LOCK(sc); | ||||
sc->temp_unusable = FALSE; | sc->temp_unusable = FALSE; | ||||
NV_UNLOCK(sc); | NV_UNLOCK(sc); | ||||
break; | break; | ||||
} | } | ||||
/* Wait for subchannels to be destroyed */ | /* Wait for subchannels to be destroyed */ | ||||
▲ Show 20 Lines • Show All 1,511 Lines • Show Last 20 Lines |