xref: /linux/drivers/net/ethernet/sfc/ef100_tx.c (revision b8265621f4888af9494e1d685620871ec81bc33d)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /****************************************************************************
3  * Driver for Solarflare network controllers and boards
4  * Copyright 2018 Solarflare Communications Inc.
5  * Copyright 2019-2020 Xilinx Inc.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License version 2 as published
9  * by the Free Software Foundation, incorporated herein by reference.
10  */
11 
12 #include "net_driver.h"
13 #include "tx_common.h"
14 #include "nic_common.h"
15 #include "ef100_tx.h"
16 
17 /* TX queue stubs */
18 int ef100_tx_probe(struct efx_tx_queue *tx_queue)
19 {
20 	return 0;
21 }
22 
23 void ef100_tx_init(struct efx_tx_queue *tx_queue)
24 {
25 	/* must be the inverse of lookup in efx_get_tx_channel */
26 	tx_queue->core_txq =
27 		netdev_get_tx_queue(tx_queue->efx->net_dev,
28 				    tx_queue->channel->channel -
29 				    tx_queue->efx->tx_channel_offset);
30 }
31 
32 void ef100_tx_write(struct efx_tx_queue *tx_queue)
33 {
34 }
35 
36 /* Add a socket buffer to a TX queue
37  *
38  * You must hold netif_tx_lock() to call this function.
39  *
40  * Returns 0 on success, error code otherwise. In case of an error this
41  * function will free the SKB.
42  */
43 int ef100_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
44 {
45 	/* Stub.  No TX path yet. */
46 	struct efx_nic *efx = tx_queue->efx;
47 
48 	netif_stop_queue(efx->net_dev);
49 	dev_kfree_skb_any(skb);
50 	return -ENODEV;
51 }
52