Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Show First 20 Lines • Show All 792 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
hn_tx_done(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, | hn_tx_done(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, | ||||
struct vmbus_channel *chan, const struct nvsp_msg_ *msg __unused, | struct vmbus_channel *chan, const struct nvsp_msg_ *msg __unused, | ||||
int dlen __unused) | int dlen __unused) | ||||
{ | { | ||||
struct hn_txdesc *txd = sndc->hn_cbarg; | struct hn_txdesc *txd = sndc->hn_cbarg; | ||||
struct hn_tx_ring *txr; | struct hn_tx_ring *txr; | ||||
if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) | if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) | ||||
hn_chim_free(net_dev, sndc->hn_chim_idx); | hn_chim_free(net_dev, sndc->hn_chim_idx); | ||||
txr = txd->txr; | txr = txd->txr; | ||||
KASSERT(txr->hn_chan == chan, | KASSERT(txr->hn_chan == chan, | ||||
("channel mismatch, on chan%u, should be chan%u", | ("channel mismatch, on chan%u, should be chan%u", | ||||
vmbus_chan_subidx(chan), vmbus_chan_subidx(txr->hn_chan))); | vmbus_chan_subidx(chan), vmbus_chan_subidx(txr->hn_chan))); | ||||
txr->hn_has_txeof = 1; | txr->hn_has_txeof = 1; | ||||
▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | #endif | ||||
* Chimney send, if the packet could fit into one chimney buffer. | * Chimney send, if the packet could fit into one chimney buffer. | ||||
*/ | */ | ||||
if (tot_data_buf_len < txr->hn_tx_chimney_size) { | if (tot_data_buf_len < txr->hn_tx_chimney_size) { | ||||
netvsc_dev *net_dev = txr->hn_sc->net_dev; | netvsc_dev *net_dev = txr->hn_sc->net_dev; | ||||
txr->hn_tx_chimney_tried++; | txr->hn_tx_chimney_tried++; | ||||
send_buf_section_idx = | send_buf_section_idx = | ||||
hv_nv_get_next_send_section(net_dev); | hv_nv_get_next_send_section(net_dev); | ||||
if (send_buf_section_idx != | if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { | ||||
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { | |||||
uint8_t *dest = ((uint8_t *)net_dev->send_buf + | uint8_t *dest = ((uint8_t *)net_dev->send_buf + | ||||
(send_buf_section_idx * | (send_buf_section_idx * | ||||
net_dev->send_section_size)); | net_dev->send_section_size)); | ||||
memcpy(dest, rndis_mesg, rndis_msg_size); | memcpy(dest, rndis_mesg, rndis_msg_size); | ||||
dest += rndis_msg_size; | dest += rndis_msg_size; | ||||
m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); | m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); | ||||
Show All 39 Lines | for (i = 0; i < nsegs; ++i) { | ||||
struct vmbus_gpa *gpa = &txr->hn_gpa[ | struct vmbus_gpa *gpa = &txr->hn_gpa[ | ||||
i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS]; | 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 = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; | send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; | ||||
send_buf_section_size = 0; | send_buf_section_size = 0; | ||||
done: | done: | ||||
txd->m = m_head; | txd->m = m_head; | ||||
/* Set the completion routine */ | /* Set the completion routine */ | ||||
hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd, | hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd, | ||||
send_buf_section_idx, send_buf_section_size); | send_buf_section_idx, send_buf_section_size); | ||||
Show All 10 Lines | |||||
{ | { | ||||
int error, send_failed = 0; | int error, send_failed = 0; | ||||
again: | again: | ||||
/* | /* | ||||
* Make sure that txd is not freed before ETHER_BPF_MTAP. | * Make sure that txd is not freed before ETHER_BPF_MTAP. | ||||
*/ | */ | ||||
hn_txdesc_hold(txd); | hn_txdesc_hold(txd); | ||||
error = hv_nv_on_send(txr->hn_chan, true, &txd->send_ctx, | error = hv_nv_on_send(txr->hn_chan, HN_NVS_RNDIS_MTYPE_DATA, | ||||
txr->hn_gpa, txr->hn_gpa_cnt); | &txd->send_ctx, txr->hn_gpa, txr->hn_gpa_cnt); | ||||
if (!error) { | if (!error) { | ||||
ETHER_BPF_MTAP(ifp, txd->m); | ETHER_BPF_MTAP(ifp, txd->m); | ||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); | if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); | ||||
if (!hn_use_if_start) { | if (!hn_use_if_start) { | ||||
if_inc_counter(ifp, IFCOUNTER_OBYTES, | if_inc_counter(ifp, IFCOUNTER_OBYTES, | ||||
txd->m->m_pkthdr.len); | txd->m->m_pkthdr.len); | ||||
if (txd->m->m_flags & M_MCAST) | if (txd->m->m_flags & M_MCAST) | ||||
if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); | if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); | ||||
▲ Show 20 Lines • Show All 1,961 Lines • Show Last 20 Lines |