// SPDX-License-Identifier: GPL-2.0 /* Marvell Octeon EP (EndPoint) VF Ethernet Driver * * Copyright (C) 2020 Marvell. * */ #include <linux/pci.h> #include <linux/etherdevice.h> #include <linux/vmalloc.h> #include "octep_vf_config.h" #include "octep_vf_main.h" static void octep_vf_oq_reset_indices(struct octep_vf_oq *oq) { … } /** * octep_vf_oq_fill_ring_buffers() - fill initial receive buffers for Rx ring. * * @oq: Octeon Rx queue data structure. * * Return: 0, if successfully filled receive buffers for all descriptors. * -ENOMEM, if failed to allocate a buffer or failed to map for DMA. */ static int octep_vf_oq_fill_ring_buffers(struct octep_vf_oq *oq) { … } /** * octep_vf_oq_refill() - refill buffers for used Rx ring descriptors. * * @oct: Octeon device private data structure. * @oq: Octeon Rx queue data structure. * * Return: number of descriptors successfully refilled with receive buffers. */ static int octep_vf_oq_refill(struct octep_vf_device *oct, struct octep_vf_oq *oq) { … } /** * octep_vf_setup_oq() - Setup a Rx queue. * * @oct: Octeon device private data structure. * @q_no: Rx queue number to be setup. * * Allocate resources for a Rx queue. */ static int octep_vf_setup_oq(struct octep_vf_device *oct, int q_no) { … } /** * octep_vf_oq_free_ring_buffers() - Free ring buffers. * * @oq: Octeon Rx queue data structure. * * Free receive buffers in unused Rx queue descriptors. */ static void octep_vf_oq_free_ring_buffers(struct octep_vf_oq *oq) { … } /** * octep_vf_free_oq() - Free Rx queue resources. * * @oq: Octeon Rx queue data structure. * * Free all resources of a Rx queue. */ static int octep_vf_free_oq(struct octep_vf_oq *oq) { … } /** * octep_vf_setup_oqs() - setup resources for all Rx queues. * * @oct: Octeon device private data structure. */ int octep_vf_setup_oqs(struct octep_vf_device *oct) { … } /** * octep_vf_oq_dbell_init() - Initialize Rx queue doorbell. * * @oct: Octeon device private data structure. * * Write number of descriptors to Rx queue doorbell register. */ void octep_vf_oq_dbell_init(struct octep_vf_device *oct) { … } /** * octep_vf_free_oqs() - Free resources of all Rx queues. * * @oct: Octeon device private data structure. */ void octep_vf_free_oqs(struct octep_vf_device *oct) { … } /** * octep_vf_oq_check_hw_for_pkts() - Check for new Rx packets. * * @oct: Octeon device private data structure. * @oq: Octeon Rx queue data structure. * * Return: packets received after previous check. */ static int octep_vf_oq_check_hw_for_pkts(struct octep_vf_device *oct, struct octep_vf_oq *oq) { … } /** * __octep_vf_oq_process_rx() - Process hardware Rx queue and push to stack. * * @oct: Octeon device private data structure. * @oq: Octeon Rx queue data structure. * @pkts_to_process: number of packets to be processed. * * Process the new packets in Rx queue. * Packets larger than single Rx buffer arrive in consecutive descriptors. * But, count returned by the API only accounts full packets, not fragments. * * Return: number of packets processed and pushed to stack. */ static int __octep_vf_oq_process_rx(struct octep_vf_device *oct, struct octep_vf_oq *oq, u16 pkts_to_process) { … } /** * octep_vf_oq_process_rx() - Process Rx queue. * * @oq: Octeon Rx queue data structure. * @budget: max number of packets can be processed in one invocation. * * Check for newly received packets and process them. * Keeps checking for new packets until budget is used or no new packets seen. * * Return: number of packets processed. */ int octep_vf_oq_process_rx(struct octep_vf_oq *oq, int budget) { … }