mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-24 18:42:16 +03:00
Updated osd_transmit_complete, osd_receive_packet algorithm documentation Bug 200574645 Bug 2855341 Bug 200598869 Change-Id: I1ab0f21cc39b39bf755b4ea19703b2875279c77a Signed-off-by: Praveen Mallaiah <pmallaiah@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2320522 (cherry picked from commit 50490d3bfc12089a3e1ee2d82d9c6729b9b5d853) Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2317409 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Sandeep Trasi <strasi@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
110 lines
4.1 KiB
C
110 lines
4.1 KiB
C
/*
|
|
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
* DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef OSD_H
|
|
#define OSD_H
|
|
|
|
/**
|
|
* @brief osd_usleep_range - sleep in micro seconds
|
|
*
|
|
* @param[in] umin: Minimum time in usecs to sleep
|
|
* @param[in] umax: Maximum time in usecs to sleep
|
|
*/
|
|
void osd_usleep_range(unsigned long umin, unsigned long umax);
|
|
/**
|
|
* @brief osd_msleep - sleep in milli seconds
|
|
*
|
|
* @param[in] msec: time in milli seconds
|
|
*/
|
|
void osd_msleep(unsigned int msec);
|
|
/**
|
|
* @brief osd_udelay - delay in micro seconds
|
|
*
|
|
* @param[in] usec: time in usec
|
|
*/
|
|
void osd_udelay(unsigned long usec);
|
|
/**
|
|
* @brief osd_receive_packet - Handover received packet to network stack.
|
|
*
|
|
* Algorithm:
|
|
* 1) Unmap the DMA buffer address (not needed if buffers are allocated statically).
|
|
* 2) Refill the Rx ring based on threshold.
|
|
* 3) Consume the flag information and take decision to hand over the packet and related information to OS network stack.
|
|
*
|
|
* @param[in] priv: OSD private data structure.
|
|
* @param[in] rxring: Pointer to DMA channel Rx ring.
|
|
* @param[in] chan: DMA Rx channel number.
|
|
* @param[in] dma_buf_len: Rx DMA buffer length.
|
|
* @param[in] rxpkt_cx: Received packet context.
|
|
* @param[in] rx_pkt_swcx: Received packet sw context.
|
|
*
|
|
* @note Rx completion need to make sure that Rx descriptors processed properly.
|
|
*/
|
|
void osd_receive_packet(void *priv, void *rxring, unsigned int chan,
|
|
unsigned int dma_buf_len, void *rxpkt_cx,
|
|
void *rx_pkt_swcx);
|
|
|
|
/**
|
|
* @brief osd_transmit_complete - Transmit completion routine.
|
|
*
|
|
* Algorithm:
|
|
* 1) Unmap and free the buffer DMA address and buffer (not needed if buffers are allocated statically).
|
|
* 2) Time stamp will be updated to stack if available.
|
|
*
|
|
* @param[in] priv: OSD private data structure.
|
|
* @param[in] buffer: Buffer address to free.
|
|
* @param[in] dmaaddr: DMA address to unmap.
|
|
* @param[in] len: Length of data.
|
|
* @param[in] txdone_pkt_cx: Pointer to struct which has tx done status info.
|
|
* This struct has flags to indicate tx error, whether DMA address
|
|
* is mapped from paged/linear buffer, Time stamp availability,
|
|
* if TS available txdone_pkt_cx->ns stores the time stamp.
|
|
* Below are the valid bit maps set for txdone_pkt_cx->flags
|
|
* OSI_TXDONE_CX_PAGED_BUF OSI_BIT(0)
|
|
* OSI_TXDONE_CX_ERROR OSI_BIT(1)
|
|
* OSI_TXDONE_CX_TS OSI_BIT(2)
|
|
*
|
|
* @note Tx completion need to make sure that Tx descriptors processed properly.
|
|
*/
|
|
void osd_transmit_complete(void *priv, void *buffer, unsigned long dmaaddr,
|
|
unsigned int len, void *txdone_pkt_cx);
|
|
/**
|
|
* @brief osd_log - OSD logging function
|
|
*
|
|
* @param[in] priv: OSD private data
|
|
* @param[in] func: function name
|
|
* @param[in] line: line number
|
|
* @param[in] level: log level
|
|
* @param[in] type: error type
|
|
* @param[in] err: error string
|
|
* @param[in] loga: error additional information
|
|
*
|
|
*/
|
|
void osd_log(void *priv,
|
|
const char *func,
|
|
unsigned int line,
|
|
unsigned int level,
|
|
unsigned int type,
|
|
const char *err,
|
|
unsigned long long loga);
|
|
#endif
|