linux/drivers/staging/octeon/octeon-ethernet.h
<<
>>
Prefs
   1/**********************************************************************
   2 * Author: Cavium Networks
   3 *
   4 * Contact: support@caviumnetworks.com
   5 * This file is part of the OCTEON SDK
   6 *
   7 * Copyright (c) 2003-2007 Cavium Networks
   8 *
   9 * This file is free software; you can redistribute it and/or modify
  10 * it under the terms of the GNU General Public License, Version 2, as
  11 * published by the Free Software Foundation.
  12 *
  13 * This file is distributed in the hope that it will be useful, but
  14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16 * NONINFRINGEMENT.  See the GNU General Public License for more
  17 * details.
  18 *
  19 * You should have received a copy of the GNU General Public License
  20 * along with this file; if not, write to the Free Software
  21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22 * or visit http://www.gnu.org/licenses/.
  23 *
  24 * This file may also be available under a different license from Cavium.
  25 * Contact Cavium Networks for more information
  26**********************************************************************/
  27
  28/*
  29 * External interface for the Cavium Octeon ethernet driver.
  30 */
  31#ifndef OCTEON_ETHERNET_H
  32#define OCTEON_ETHERNET_H
  33
  34/**
  35 * This is the definition of the Ethernet driver's private
  36 * driver state stored in netdev_priv(dev).
  37 */
  38struct octeon_ethernet {
  39        /* PKO hardware output port */
  40        int port;
  41        /* PKO hardware queue for the port */
  42        int queue;
  43        /* Hardware fetch and add to count outstanding tx buffers */
  44        int fau;
  45        /*
  46         * Type of port. This is one of the enums in
  47         * cvmx_helper_interface_mode_t
  48         */
  49        int imode;
  50        /* List of outstanding tx buffers per queue */
  51        struct sk_buff_head tx_free_list[16];
  52        /* Device statistics */
  53        struct net_device_stats stats
  54;       /* Generic MII info structure */
  55        struct mii_if_info mii_info;
  56        /* Last negotiated link state */
  57        uint64_t link_info;
  58        /* Called periodically to check link status */
  59        void (*poll) (struct net_device *dev);
  60};
  61
  62/**
  63 * Free a work queue entry received in a intercept callback.
  64 *
  65 * @work_queue_entry:
  66 *               Work queue entry to free
  67 * Returns Zero on success, Negative on failure.
  68 */
  69int cvm_oct_free_work(void *work_queue_entry);
  70
  71/**
  72 * Transmit a work queue entry out of the ethernet port. Both
  73 * the work queue entry and the packet data can optionally be
  74 * freed. The work will be freed on error as well.
  75 *
  76 * @dev:     Device to transmit out.
  77 * @work_queue_entry:
  78 *                Work queue entry to send
  79 * @do_free: True if the work queue entry and packet data should be
  80 *                freed. If false, neither will be freed.
  81 * @qos:     Index into the queues for this port to transmit on. This
  82 *                is used to implement QoS if their are multiple queues per
  83 *                port. This parameter must be between 0 and the number of
  84 *                queues per port minus 1. Values outside of this range will
  85 *                be change to zero.
  86 *
  87 * Returns Zero on success, negative on failure.
  88 */
  89int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
  90                         int do_free, int qos);
  91
  92/**
  93 * Transmit a work queue entry out of the ethernet port. Both
  94 * the work queue entry and the packet data can optionally be
  95 * freed. The work will be freed on error as well. This simply
  96 * wraps cvmx_oct_transmit_qos() for backwards compatability.
  97 *
  98 * @dev:     Device to transmit out.
  99 * @work_queue_entry:
 100 *                Work queue entry to send
 101 * @do_free: True if the work queue entry and packet data should be
 102 *                freed. If false, neither will be freed.
 103 *
 104 * Returns Zero on success, negative on failure.
 105 */
 106static inline int cvm_oct_transmit(struct net_device *dev,
 107                                   void *work_queue_entry, int do_free)
 108{
 109        return cvm_oct_transmit_qos(dev, work_queue_entry, do_free, 0);
 110}
 111
 112extern int cvm_oct_rgmii_init(struct net_device *dev);
 113extern void cvm_oct_rgmii_uninit(struct net_device *dev);
 114extern int cvm_oct_rgmii_open(struct net_device *dev);
 115extern int cvm_oct_rgmii_stop(struct net_device *dev);
 116
 117extern int cvm_oct_sgmii_init(struct net_device *dev);
 118extern void cvm_oct_sgmii_uninit(struct net_device *dev);
 119extern int cvm_oct_sgmii_open(struct net_device *dev);
 120extern int cvm_oct_sgmii_stop(struct net_device *dev);
 121
 122extern int cvm_oct_spi_init(struct net_device *dev);
 123extern void cvm_oct_spi_uninit(struct net_device *dev);
 124extern int cvm_oct_xaui_init(struct net_device *dev);
 125extern void cvm_oct_xaui_uninit(struct net_device *dev);
 126extern int cvm_oct_xaui_open(struct net_device *dev);
 127extern int cvm_oct_xaui_stop(struct net_device *dev);
 128
 129extern int cvm_oct_common_init(struct net_device *dev);
 130extern void cvm_oct_common_uninit(struct net_device *dev);
 131
 132extern int always_use_pow;
 133extern int pow_send_group;
 134extern int pow_receive_group;
 135extern char pow_send_list[];
 136extern struct net_device *cvm_oct_device[];
 137
 138#endif
 139