nvethernet: assign OSD ops

Bug 200620687

Change-Id: I9e0b9b87ba425b446b60576a1ddae938ff514a2f
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2483069
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Bhadram Varka
2021-02-10 20:33:38 +05:30
committed by Revanth Kumar Uppala
parent 34421635d5
commit b427be9267
3 changed files with 40 additions and 24 deletions

View File

@@ -4301,15 +4301,14 @@ static int ether_probe(struct platform_device *pdev)
goto err_parse_dt; goto err_parse_dt;
} }
ether_assign_osd_ops(osi_core, osi_dma);
/* Initialize core and DMA ops based on MAC type */ /* Initialize core and DMA ops based on MAC type */
if (osi_init_core_ops(osi_core) != 0) { if (osi_init_core_ops(osi_core) != 0) {
dev_err(&pdev->dev, "failed to get osi_init_core_ops\n"); dev_err(&pdev->dev, "failed to get osi_init_core_ops\n");
goto err_core_ops; goto err_core_ops;
} }
/* Define re-allocation routine */
osi_dma->osd_ops.realloc_buf = osd_realloc_buf;
if (osi_init_dma_ops(osi_dma) != 0) { if (osi_init_dma_ops(osi_dma) != 0) {
dev_err(&pdev->dev, "failed to get osi_init_dma_ops\n"); dev_err(&pdev->dev, "failed to get osi_init_dma_ops\n");
goto err_dma_ops; goto err_dma_ops;

View File

@@ -484,16 +484,19 @@ static inline int ether_selftest_get_count(struct ether_priv_data *pdata)
#endif /* CONFIG_NVETHERNET_SELFTESTS */ #endif /* CONFIG_NVETHERNET_SELFTESTS */
/** /**
* @brief osd_realloc_buf - Allocate RX sk_buffer * @brief ether_assign_osd_ops - Assigns OSD ops for OSI
* *
* Algorithm: Call ether_realloc_rx_skb for re-allocation * @param[in] osi_core: OSI CORE data structure
* * @param[in] osi_dma: OSI DMA data structure.
* @param[in] priv: OSD private data structure.
* @param[in] rxring: Pointer to DMA channel Rx ring.
* @param[in] chan: DMA Rx channel number.
* *
* @note
* API Group:
* - Initialization: Yes
* - Run time: No
* - De-initialization: No
*/ */
void osd_realloc_buf(void *priv, void *rxring, unsigned int chan); void ether_assign_osd_ops(struct osi_core_priv_data *osi_core,
struct osi_dma_priv_data *osi_dma);
/** /**
* @brief osd_send_cmd - OSD ivc send cmd * @brief osd_send_cmd - OSD ivc send cmd

View File

@@ -15,7 +15,6 @@
*/ */
#include "ether_linux.h" #include "ether_linux.h"
#include <osd.h>
#include <ivc_core.h> #include <ivc_core.h>
#define IVC_WAIT_TIMEOUT (msecs_to_jiffies(1000)) #define IVC_WAIT_TIMEOUT (msecs_to_jiffies(1000))
@@ -27,7 +26,7 @@
* *
* @param[in] usec: Delay number in micro seconds. * @param[in] usec: Delay number in micro seconds.
*/ */
void osd_udelay(unsigned long usec) static void osd_udelay(unsigned long usec)
{ {
udelay(usec); udelay(usec);
} }
@@ -40,7 +39,7 @@ void osd_udelay(unsigned long usec)
* @param[in] umin: Minimum sleep required in micro seconds. * @param[in] umin: Minimum sleep required in micro seconds.
* @param[in] umax: Maximum sleep required in micro seconds. * @param[in] umax: Maximum sleep required in micro seconds.
*/ */
void osd_usleep_range(unsigned long umin, unsigned long umax) static void osd_usleep_range(unsigned long umin, unsigned long umax)
{ {
usleep_range(umin, umax); usleep_range(umin, umax);
} }
@@ -52,7 +51,7 @@ void osd_usleep_range(unsigned long umin, unsigned long umax)
* *
* @param[in] msec: Minimum sleep required in milli seconds. * @param[in] msec: Minimum sleep required in milli seconds.
*/ */
void osd_msleep(unsigned int msec) static void osd_msleep(unsigned int msec)
{ {
msleep(msec); msleep(msec);
} }
@@ -69,7 +68,7 @@ void osd_msleep(unsigned int msec)
* @param[in] loga: error additional information * @param[in] loga: error additional information
* *
*/ */
void osd_log(void *priv, static void osd_log(void *priv,
const char *func, const char *func,
unsigned int line, unsigned int line,
unsigned int level, unsigned int level,
@@ -229,7 +228,7 @@ static void ether_realloc_rx_skb(struct ether_priv_data *pdata,
* @param[in] chan: DMA Rx channel number. * @param[in] chan: DMA Rx channel number.
* *
*/ */
void osd_realloc_buf(void *priv, void *rxring, unsigned int chan) static void osd_realloc_buf(void *priv, void *rxring, unsigned int chan)
{ {
struct ether_priv_data *pdata = (struct ether_priv_data *)priv; struct ether_priv_data *pdata = (struct ether_priv_data *)priv;
struct osi_rx_ring *rx_ring = (struct osi_rx_ring *)rxring; struct osi_rx_ring *rx_ring = (struct osi_rx_ring *)rxring;
@@ -346,7 +345,7 @@ void osd_receive_packet(void *priv, void *rxring, unsigned int chan,
* *
* @note Tx completion need to make sure that Tx descriptors processed properly. * @note Tx completion need to make sure that Tx descriptors processed properly.
*/ */
void osd_transmit_complete(void *priv, void *buffer, unsigned long dmaaddr, static void osd_transmit_complete(void *priv, void *buffer, unsigned long dmaaddr,
unsigned int len, void *tx_done_pkt_cx) unsigned int len, void *tx_done_pkt_cx)
{ {
struct osi_txdone_pkt_cx *txdone_pkt_cx = (struct osi_txdone_pkt_cx *) struct osi_txdone_pkt_cx *txdone_pkt_cx = (struct osi_txdone_pkt_cx *)
@@ -402,6 +401,21 @@ void osd_transmit_complete(void *priv, void *buffer, unsigned long dmaaddr,
} }
} }
void ether_assign_osd_ops(struct osi_core_priv_data *osi_core,
struct osi_dma_priv_data *osi_dma)
{
osi_core->osd_ops.ops_log = osd_log;
osi_core->osd_ops.udelay = osd_udelay;
osi_core->osd_ops.usleep_range = osd_usleep_range;
osi_core->osd_ops.msleep = osd_msleep;
osi_dma->osd_ops.transmit_complete = osd_transmit_complete;
osi_dma->osd_ops.receive_packet = osd_receive_packet;
osi_dma->osd_ops.realloc_buf = osd_realloc_buf;
osi_dma->osd_ops.ops_log = osd_log;
osi_dma->osd_ops.udelay = osd_udelay;
}
/** /**
* @brief osd_send_cmd - OSD ivc send cmd * @brief osd_send_cmd - OSD ivc send cmd
* *