/* * Copyright(c) 2017 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that 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. * * BSD LICENSE * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * This file contains OPA Virtual Network Interface Controller (VNIC) driver * netdev functionality. */ #include <linux/if_vlan.h> #include <linux/crc32.h> #include "opa_vnic_internal.h" #define OPA_TX_TIMEOUT_MS … #define OPA_VNIC_SKB_HEADROOM … /* This function is overloaded for opa_vnic specific implementation */ static void opa_vnic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) { … } /* opa_netdev_start_xmit - transmit function */ static netdev_tx_t opa_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) { … } static u16 opa_vnic_select_queue(struct net_device *netdev, struct sk_buff *skb, struct net_device *sb_dev) { … } static void opa_vnic_update_state(struct opa_vnic_adapter *adapter, bool up) { … } /* opa_vnic_process_vema_config - process vema configuration updates */ void opa_vnic_process_vema_config(struct opa_vnic_adapter *adapter) { … } /* * Set the power on default values in adapter's vema interface structure. */ static inline void opa_vnic_set_pod_values(struct opa_vnic_adapter *adapter) { … } /* opa_vnic_set_mac_addr - change mac address */ static int opa_vnic_set_mac_addr(struct net_device *netdev, void *addr) { … } /* * opa_vnic_mac_send_event - post event on possible mac list exchange * Send trap when digest from uc/mc mac list differs from previous run. * Digest is evaluated similar to how cksum does. */ static void opa_vnic_mac_send_event(struct net_device *netdev, u8 event) { … } /* opa_vnic_set_rx_mode - handle uc/mc mac list change */ static void opa_vnic_set_rx_mode(struct net_device *netdev) { … } /* opa_netdev_open - activate network interface */ static int opa_netdev_open(struct net_device *netdev) { … } /* opa_netdev_close - disable network interface */ static int opa_netdev_close(struct net_device *netdev) { … } /* netdev ops */ static const struct net_device_ops opa_netdev_ops = …; /* opa_vnic_add_netdev - create vnic netdev interface */ struct opa_vnic_adapter *opa_vnic_add_netdev(struct ib_device *ibdev, u8 port_num, u8 vport_num) { … } /* opa_vnic_rem_netdev - remove vnic netdev interface */ void opa_vnic_rem_netdev(struct opa_vnic_adapter *adapter) { … }