Deleted Added
full compact
hv_netvsc_drv_freebsd.c (263853) hv_netvsc_drv_freebsd.c (266794)
1/*-
2 * Copyright (c) 2010-2012 Citrix Inc.
3 * Copyright (c) 2009-2012 Microsoft Corp.
4 * Copyright (c) 2012 NetApp Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 39 unchanged lines hidden (view full) ---

48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 */
54
55#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2012 Citrix Inc.
3 * Copyright (c) 2009-2012 Microsoft Corp.
4 * Copyright (c) 2012 NetApp Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 39 unchanged lines hidden (view full) ---

48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 */
54
55#include <sys/cdefs.h>
56__FBSDID("$FreeBSD: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c 263853 2014-03-28 01:13:08Z delphij $");
56__FBSDID("$FreeBSD: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c 266794 2014-05-28 09:06:36Z marius $");
57
58#include <sys/param.h>
59#include <sys/systm.h>
60#include <sys/sockio.h>
61#include <sys/mbuf.h>
62#include <sys/malloc.h>
63#include <sys/module.h>
64#include <sys/kernel.h>

--- 274 unchanged lines hidden (view full) ---

339 */
340void
341netvsc_xmit_completion(void *context)
342{
343 netvsc_packet *packet = (netvsc_packet *)context;
344 struct mbuf *mb;
345 uint8_t *buf;
346
57
58#include <sys/param.h>
59#include <sys/systm.h>
60#include <sys/sockio.h>
61#include <sys/mbuf.h>
62#include <sys/malloc.h>
63#include <sys/module.h>
64#include <sys/kernel.h>

--- 274 unchanged lines hidden (view full) ---

339 */
340void
341netvsc_xmit_completion(void *context)
342{
343 netvsc_packet *packet = (netvsc_packet *)context;
344 struct mbuf *mb;
345 uint8_t *buf;
346
347 mb = (struct mbuf *)packet->compl.send.send_completion_tid;
347 mb = (struct mbuf *)(uintptr_t)packet->compl.send.send_completion_tid;
348 buf = ((uint8_t *)packet) - HV_NV_PACKET_OFFSET_IN_BUF;
349
350 free(buf, M_DEVBUF);
351
352 if (mb != NULL) {
353 m_freem(mb);
354 }
355}

--- 133 unchanged lines hidden (view full) ---

489 */
490 if (ifp->if_bpf) {
491 mc_head = m_copypacket(m_head, M_DONTWAIT);
492 }
493retry_send:
494 /* Set the completion routine */
495 packet->compl.send.on_send_completion = netvsc_xmit_completion;
496 packet->compl.send.send_completion_context = packet;
348 buf = ((uint8_t *)packet) - HV_NV_PACKET_OFFSET_IN_BUF;
349
350 free(buf, M_DEVBUF);
351
352 if (mb != NULL) {
353 m_freem(mb);
354 }
355}

--- 133 unchanged lines hidden (view full) ---

489 */
490 if (ifp->if_bpf) {
491 mc_head = m_copypacket(m_head, M_DONTWAIT);
492 }
493retry_send:
494 /* Set the completion routine */
495 packet->compl.send.on_send_completion = netvsc_xmit_completion;
496 packet->compl.send.send_completion_context = packet;
497 packet->compl.send.send_completion_tid = (uint64_t)m_head;
497 packet->compl.send.send_completion_tid = (uint64_t)(uintptr_t)m_head;
498
499 /* Removed critical_enter(), does not appear necessary */
500 ret = hv_rf_on_send(device_ctx, packet);
501
502 if (ret == 0) {
503 ifp->if_opackets++;
504 /* if bpf && mc_head, call bpf_mtap code */
505 if (mc_head) {

--- 171 unchanged lines hidden (view full) ---

677
678 /*
679 * Copy the received packet to one or more mbufs.
680 * The copy is required since the memory pointed to by netvsc_packet
681 * cannot be deallocated
682 */
683 for (i=0; i < packet->page_buf_count; i++) {
684 /* Shift virtual page number to form virtual page address */
498
499 /* Removed critical_enter(), does not appear necessary */
500 ret = hv_rf_on_send(device_ctx, packet);
501
502 if (ret == 0) {
503 ifp->if_opackets++;
504 /* if bpf && mc_head, call bpf_mtap code */
505 if (mc_head) {

--- 171 unchanged lines hidden (view full) ---

677
678 /*
679 * Copy the received packet to one or more mbufs.
680 * The copy is required since the memory pointed to by netvsc_packet
681 * cannot be deallocated
682 */
683 for (i=0; i < packet->page_buf_count; i++) {
684 /* Shift virtual page number to form virtual page address */
685 uint8_t *vaddr = (uint8_t *)
685 uint8_t *vaddr = (uint8_t *)(uintptr_t)
686 (packet->page_buffers[i].pfn << PAGE_SHIFT);
687
688 hv_m_append(m_new, packet->page_buffers[i].length,
689 vaddr + packet->page_buffers[i].offset);
690 }
691
692 m_new->m_pkthdr.rcvif = ifp;
693

--- 325 unchanged lines hidden ---
686 (packet->page_buffers[i].pfn << PAGE_SHIFT);
687
688 hv_m_append(m_new, packet->page_buffers[i].length,
689 vaddr + packet->page_buffers[i].offset);
690 }
691
692 m_new->m_pkthdr.rcvif = ifp;
693

--- 325 unchanged lines hidden ---