// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause /* Packet transmit logic for Mellanox Gigabit Ethernet driver * * Copyright (C) 2020-2021 NVIDIA CORPORATION & AFFILIATES */ #include <linux/skbuff.h> #include "mlxbf_gige.h" #include "mlxbf_gige_regs.h" /* Transmit Initialization * 1) Allocates TX WQE array using coherent DMA mapping * 2) Allocates TX completion counter using coherent DMA mapping */ int mlxbf_gige_tx_init(struct mlxbf_gige *priv) { … } /* Transmit Deinitialization * This routine will free allocations done by mlxbf_gige_tx_init(), * namely the TX WQE array and the TX completion counter */ void mlxbf_gige_tx_deinit(struct mlxbf_gige *priv) { … } /* Function that returns status of TX ring: * 0: TX ring is full, i.e. there are no * available un-used entries in TX ring. * non-null: TX ring is not full, i.e. there are * some available entries in TX ring. * The non-null value is a measure of * how many TX entries are available, but * it is not the exact number of available * entries (see below). * * The algorithm makes the assumption that if * (prev_tx_ci == tx_pi) then the TX ring is empty. * An empty ring actually has (tx_q_entries-1) * entries, which allows the algorithm to differentiate * the case of an empty ring vs. a full ring. */ static u16 mlxbf_gige_tx_buffs_avail(struct mlxbf_gige *priv) { … } bool mlxbf_gige_handle_tx_complete(struct mlxbf_gige *priv) { … } /* Function to advance the tx_wqe_next pointer to next TX WQE */ void mlxbf_gige_update_tx_wqe_next(struct mlxbf_gige *priv) { … } netdev_tx_t mlxbf_gige_start_xmit(struct sk_buff *skb, struct net_device *netdev) { … }