summaryrefslogtreecommitdiff
path: root/drivers/staging/octeon/ethernet-tx.h
blob: c0bebf750bc059acc8d4a8a52b4ab3451e81250d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*********************************************************************
 * Author: Cavium Networks
 *
 * Contact: support@caviumnetworks.com
 * This file is part of the OCTEON SDK
 *
 * Copyright (c) 2003-2007 Cavium Networks
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, Version 2, as
 * published by the Free Software Foundation.
 *
 * This file is distributed in the hope that it will be useful, but
 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
 * NONINFRINGEMENT.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this file; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 * or visit http://www.gnu.org/licenses/.
 *
 * This file may also be available under a different license from Cavium.
 * Contact Cavium Networks for more information
*********************************************************************/

int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
			 int do_free, int qos);
void cvm_oct_tx_shutdown(struct net_device *dev);

/**
 * Free dead transmit skbs.
 *
 * @priv:		The driver data
 * @skb_to_free:	The number of SKBs to free (free none if negative).
 * @qos:		The queue to free from.
 * @take_lock:		If true, acquire the skb list lock.
 */
static inline void cvm_oct_free_tx_skbs(struct octeon_ethernet *priv,
					int skb_to_free,
					int qos, int take_lock)
{
	/* Free skbuffs not in use by the hardware.  */
	if (skb_to_free > 0) {
		if (take_lock)
			spin_lock(&priv->tx_free_list[qos].lock);
		while (skb_to_free > 0) {
			dev_kfree_skb(__skb_dequeue(&priv->tx_free_list[qos]));
			skb_to_free--;
		}
		if (take_lock)
			spin_unlock(&priv->tx_free_list[qos].lock);
	}
}