linux/drivers/net/ethernet/amd/xgbe/xgbe-drv.c

/*
 * AMD 10Gb Ethernet driver
 *
 * This file is available to you under your choice of the following two
 * licenses:
 *
 * License 1: GPLv2
 *
 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
 *
 * This file is free software; you may copy, redistribute and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or (at
 * your option) any later version.
 *
 * This file 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * This file incorporates work covered by the following copyright and
 * permission notice:
 *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
 *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
 *     Inc. unless otherwise expressly agreed to in writing between Synopsys
 *     and you.
 *
 *     The Software IS NOT an item of Licensed Software or Licensed Product
 *     under any End User Software License Agreement or Agreement for Licensed
 *     Product with Synopsys or any supplement thereto.  Permission is hereby
 *     granted, free of charge, to any person obtaining a copy of this software
 *     annotated with this license and the Software, to deal in the Software
 *     without restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 *     of the Software, and to permit persons to whom the Software is furnished
 *     to do so, subject to the following conditions:
 *
 *     The above copyright notice and this permission notice shall be included
 *     in all copies or substantial portions of the Software.
 *
 *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
 *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
 *     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.
 *
 *
 * License 2: Modified BSD
 *
 * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
 * All rights reserved.
 *
 * 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 Advanced Micro Devices, Inc. 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 <COPYRIGHT HOLDER> 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 incorporates work covered by the following copyright and
 * permission notice:
 *     The Synopsys DWC ETHER XGMAC Software Driver and documentation
 *     (hereinafter "Software") is an unsupported proprietary work of Synopsys,
 *     Inc. unless otherwise expressly agreed to in writing between Synopsys
 *     and you.
 *
 *     The Software IS NOT an item of Licensed Software or Licensed Product
 *     under any End User Software License Agreement or Agreement for Licensed
 *     Product with Synopsys or any supplement thereto.  Permission is hereby
 *     granted, free of charge, to any person obtaining a copy of this software
 *     annotated with this license and the Software, to deal in the Software
 *     without restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 *     of the Software, and to permit persons to whom the Software is furnished
 *     to do so, subject to the following conditions:
 *
 *     The above copyright notice and this permission notice shall be included
 *     in all copies or substantial portions of the Software.
 *
 *     THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
 *     BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 *     TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *     PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
 *     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.
 */

#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/tcp.h>
#include <linux/if_vlan.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/if_ether.h>
#include <linux/net_tstamp.h>
#include <linux/phy.h>
#include <net/vxlan.h>

#include "xgbe.h"
#include "xgbe-common.h"

static unsigned int ecc_sec_info_threshold =;
static unsigned int ecc_sec_warn_threshold =;
static unsigned int ecc_sec_period =;
static unsigned int ecc_ded_threshold =;
static unsigned int ecc_ded_period =;

#ifdef CONFIG_AMD_XGBE_HAVE_ECC
/* Only expose the ECC parameters if supported */
module_param(ecc_sec_info_threshold, uint, 0644);
MODULE_PARM_DESC();

module_param(ecc_sec_warn_threshold, uint, 0644);
MODULE_PARM_DESC();

module_param(ecc_sec_period, uint, 0644);
MODULE_PARM_DESC();

module_param(ecc_ded_threshold, uint, 0644);
MODULE_PARM_DESC();

module_param(ecc_ded_period, uint, 0644);
MODULE_PARM_DESC();
#endif

static int xgbe_one_poll(struct napi_struct *, int);
static int xgbe_all_poll(struct napi_struct *, int);
static void xgbe_stop(struct xgbe_prv_data *);

static void *xgbe_alloc_node(size_t size, int node)
{}

static void xgbe_free_channels(struct xgbe_prv_data *pdata)
{}

static int xgbe_alloc_channels(struct xgbe_prv_data *pdata)
{}

static inline unsigned int xgbe_tx_avail_desc(struct xgbe_ring *ring)
{}

static inline unsigned int xgbe_rx_dirty_desc(struct xgbe_ring *ring)
{}

