Skip to content
Snippets Groups Projects
Select Git revision
  • 028091f82eefd5e84f81cef81a7673016ecbe78b
  • master default
  • android-container
  • nanopc-t4
  • for-kernelci
  • WIP-syscall
  • v4.16-rc5
  • v4.16-rc4
  • v4.16-rc3
  • v4.16-rc2
  • v4.16-rc1
  • v4.15
  • v4.15-rc9
  • v4.15-rc8
  • v4.15-rc7
  • v4.15-rc6
  • v4.15-rc5
  • v4.15-rc4
  • v4.15-rc3
  • v4.15-rc2
  • v4.15-rc1
  • v4.14
  • v4.14-rc8
  • v4.14-rc7
  • v4.14-rc6
  • v4.14-rc5
26 results

intel-mid.c

Blame
  • netvsc.c 39.21 KiB
    /*
     * Copyright (c) 2009, Microsoft Corporation.
     *
     * This program is free software; you can redistribute it and/or modify it
     * under the terms and conditions of the GNU General Public License,
     * version 2, as published by the Free Software Foundation.
     *
     * This program is distributed in the hope it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
     * more details.
     *
     * You should have received a copy of the GNU General Public License along with
     * this program; if not, see <http://www.gnu.org/licenses/>.
     *
     * Authors:
     *   Haiyang Zhang <haiyangz@microsoft.com>
     *   Hank Janssen  <hjanssen@microsoft.com>
     */
    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
    
    #include <linux/kernel.h>
    #include <linux/sched.h>
    #include <linux/wait.h>
    #include <linux/mm.h>
    #include <linux/delay.h>
    #include <linux/io.h>
    #include <linux/slab.h>
    #include <linux/netdevice.h>
    #include <linux/if_ether.h>
    #include <linux/vmalloc.h>
    #include <linux/rtnetlink.h>
    #include <linux/prefetch.h>
    
    #include <asm/sync_bitops.h>
    
    #include "hyperv_net.h"
    #include "netvsc_trace.h"
    
    /*
     * Switch the data path from the synthetic interface to the VF
     * interface.
     */
    void netvsc_switch_datapath(struct net_device *ndev, bool vf)
    {
    	struct net_device_context *net_device_ctx = netdev_priv(ndev);
    	struct hv_device *dev = net_device_ctx->device_ctx;
    	struct netvsc_device *nv_dev = rtnl_dereference(net_device_ctx->nvdev);
    	struct nvsp_message *init_pkt = &nv_dev->channel_init_pkt;
    
    	memset(init_pkt, 0, sizeof(struct nvsp_message));
    	init_pkt->hdr.msg_type = NVSP_MSG4_TYPE_SWITCH_DATA_PATH;
    	if (vf)
    		init_pkt->msg.v4_msg.active_dp.active_datapath =
    			NVSP_DATAPATH_VF;
    	else
    		init_pkt->msg.v4_msg.active_dp.active_datapath =
    			NVSP_DATAPATH_SYNTHETIC;
    
    	trace_nvsp_send(ndev, init_pkt);
    
    	vmbus_sendpacket(dev->channel, init_pkt,
    			       sizeof(struct nvsp_message),
    			       (unsigned long)init_pkt,
    			       VM_PKT_DATA_INBAND, 0);
    }
    
    /* Worker to setup sub channels on initial setup
     * Initial hotplug event occurs in softirq context
     * and can't wait for channels.