static int xgbe_maybe_stop_tx_queue(struct xgbe_channel *channel,
				    struct xgbe_ring *ring, unsigned int count)
{}

static int xgbe_calc_rx_buf_size(struct net_device *netdev, unsigned int mtu)
{}

static void xgbe_enable_rx_tx_int(struct xgbe_prv_data *pdata,
				  struct xgbe_channel *channel)
{}

static void xgbe_enable_rx_tx_ints(struct xgbe_prv_data *pdata)
{}

static void xgbe_disable_rx_tx_int(struct xgbe_prv_data *pdata,
				   struct xgbe_channel *channel)
{}

static void xgbe_disable_rx_tx_ints(struct xgbe_prv_data *pdata)
{}

static bool xgbe_ecc_sec(struct xgbe_prv_data *pdata, unsigned long *period,
			 unsigned int *count, const char *area)
{}

static bool xgbe_ecc_ded(struct xgbe_prv_data *pdata, unsigned long *period,
			 unsigned int *count, const char *area)
{}

static void xgbe_ecc_isr_bh_work(struct work_struct *work)
{}

static irqreturn_t xgbe_ecc_isr(int irq, void *data)
{}

static void xgbe_isr_bh_work(struct work_struct *work)
{}

static irqreturn_t xgbe_isr(int irq, void *data)
{}

static irqreturn_t xgbe_dma_isr(int irq, void *data)
{}

static void xgbe_tx_timer(struct timer_list *t)
{}

static void xgbe_service(struct work_struct *work)
{}

static void xgbe_service_timer(struct timer_list *t)
{}

static void xgbe_init_timers(struct xgbe_prv_data *pdata)
{}

static void xgbe_start_timers(struct xgbe_prv_data *pdata)
{}

static void xgbe_stop_timers(struct xgbe_prv_data *pdata)
{}

void xgbe_get_all_hw_features(struct xgbe_prv_data *pdata)
{}

static int xgbe_vxlan_set_port(struct net_device *netdev, unsigned int table,
			       unsigned int entry, struct udp_tunnel_info *ti)
{}

static int xgbe_vxlan_unset_port(struct net_device *netdev, unsigned int table,
				 unsigned int entry, struct udp_tunnel_info *ti)
{}

static const struct udp_tunnel_nic_info xgbe_udp_tunnels =;

const struct udp_tunnel_nic_info *xgbe_get_udp_tunnel_info(void)
{}

static void xgbe_napi_enable(struct xgbe_prv_data *pdata, unsigned int add)
{}

static void xgbe_napi_disable(struct xgbe_prv_data *pdata, unsigned int del)
{}

static int xgbe_request_irqs(struct xgbe_prv_data *pdata)
{}

static void xgbe_free_irqs(struct xgbe_prv_data *pdata)
{}

void xgbe_init_tx_coalesce(struct xgbe_prv_data *pdata)
{}

void xgbe_init_rx_coalesce(struct xgbe_prv_data *pdata)
{}

static void xgbe_free_tx_data(struct xgbe_prv_data *pdata)
{}

static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)
{}

static int xgbe_phy_reset(struct xgbe_prv_data *pdata)
{}

int xgbe_powerdown(struct net_device *netdev, unsigned int caller)
{}

int xgbe_powerup(struct net_device *netdev, unsigned int caller)
{}

static void xgbe_free_memory(struct xgbe_prv_data *pdata)
{}

static int xgbe_alloc_memory(struct xgbe_prv_data *pdata)
{}

static int xgbe_start(struct xgbe_prv_data *pdata)
{}

static void xgbe_stop(struct xgbe_prv_data *pdata)
{}

static void xgbe_stopdev(struct work_struct *work)
{}

void xgbe_full_restart_dev(struct xgbe_prv_data *pdata)
{}

void xgbe_restart_dev(struct xgbe_prv_data *pdata)
{}

static void xgbe_restart(struct work_struct *work)
{}

static void xgbe_tx_tstamp(struct work_struct *work)
{}

static int xgbe_get_hwtstamp_settings(struct xgbe_prv_data *pdata,
				      struct ifreq *ifreq)
{}

static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
				      struct ifreq *ifreq)
{}

static void xgbe_prep_tx_tstamp(struct xgbe_prv_data *pdata,
				struct sk_buff *skb,
				struct xgbe_packet_data *packet)
{}

static void xgbe_prep_vlan(struct sk_buff *skb, struct xgbe_packet_data *packet)
{}

static int xgbe_prep_tso(struct sk_buff *skb, struct xgbe_packet_data *packet)
{}

static bool xgbe_is_vxlan(struct sk_buff *skb)
{}

static int xgbe_is_tso(struct sk_buff *skb)
{}

static void xgbe_packet_info(struct xgbe_prv_data *pdata,
			     struct xgbe_ring *ring, struct sk_buff *skb,
			     struct xgbe_packet_data *packet)
{}

static int xgbe_open(struct net_device *netdev)
{}

static int xgbe_close(struct net_device *netdev)
{}

static netdev_tx_t xgbe_xmit(struct sk_buff *skb, struct net_device *netdev)
{}

static void xgbe_set_rx_mode(struct net_device *netdev)
{}

static int xgbe_set_mac_address(struct net_device *netdev, void *addr)
{}

static int xgbe_ioctl(struct net_device *netdev, struct ifreq *ifreq, int cmd)
{}

static int xgbe_change_mtu(struct net_device *netdev, int mtu)
{}

static void xgbe_tx_timeout(struct net_device *netdev, unsigned int txqueue)
{}

static void xgbe_get_stats64(struct net_device *netdev,
			     struct rtnl_link_stats64 *s)
{}

static int xgbe_vlan_rx_add_vid(struct net_device *netdev, __be16 proto,
				u16 vid)
{}

static int xgbe_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto,
				 u16 vid)
{}

#ifdef CONFIG_NET_POLL_CONTROLLER
static void xgbe_poll_controller(struct net_device *netdev)
{}
#endif /* End CONFIG_NET_POLL_CONTROLLER */

static int xgbe_setup_tc(struct net_device *netdev, enum tc_setup_type type,
			 void *type_data)
{}

static netdev_features_t xgbe_fix_features(struct net_device *netdev,
					   netdev_features_t features)
{}

static int xgbe_set_features(struct net_device *netdev,
			     netdev_features_t features)
{}

static netdev_features_t xgbe_features_check(struct sk_buff *skb,
					     struct net_device *netdev,
					     netdev_features_t features)
{}

static const struct net_device_ops xgbe_netdev_ops =;

const struct net_device_ops *xgbe_get_netdev_ops(void)
{}

static void xgbe_rx_refresh(struct xgbe_channel *channel)
{}

static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
				       struct napi_struct *napi,
				       struct xgbe_ring_data *rdata,
				       unsigned int len)
{}

static unsigned int xgbe_rx_buf1_len(struct xgbe_ring_data *rdata,
				     struct xgbe_packet_data *packet)
{}

static unsigned int xgbe_rx_buf2_len(struct xgbe_ring_data *rdata,
				     struct xgbe_packet_data *packet,
				     unsigned int len)
{}

static int xgbe_tx_poll(struct xgbe_channel *channel)
{}

static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
{}

static int xgbe_one_poll(struct napi_struct *napi, int budget)
{}

static int xgbe_all_poll(struct napi_struct *napi, int budget)
{}

void xgbe_dump_tx_desc(struct xgbe_prv_data *pdata, struct xgbe_ring *ring,
		       unsigned int idx, unsigned int count, unsigned int flag)
{}

void xgbe_dump_rx_desc(struct xgbe_prv_data *pdata, struct xgbe_ring *ring,
		       unsigned int idx)
{}

void xgbe_print_pkt(struct net_device *netdev, struct sk_buff *skb, bool tx_rx)
{}