nvethernet: Add NvEthernetLinux ICD support

Add NvEthernetLinux Doxygen comments support
by documenting platform_driver,
net_device_ops, and ioctl command data.

Jira NET-2168

Change-Id: Ia8140290e4f01c00b6a5d310d8d64a8e0eb3b29c
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3291517
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
This commit is contained in:
Mohan Thadikamalla
2025-01-27 11:37:58 +00:00
committed by Jon Hunter
parent 4f98504989
commit 524e20def3
9 changed files with 2286 additions and 675 deletions

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ /* Copyright (c) 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved */
#ifndef ETHER_EXPORT_H #ifndef ETHER_EXPORT_H
#define ETHER_EXPORT_H #define ETHER_EXPORT_H
@@ -13,35 +13,139 @@
* SIOCDEVPRIVATE custom ioctl command. * SIOCDEVPRIVATE custom ioctl command.
* @{ * @{
*/ */
/** To set HW AVB configuration from user application */ /** Net device private IOCTL number for time stamp */
#define ETHER_PRV_TS_IOCTL (SIOCDEVPRIVATE + 1)
/** Private IOCTL number for reading MDIO in the network device. */
#define ETHER_PRV_RMDIO_IOCTL (SIOCDEVPRIVATE + 2)
/** Private IOCTL number for writing MDIO in the network device. */
#define ETHER_PRV_WMDIO_IOCTL (SIOCDEVPRIVATE + 3)
/** Get Line speed */
#define EQOS_GET_CONNECTED_SPEED 25
/** Set HW AVB configuration from user application */
#define ETHER_AVB_ALGORITHM 27 #define ETHER_AVB_ALGORITHM 27
/** To get current configuration in HW */ /** Set L3/L4 filter */
#define EQOS_L3L4_FILTER_CMD 29
/** Set VLAN filter */
#define EQOS_VLAN_FILTERING_CMD 34
/** Configure ARP offload enable/disable */
#define ETHER_CONFIG_ARP_OFFLOAD 36
/** Configure PTP offload enable/disable */
#define ETHER_CONFIG_PTP_OFFLOAD 42
/** Get current configuration in HW */
#define ETHER_GET_AVB_ALGORITHM 46 #define ETHER_GET_AVB_ALGORITHM 46
/** To configure EST(802.1 bv) in HW */ /** Set PTP RxQ in HW */
#define ETHER_PTP_RXQUEUE 48
/** Configure EST(802.1 bv) in HW */
#define ETHER_CONFIG_EST 49 #define ETHER_CONFIG_EST 49
/** For configure FPE (802.1 bu + 803.2 br) in HW */ /** Configure FPE (802.1 bu + 803.2 br) in HW */
#define ETHER_CONFIG_FPE 50 #define ETHER_CONFIG_FPE 50
/* FRP command */ /** Configure FRP rule in HW */
#define ETHER_CONFIG_FRP_CMD 51 #define ETHER_CONFIG_FRP_CMD 51
/** To configure L2 Filter (Only with Ethernet virtualization) */ /** Configure the DMA channel number to route multicast packets in HW */
#define ETHER_MC_DMA_ROUTE 52
/** Configure the PAD calibration in HW */
#define ETHER_PAD_CALIBRATION 55
/** Configure the TSC PTP in HW */
#define ETHER_CAP_TSC_PTP 58
/** Configure the MAC 2 MAC TS sync in HW */
#define ETHER_M2M_TSYNC 59
/** Configure L2 Filter (Only with Ethernet virtualization) */
#define ETHER_L2_ADDR 61 #define ETHER_L2_ADDR 61
/** @} */ /** @} */
/** /**
* @brief Structure for L2 filters input *@addtogroup IOCTL Helper MACROS
* @{
*/
#define NUM_BYTES_IN_IPADDR 4
/* PTP offload mode defines */
/** PTP Ordinary Slave Mode */
#define ETHER_PTP_ORDINARY_SLAVE 1
/** PTP Ordinary Master Mode */
#define ETHER_PTP_ORDINARY_MASTER 2
/** PTP Transparent Slave Mode */
#define ETHER_PTP_TRASPARENT_SLAVE 3
/** PTP Transparent Master Mode */
#define ETHER_PTP_TRASPARENT_MASTER 4
/** PTP Transparent Peer Mode */
#define ETHER_PTP_PEER_TO_PEER_TRANSPARENT 5
/** @} */
/**
* @brief struct to support APR offload
* NVETHERNET_LINUX_PIF$ETHER_CONFIG_ARP_OFFLOAD command
*/
struct arp_offload_param {
/**
* ip_addr: Byte array for decimal representation of IP address.
* - For example, 192.168.1.3 is represented as
* ip_addr[0] = '192' ip_addr[1] = '168' ip_addr[2] = '1'
* ip_addr[3] = '3'
*/
unsigned char ip_addr[NUM_BYTES_IN_IPADDR];
};
/**
* @brief struct to support PTP offload
* NVETHERNET_LINUX_PIF$ETHER_CONFIG_PTP_OFFLOAD command
*/
struct ptp_offload_param {
/** indicates PTP offload status
* - Valid values are enable(1) or disable(0) */
int en_dis;
/** indicates PTP mode
* - Valid values:
* - NVETHERNET_LINUX_PIF$ETHER_PTP_ORDINARY_MASTER
* - NVETHERNET_LINUX_PIF$ETHER_PTP_ORDINARY_SLAVE
* - NVETHERNET_LINUX_PIF$ETHER_PTP_TRASPARENT_MASTER
* - NVETHERNET_LINUX_PIF$ETHER_PTP_TRASPARENT_SLAVE
* - NVETHERNET_LINUX_PIF$ETHER_PTP_PEER_TO_PEER_TRANSPARENT */
int mode;
/** ptp domain
* - Valid values: 0 to 0xFF */
int domain_num;
/** The PTP Offload function qualifies received PTP
* packet with unicast Destination address
* - Valid values:
* - 0 for only multicast
* - 1 for unicast and multicast */
int mc_uc;
};
/**
* @brief struct ifr_data_timestamp_struct - common data structure between
* driver and application for sharing info through private TS ioctl
*/
struct ifr_data_timestamp_struct {
/** Clock ID
* - Expected values are CLOCK_REALTIME or CLOCK_MONOTONIC */
clockid_t clockid;
/** Store kernel time */
struct timespec64 kernel_ts;
/** Store HW time */
struct timespec64 hw_ptp_ts;
};
/**
* @brief Structure for L2 filters NVETHERNET_LINUX_PIF$ETHER_L2_ADDR command
*/ */
struct ether_l2_filter { struct ether_l2_filter {
/** indicates enable(1)/disable(0) L2 filter */ /** indicates L2 filter status
* - Expected values are enable(1) or disable(0) */
nveu32_t en_dis; nveu32_t en_dis;
/** Indicates the index of the filter to be modified. /** Indicates the index of the filter to be modified.
* Filter index must be between 0 - 31 */ * - Filter index must be between 0 - 127 */
nveu32_t index; nveu32_t index;
/** Ethernet MAC address to be added */ /** Ethernet MAC address to be added */
nveu8_t mac_addr[OSI_ETH_ALEN]; nveu8_t mac_addr[OSI_ETH_ALEN];
/** packet duplication */ /** Packet duplication support
* - Expected values are enable(1) or disable(0) */
nveu32_t pkt_dup; nveu32_t pkt_dup;
/** dma channel */ /** dma channel number, values are:
* - from 0 to NVETHERNETRM_PIF$OSI_EQOS_MAX_NUM_CHANS for EQOS
* - from 0 to NVETHERNETRM_PIF$OSI_MGBE_MAX_NUM_CHANS for MGBE */
nveu32_t dma_chan; nveu32_t dma_chan;
}; };
@@ -49,17 +153,43 @@ struct ether_l2_filter {
* @brief struct ether_exported_ifr_data - Private data of struct ifreq * @brief struct ether_exported_ifr_data - Private data of struct ifreq
*/ */
struct ether_exported_ifr_data { struct ether_exported_ifr_data {
/** Flags used for specific ioctl - like enable/disable */ /** Flags used for specific ioctl
* - Expected values are enable(1) or disable(0) */
nveu32_t if_flags; nveu32_t if_flags;
/** qinx: Queue index to be used for certain ioctls */ /** qinx: Queue index to be used for certain ioctls
* - Valid range:
* - 0 to NVETHERNETRM_PIF$OSI_MGBE_MAX_NUM_QUEUES for MGBE
* - 0 to NVETHERNETRM_PIF$OSI_EQOS_MAX_NUM_QUEUES for EQOS */
nveu32_t qinx; nveu32_t qinx;
/** The private ioctl command number */ /** The private ioctl command number
* - Valid range: should be defined in private IOCTL group
* - Expected values:
* - NVETHERNET_LINUX_PIF$EQOS_GET_CONNECTED_SPEED
* - NVETHERNET_LINUX_PIF$ETHER_AVB_ALGORITHM
* - NVETHERNET_LINUX_PIF$EQOS_L3L4_FILTER_CMD
* - NVETHERNET_LINUX_PIF$EQOS_VLAN_FILTERING_CMD
* - NVETHERNET_LINUX_PIF$ETHER_CONFIG_ARP_OFFLOAD
* - NVETHERNET_LINUX_PIF$ETHER_CONFIG_PTP_OFFLOAD
* - NVETHERNET_LINUX_PIF$ETHER_GET_AVB_ALGORITHM
* - NVETHERNET_LINUX_PIF$ETHER_PTP_RXQUEUE
* - NVETHERNET_LINUX_PIF$ETHER_CONFIG_EST
* - NVETHERNET_LINUX_PIF$ETHER_CONFIG_FPE
* - NVETHERNET_LINUX_PIF$ETHER_CONFIG_FRP_CMD
* - NVETHERNET_LINUX_PIF$ETHER_MC_DMA_ROUTE
* - NVETHERNET_LINUX_PIF$ETHER_PAD_CALIBRATION
* - NVETHERNET_LINUX_PIF$ETHER_CAP_TSC_PTP
* - NVETHERNET_LINUX_PIF$ETHER_M2M_TSYNC
* - NVETHERNET_LINUX_PIF$ETHER_L2_ADDR */
nveu32_t ifcmd; nveu32_t ifcmd;
/** Used to query the connected link speed */ /** Used to query the connected phy link speed
*/
nveu32_t connected_speed; nveu32_t connected_speed;
/** The return value of IOCTL handler func */ /** The return value of IOCTL handler func
* - Expected values: Linux Error codes */
nve32_t command_error; nve32_t command_error;
/** IOCTL cmd specific structure pointer */ /** IOCTL cmd specific structure pointer
* - Valid range: A valid pointer to the IOCTL private structure data */
void *ptr; void *ptr;
}; };
#endif /* ETHER_EXPORT_H */ #endif /* ETHER_EXPORT_H */

View File

@@ -142,18 +142,7 @@ update_skb:
return ret; return ret;
} }
/** void ether_get_tx_ts_work(struct work_struct *work)
* @brief Gets timestamp and update skb
*
* Algorithm:
* - Parse through tx_ts_skb_head.
* - Issue osi_handle_ioctl(OSI_CMD_GET_TX_TS) to read timestamp.
* - Update skb with timestamp and give to network stack
* - Free skb and node.
*
* @param[in] work: Work to handle SKB list update
*/
static void ether_get_tx_ts_work(struct work_struct *work)
{ {
struct delayed_work *dwork = to_delayed_work(work); struct delayed_work *dwork = to_delayed_work(work);
struct ether_priv_data *pdata = container_of(dwork, struct ether_priv_data *pdata = container_of(dwork,
@@ -259,17 +248,7 @@ static irqreturn_t ether_common_isr_thread(int irq, void *data)
} }
#endif #endif
/** void ether_stats_work_func(struct work_struct *work)
* @brief Work Queue function to call osi_read_mmc() periodically.
*
* Algorithm: call osi_read_mmc in periodic manner to avoid possibility of
* overrun of 32 bit MMC hw registers.
*
* @param[in] work: work structure
*
* @note MAC and PHY need to be initialized.
*/
static inline void ether_stats_work_func(struct work_struct *work)
{ {
struct delayed_work *dwork = to_delayed_work(work); struct delayed_work *dwork = to_delayed_work(work);
struct ether_priv_data *pdata = container_of(dwork, struct ether_priv_data *pdata = container_of(dwork,
@@ -1229,13 +1208,7 @@ static inline void ether_set_eqos_tx_clk(struct clk *tx_clk,
pr_err("%s(): failed to set eqos tx_clk/mac rate\n", __func__); pr_err("%s(): failed to set eqos tx_clk/mac rate\n", __func__);
} }
/** void set_speed_work_func(struct work_struct *work)
* @brief Work Queue function to call set speed.
*
* @param[in] work: work structure
*
*/
static inline void set_speed_work_func(struct work_struct *work)
{ {
struct delayed_work *dwork = to_delayed_work(work); struct delayed_work *dwork = to_delayed_work(work);
struct ether_priv_data *pdata = container_of(dwork, struct ether_priv_data *pdata = container_of(dwork,
@@ -1380,18 +1353,7 @@ static void ether_en_dis_monitor_clks(struct ether_priv_data *pdata,
} }
} }
/** void ether_adjust_link(struct net_device *dev)
* @brief Adjust link call back
*
* Algorithm: Callback function called by the PHY subsystem
* whenever there is a link detected or link changed on the
* physical layer.
*
* @param[in] dev: Network device data.
*
* @note MAC and PHY need to be initialized.
*/
static void ether_adjust_link(struct net_device *dev)
{ {
struct ether_priv_data *pdata = netdev_priv(dev); struct ether_priv_data *pdata = netdev_priv(dev);
nveu32_t iface_mode = pdata->osi_core->phy_iface_mode; nveu32_t iface_mode = pdata->osi_core->phy_iface_mode;
@@ -1667,34 +1629,7 @@ static int ether_phy_init(struct net_device *dev)
return 0; return 0;
} }
/** irqreturn_t ether_vm_isr(int irq, void *data)
* @brief ether_vm_isr - VM based ISR routine.
*
* Algorithm:
* 1) Get global DMA status (common for all VM IRQ's)
* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
* + RX7 + TX7 + RX6 + TX6 + . . . . . . . + RX1 + TX1 + RX0 + TX0 +
* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
*
* 2) Mask the channels which are specific to VM in global DMA status.
* 3) Process all DMA channel interrupts which are triggered the IRQ
* a) Find first first set from LSB with ffs
* b) The least significant bit is position 1 for ffs. So decremented
* by one to start from zero.
* c) Get channel number and TX/RX info by using bit position.
* d) Invoke OSI layer to clear interrupt source for DMA Tx/Rx at
* DMA and wrapper level.
* e) Get NAPI instance based on channel number and schedule the same.
*
* @param[in] irq: IRQ number.
* @param[in] data: VM IRQ private data structure.
*
* @note MAC and PHY need to be initialized.
*
* @retval IRQ_HANDLED on success.
* @retval IRQ_NONE on failure.
*/
static irqreturn_t ether_vm_isr(int irq, void *data)
{ {
struct ether_vm_irq_data *vm_irq = (struct ether_vm_irq_data *)data; struct ether_vm_irq_data *vm_irq = (struct ether_vm_irq_data *)data;
struct ether_priv_data *pdata = vm_irq->pdata; struct ether_priv_data *pdata = vm_irq->pdata;
@@ -3029,25 +2964,7 @@ exit:
return ret; return ret;
} }
/** int ether_open(struct net_device *dev)
* @brief Call back to handle bring up of Ethernet interface
*
* Algorithm: This routine takes care of below
* 1) PHY initialization
* 2) request tx/rx/common irqs
* 3) HW initialization
* 4) OSD private data structure initialization
* 5) Starting the PHY
*
* @param[in] dev: Net device data structure.
*
* @note Ethernet driver probe need to be completed successfully
* with ethernet network device created.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_open(struct net_device *dev)
{ {
struct ether_priv_data *pdata = netdev_priv(dev); struct ether_priv_data *pdata = netdev_priv(dev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -3406,21 +3323,7 @@ static inline void ether_flush_tx_ts_skb_list(struct ether_priv_data *pdata)
raw_spin_unlock_irqrestore(&pdata->txts_lock, flags); raw_spin_unlock_irqrestore(&pdata->txts_lock, flags);
} }
/** int ether_close(struct net_device *ndev)
* @brief Call back to handle bring down of Ethernet interface
*
* Algorithm: This routine takes care of below
* 1) Stopping PHY
* 2) Freeing tx/rx/common irqs
*
* @param[in] ndev: Net device data structure.
*
* @note MAC Interface need to be registered.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_close(struct net_device *ndev)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
unsigned int chan = 0x0; unsigned int chan = 0x0;
@@ -3830,24 +3733,9 @@ dma_map_failed:
return ret; return ret;
} }
/** unsigned short ether_select_queue(struct net_device *dev,
* @brief Select queue based on user priority struct sk_buff *skb,
* struct net_device *sb_dev)
* Algorithm:
* 1) Select the correct queue index based which has priority of queue
* same as skb->priority
* 2) default select queue array index 0
*
* @param[in] dev: Network device pointer
* @param[in] skb: sk_buff pointer, buffer data to send
* @param[in] accel_priv: private data used for L2 forwarding offload
* @param[in] fallback: fallback function pointer
*
* @retval "transmit queue index"
*/
static unsigned short ether_select_queue(struct net_device *dev,
struct sk_buff *skb,
struct net_device *sb_dev)
{ {
struct ether_priv_data *pdata = netdev_priv(dev); struct ether_priv_data *pdata = netdev_priv(dev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -3874,22 +3762,7 @@ static unsigned short ether_select_queue(struct net_device *dev,
return txqueue_select; return txqueue_select;
} }
/** int ether_start_xmit(struct sk_buff *skb, struct net_device *ndev)
* @brief Network layer hook for data transmission.
*
* Algorithm:
* 1) Allocate software context (DMA address for the buffer) for the data.
* 2) Invoke OSI for data transmission.
*
* @param[in] skb: SKB data structure.
* @param[in] ndev: Net device structure.
*
* @note MAC and PHY need to be initialized.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_dma_priv_data *osi_dma = pdata->osi_dma; struct osi_dma_priv_data *osi_dma = pdata->osi_dma;
@@ -4339,23 +4212,7 @@ static int ether_handle_priv_wmdio_ioctl(struct ether_priv_data *pdata,
mii_data->val_in); mii_data->val_in);
} }
/** int ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
* @brief Network stack IOCTL hook to driver
*
* Algorithm:
* 1) Invokes MII API for phy read/write based on IOCTL command
* 2) SIOCDEVPRIVATE for private ioctl
*
* @param[in] dev: network device structure
* @param[in] rq: Interface request structure used for socket
* @param[in] cmd: IOCTL command code
*
* @note Ethernet interface need to be up.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
struct ether_priv_data *pdata; struct ether_priv_data *pdata;
@@ -4439,8 +4296,8 @@ static int ether_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
static int ether_siocdevprivate(struct net_device *dev, struct ifreq *rq, int ether_siocdevprivate(struct net_device *dev, struct ifreq *rq,
void __user *data, int cmd) void __user *data, int cmd)
{ {
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
struct ether_priv_data *pdata; struct ether_priv_data *pdata;
@@ -4519,22 +4376,7 @@ static int ether_set_mac_addr(struct net_device *ndev, void *addr)
return ret; return ret;
} }
/** int ether_change_mtu(struct net_device *ndev, int new_mtu)
* @brief Change MAC MTU size
*
* Algorithm:
* 1) Check and return if interface is up.
* 2) Stores new MTU size set by user in OSI core data structure.
*
* @param[in] ndev: Network device structure
* @param[in] new_mtu: New MTU size to set.
*
* @note Ethernet interface need to be down to change MTU size
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_change_mtu(struct net_device *ndev, int new_mtu)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -4585,24 +4427,7 @@ static int ether_change_mtu(struct net_device *ndev, int new_mtu)
return 0; return 0;
} }
/** int ether_set_features(struct net_device *ndev, netdev_features_t feat)
* @brief Change HW features for the given network device.
*
* Algorithm:
* 1) Check if HW supports feature requested to be changed
* 2) If supported, check the current status of the feature and if it
* needs to be toggled, do so.
*
* @param[in] ndev: Network device structure
* @param[in] feat: New features to be updated
*
* @note Ethernet interface needs to be up. Stack will enforce
* the check.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_set_features(struct net_device *ndev, netdev_features_t feat)
{ {
int ret = 0; int ret = 0;
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
@@ -4638,27 +4463,7 @@ static int ether_set_features(struct net_device *ndev, netdev_features_t feat)
} }
#ifdef ETHER_VLAN_VID_SUPPORT #ifdef ETHER_VLAN_VID_SUPPORT
/** int ether_vlan_rx_add_vid(struct net_device *ndev, __be16 vlan_proto, u16 vid)
* @brief Adds VLAN ID. This function is invoked by upper
* layer when a new VLAN id is registered. This function updates the HW
* filter with new VLAN id. New vlan id can be added with vconfig -
* vconfig add interface_name vlan_id
*
* Algorithm:
* 1) Check for hash or perfect filtering.
* 2) invoke osi call accordingly.
*
* @param[in] ndev: Network device structure
* @param[in] vlan_proto: VLAN proto VLAN_PROTO_8021Q = 0 VLAN_PROTO_8021AD = 1
* @param[in] vid: VLAN ID.
*
* @note Ethernet interface should be up
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_vlan_rx_add_vid(struct net_device *ndev, __be16 vlan_proto,
u16 vid)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -4682,27 +4487,7 @@ static int ether_vlan_rx_add_vid(struct net_device *ndev, __be16 vlan_proto,
return ret; return ret;
} }
/** int ether_vlan_rx_kill_vid(struct net_device *ndev, __be16 vlan_proto, u16 vid)
* @brief Removes VLAN ID. This function is invoked by
* upper layer when a new VALN id is removed. This function updates the
* HW filter. vlan id can be removed with vconfig -
* vconfig rem interface_name vlan_id
*
* Algorithm:
* 1) Check for hash or perfect filtering.
* 2) invoke osi call accordingly.
*
* @param[in] ndev: Network device structure
* @param[in] vlan_proto: VLAN proto VLAN_PROTO_8021Q = 0 VLAN_PROTO_8021AD = 1
* @param[in] vid: VLAN ID.
*
* @note Ethernet interface should be up
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_vlan_rx_kill_vid(struct net_device *ndev, __be16 vlan_proto,
u16 vid)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -4727,24 +4512,8 @@ static int ether_vlan_rx_kill_vid(struct net_device *ndev, __be16 vlan_proto,
} }
#endif /* ETHER_VLAN_VID_SUPPORT */ #endif /* ETHER_VLAN_VID_SUPPORT */
/** int ether_setup_tc(struct net_device *ndev, enum tc_setup_type type,
* @brief ether_setup_tc - TC HW offload support void *type_data)
*
* Algorithm:
* 1) Check the TC setup type
* 2) Call appropriate function based on type.
*
* @param[in] ndev: Network device structure
* @param[in] type: qdisc type
* @param[in] type_data: void pointer having user passed configuration
*
* @note Ethernet interface should be up
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_setup_tc(struct net_device *ndev, enum tc_setup_type type,
void *type_data)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
@@ -7392,27 +7161,7 @@ static void ether_init_rss(struct ether_priv_data *pdata,
} }
#endif /* !OSI_STRIPPED_LIB */ #endif /* !OSI_STRIPPED_LIB */
/** int ether_probe(struct platform_device *pdev)
* @brief Ethernet platform driver probe.
*
* Algorithm:
* 1) Get the number of channels from DT.
* 2) Allocate the network device for those many channels.
* 3) Parse MAC and PHY DT.
* 4) Get all required clks/reset/IRQ's.
* 5) Register MDIO bus and network device.
* 6) Initialize spinlock.
* 7) Update filter value based on HW feature.
* 8) Update osi_core->hw_feature with pdata->hw_feat pointer
* 9) Initialize Workqueue to read MMC counters periodically.
*
* @param[in] pdev: platform device associated with platform driver.
*
* @retval 0 on success
* @retval "negative value" on failure
*
*/
static int ether_probe(struct platform_device *pdev)
{ {
struct ether_priv_data *pdata; struct ether_priv_data *pdata;
unsigned int num_dma_chans, mac, macsec, num_mtl_queues, chan, mac_ver_type; unsigned int num_dma_chans, mac, macsec, num_mtl_queues, chan, mac_ver_type;
@@ -7710,17 +7459,7 @@ err_kzalloc:
return ret; return ret;
} }
/** int ether_remove(struct platform_device *pdev)
* @brief Ethernet platform driver remove.
*
* Alogorithm: Release all the resources
*
* @param[in] pdev: Platform device associated with platform driver.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_remove(struct platform_device *pdev)
{ {
struct net_device *ndev = platform_get_drvdata(pdev); struct net_device *ndev = platform_get_drvdata(pdev);
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
@@ -7760,15 +7499,7 @@ static int ether_remove(struct platform_device *pdev)
return 0; return 0;
} }
/** void ether_shutdown(struct platform_device *pdev)
* @brief Ethernet platform driver shutdown.
*
* Alogorithm: Stops and Deinits PHY, MAC, DMA and Clks hardware and
* release SW allocated resources(buffers, workqueues etc).
*
* @param[in] pdev: Platform device associated with platform driver.
*/
static void ether_shutdown(struct platform_device *pdev)
{ {
struct net_device *ndev = platform_get_drvdata(pdev); struct net_device *ndev = platform_get_drvdata(pdev);
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
@@ -7880,19 +7611,7 @@ err_resume:
return ret; return ret;
} }
/** int ether_suspend_noirq(struct device *dev)
* @brief Ethernet platform driver suspend noirq callback.
*
* Alogorithm: Stops all data queues and PHY if the device
* does not wake capable. Disable TX and NAPI.
* Deinit OSI core, DMA and TX/RX interrupts.
*
* @param[in] dev: Platform device associated with platform driver.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_suspend_noirq(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
@@ -7954,19 +7673,7 @@ static int ether_suspend_noirq(struct device *dev)
return 0; return 0;
} }
int ether_resume_noirq(struct device *dev)
/**
* @brief Ethernet platform driver resume noirq callback.
*
* Alogorithm: Enable clocks and call resume sequence,
* refer ether_resume function for resume sequence.
*
* @param[in] dev: Platform device associated with platform driver.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_resume_noirq(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ /* Copyright (c) 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved */
#ifndef ETHER_LINUX_H #ifndef ETHER_LINUX_H
#define ETHER_LINUX_H #define ETHER_LINUX_H
@@ -805,13 +805,11 @@ int ether_conf_eee(struct ether_priv_data *pdata, unsigned int tx_lpi_enable);
int ether_padctrl_mii_rx_pins(void *priv, unsigned int enable); int ether_padctrl_mii_rx_pins(void *priv, unsigned int enable);
#ifndef OSI_STRIPPED_LIB #ifndef OSI_STRIPPED_LIB
void ether_selftest_run(struct net_device *dev,
struct ethtool_test *etest, u64 *buf);
void ether_selftest_get_strings(struct ether_priv_data *pdata, u8 *data); void ether_selftest_get_strings(struct ether_priv_data *pdata, u8 *data);
int ether_selftest_get_count(struct ether_priv_data *pdata); int ether_selftest_get_count(struct ether_priv_data *pdata);
#else #else
static inline void ether_selftest_run(struct net_device *dev, static inline void ether_selftest_run(struct net_device *dev,
struct ethtool_test *etest, u64 *buf) struct ethtool_test *etest, u64 *buf)
{ {
} }
static inline void ether_selftest_get_strings(struct ether_priv_data *pdata, static inline void ether_selftest_get_strings(struct ether_priv_data *pdata,
@@ -839,20 +837,6 @@ static inline int ether_selftest_get_count(struct ether_priv_data *pdata)
void ether_assign_osd_ops(struct osi_core_priv_data *osi_core, void ether_assign_osd_ops(struct osi_core_priv_data *osi_core,
struct osi_dma_priv_data *osi_dma); struct osi_dma_priv_data *osi_dma);
/**
* @brief osd_ivc_send_cmd - OSD ivc send cmd
*
* @param[in] priv: OSD private data
* @param[in] ivc_buf: ivc_msg_common structure
* @param[in] len: length of data
* @note
* API Group:
* - Initialization: Yes
* - Run time: Yes
* - De-initialization: Yes
*/
int osd_ivc_send_cmd(void *priv, ivc_msg_common_t *ivc_buf,
unsigned int len);
void ether_set_rx_mode(struct net_device *dev); void ether_set_rx_mode(struct net_device *dev);
@@ -920,4 +904,48 @@ void ether_nvgro_purge_timer(struct timer_list *t);
#ifdef BW_TEST #ifdef BW_TEST
void ether_tx_bandwidth_work(struct work_struct *work); void ether_tx_bandwidth_work(struct work_struct *work);
#endif #endif
#ifdef ETHER_VLAN_VID_SUPPORT
/**
* @brief Adds VLAN ID. This function is invoked by upper
* layer when a new VLAN id is registered. This function updates the HW
* filter with new VLAN id. New vlan id can be added with vconfig -
* vconfig add interface_name vlan_id
*
* Algorithm:
* 1) Check for hash or perfect filtering.
* 2) invoke osi call accordingly.
*
* @param[in] ndev: Network device structure
* @param[in] vlan_proto: VLAN proto VLAN_PROTO_8021Q = 0 VLAN_PROTO_8021AD = 1
* @param[in] vid: VLAN ID.
*
* @note Ethernet interface should be up
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
int ether_vlan_rx_add_vid(struct net_device *ndev, __be16 vlan_proto, u16 vid);
/**
* @brief Removes VLAN ID. This function is invoked by
* upper layer when a new VALN id is removed. This function updates the
* HW filter. vlan id can be removed with vconfig -
* vconfig rem interface_name vlan_id
*
* Algorithm:
* 1) Check for hash or perfect filtering.
* 2) invoke osi call accordingly.
*
* @param[in] ndev: Network device structure
* @param[in] vlan_proto: VLAN proto VLAN_PROTO_8021Q = 0 VLAN_PROTO_8021AD = 1
* @param[in] vid: VLAN ID.
*
* @note Ethernet interface should be up
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
int ether_vlan_rx_kill_vid(struct net_device *ndev, __be16 vlan_proto, u16 vid);
#endif /* ETHER_VLAN_VID_SUPPORT */
#endif /* ETHER_LINUX_H */ #endif /* ETHER_LINUX_H */

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h> #include <nvidia/conftest.h>
@@ -1030,21 +1030,9 @@ static const struct ether_stats ether_tstrings_stats[] = {
#endif /* OSI_STRIPPED_LIB */ #endif /* OSI_STRIPPED_LIB */
}; };
/** void ether_get_ethtool_stats(struct net_device *dev,
* @brief This function is invoked by kernel when user requests to get the struct ethtool_stats *dummy,
* extended statistics about the device. u64 *data)
*
* Algorithm: read mmc register and create strings
*
* @param[in] dev: pointer to net device structure.
* @param[in] dummy: dummy parameter of ethtool_stats type.
* @param[in] data: Pointer in which MMC statistics should be put.
*
* @note Network device needs to created.
*/
static void ether_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *dummy,
u64 *data)
{ {
struct ether_priv_data *pdata = netdev_priv(dev); struct ether_priv_data *pdata = netdev_priv(dev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -1140,19 +1128,7 @@ static void ether_get_ethtool_stats(struct net_device *dev,
} }
} }
/** int ether_get_sset_count(struct net_device *dev, int sset)
* @brief This function gets number of strings
*
* Algorithm: return number of strings.
*
* @param[in] dev: Pointer to net device structure.
* @param[in] sset: String set value.
*
* @note Network device needs to created.
*
* @return Numbers of strings(total length)
*/
static int ether_get_sset_count(struct net_device *dev, int sset)
{ {
struct ether_priv_data *pdata = netdev_priv(dev); struct ether_priv_data *pdata = netdev_priv(dev);
int len = 0; int len = 0;
@@ -1203,19 +1179,7 @@ static int ether_get_sset_count(struct net_device *dev, int sset)
return len; return len;
} }
/** void ether_get_strings(struct net_device *dev, u32 stringset, u8 *data)
* @brief This function returns a set of strings that describe
* the requested objects.
*
* Algorithm: return number of strings.
*
* @param[in] dev: Pointer to net device structure.
* @param[in] stringset: String set value.
* @param[in] data: Pointer in which requested string should be put.
*
* @note Network device needs to created.
*/
static void ether_get_strings(struct net_device *dev, u32 stringset, u8 *data)
{ {
struct ether_priv_data *pdata = netdev_priv(dev); struct ether_priv_data *pdata = netdev_priv(dev);
u8 *p = data; u8 *p = data;
@@ -1287,18 +1251,8 @@ static void ether_get_strings(struct net_device *dev, u32 stringset, u8 *data)
} }
#ifndef OSI_STRIPPED_LIB #ifndef OSI_STRIPPED_LIB
/** void ether_get_pauseparam(struct net_device *ndev,
* @brief Get pause frame settings struct ethtool_pauseparam *pause)
*
* Algorithm: Gets pause frame configuration
*
* @param[in] ndev: network device instance
* @param[out] pause: Pause parameters that are set currently
*
* @note Network device needs to created.
*/
static void ether_get_pauseparam(struct net_device *ndev,
struct ethtool_pauseparam *pause)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct phy_device *phydev = pdata->phydev; struct phy_device *phydev = pdata->phydev;
@@ -1332,21 +1286,8 @@ static void ether_get_pauseparam(struct net_device *ndev,
} }
} }
/** int ether_set_pauseparam(struct net_device *ndev,
* @brief Set pause frame settings struct ethtool_pauseparam *pause)
*
* Algorithm: Sets pause frame settings
*
* @param[in] ndev: network device instance
* @param[in] pause: Pause frame settings
*
* @note Network device needs to created.
*
* @retval 0 on Sucess
* @retval "negative value" on failure.
*/
static int ether_set_pauseparam(struct net_device *ndev,
struct ethtool_pauseparam *pause)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_ioctl ioctl_data = {}; struct osi_ioctl ioctl_data = {};
@@ -1889,20 +1830,7 @@ static int ether_set_eee(struct net_device *ndev,
return 0; return 0;
} }
/** int ether_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
* @brief This function is invoked by kernel when user request to set
* pmt parameters for remote wakeup or magic wakeup
*
* Algorithm: Enable or Disable Wake On Lan status based on wol param
*
* @param[in] ndev pointer to net device structure.
* @param[in] wol pointer to ethtool_wolinfo structure.
*
* @note MAC and PHY need to be initialized.
*
* @retval zero on success and -ve number on failure.
*/
static int ether_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
int ret; int ret;
@@ -1947,21 +1875,7 @@ static int ether_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
return ret; return ret;
} }
/** void ether_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
* @brief This function is invoked by kernel when user request to get report
* whether wake-on-lan is enable or not.
*
* Algorithm: Return Wake On Lan status in wol param
*
* param[in] ndev pointer to net device structure.
* param[in] wol pointer to ethtool_wolinfo structure.
*
* @note MAC and PHY need to be initialized.
*
* @retval none
*/
static void ether_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
@@ -1984,23 +1898,9 @@ static void ether_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
phy_ethtool_get_wol(pdata->phydev, wol); phy_ethtool_get_wol(pdata->phydev, wol);
} }
/** int ether_get_rxnfc(struct net_device *ndev,
* @brief Get RX flow classification rules struct ethtool_rxnfc *rxnfc,
* u32 *rule_locs)
* Algorithm: Returns RX flow classification rules.
*
* param[in] ndev: Pointer to net device structure.
* param[in] rxnfc: Pointer to rxflow data
* param[in] rule_locs: TBD
*
* @note MAC and PHY need to be initialized.
*
* @retval 0 on success
* @retval negative on failure
*/
static int ether_get_rxnfc(struct net_device *ndev,
struct ethtool_rxnfc *rxnfc,
u32 *rule_locs)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -2016,16 +1916,7 @@ static int ether_get_rxnfc(struct net_device *ndev,
return 0; return 0;
} }
/** u32 ether_get_rxfh_key_size(struct net_device *ndev)
* @brief Get the size of the RX flow hash key
*
* Algorithm: Returns size of RSS hash key
*
* param[in] ndev: Pointer to net device structure.
*
* @retval size of RSS Hash key
*/
static u32 ether_get_rxfh_key_size(struct net_device *ndev)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -2033,16 +1924,7 @@ static u32 ether_get_rxfh_key_size(struct net_device *ndev)
return sizeof(osi_core->rss.key); return sizeof(osi_core->rss.key);
} }
/** u32 ether_get_rxfh_indir_size(struct net_device *ndev)
* @brief Get the size of the RX flow hash indirection table
*
* Algorithm: Returns size of the RX flow hash indirection table
*
* param[in] ndev: Pointer to net device structure.
*
* @retval size of RSS Hash table
*/
static u32 ether_get_rxfh_indir_size(struct net_device *ndev)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -2207,14 +2089,14 @@ static int ether_set_ringparam(struct net_device *ndev,
return ret; return ret;
} }
static unsigned int ether_get_msglevel(struct net_device *ndev) unsigned int ether_get_msglevel(struct net_device *ndev)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
return pdata->msg_enable; return pdata->msg_enable;
} }
static void ether_set_msglevel(struct net_device *ndev, u32 level) void ether_set_msglevel(struct net_device *ndev, u32 level)
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);

View File

@@ -1,23 +1,41 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ /* Copyright (c) 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved */
#ifndef IOCTL_H #ifndef IOCTL_H
#define IOCTL_H #define IOCTL_H
#include "ether_export.h" #include "ether_export.h"
#include "ether_callback_export.h"
/**
* @addtogroup private IOCTL related info
*
* @{
*/
/** Configure loopback mode enable/disable */
/* Get TX channel/queue count */
#define EQOS_GET_TX_QCNT 23
/* Get RX channel/queue count */
#define EQOS_GET_RX_QCNT 24
/** Set L2 DA filtering */
#define EQOS_L2_DA_FILTERING_CMD 35
#define ETHER_CONFIG_LOOPBACK_MODE 40
#define ETHER_READ_REG 53
#define ETHER_WRITE_REG 54
#ifdef OSI_DEBUG
#define ETHER_REGISTER_DUMP 56
#define ETHER_STRUCTURE_DUMP 57
#endif /* OSI_DEBUG */
#ifdef OSI_DEBUG
#define ETHER_DEBUG_INTR_CONFIG 60
#endif
/** @} */
/** /**
*@addtogroup IOCTL Helper MACROS *@addtogroup IOCTL Helper MACROS
* @{ * @{
*/ */
#define NUM_BYTES_IN_IPADDR 4
#define MAX_IP_ADDR_BYTE 0xFFU #define MAX_IP_ADDR_BYTE 0xFFU
/* PTP offload mode defines */
#define ETHER_PTP_ORDINARY_SLAVE 1
#define ETHER_PTP_ORDINARY_MASTER 2
#define ETHER_PTP_TRASPARENT_SLAVE 3
#define ETHER_PTP_TRASPARENT_MASTER 4
#define ETHER_PTP_PEER_TO_PEER_TRANSPARENT 5
/* class E IP4 addr start range, reserved */ /* class E IP4 addr start range, reserved */
#define CLASS_E_IP4_ADDR_RANGE_START 240U #define CLASS_E_IP4_ADDR_RANGE_START 240U
/* class D multicast addr range */ /* class D multicast addr range */
@@ -26,74 +44,8 @@
/* Remote wakeup filter */ /* Remote wakeup filter */
#define EQOS_RWK_FILTER_LENGTH 8 #define EQOS_RWK_FILTER_LENGTH 8
#define ETHER_PRV_TS_IOCTL (SIOCDEVPRIVATE + 1)
#define ETHER_PRV_RMDIO_IOCTL (SIOCDEVPRIVATE + 2)
#define ETHER_PRV_WMDIO_IOCTL (SIOCDEVPRIVATE + 3)
/* private ioctl number*/
/* TX/RX channel/queue count */
#define EQOS_GET_TX_QCNT 23
#define EQOS_GET_RX_QCNT 24
/** Line speed */
#define EQOS_GET_CONNECTED_SPEED 25
/* L3/L4 filter */
#define EQOS_L3L4_FILTER_CMD 29
/* VLAN filtering */
#define EQOS_VLAN_FILTERING_CMD 34
/* L2 DA filtering */
#define EQOS_L2_DA_FILTERING_CMD 35
#define ETHER_CONFIG_ARP_OFFLOAD 36
#define ETHER_CONFIG_LOOPBACK_MODE 40
#define ETHER_CONFIG_PTP_OFFLOAD 42
#define ETHER_PTP_RXQUEUE 48
#define ETHER_MC_DMA_ROUTE 52
#define ETHER_READ_REG 53
#define ETHER_WRITE_REG 54
#define ETHER_PAD_CALIBRATION 55
#ifdef OSI_DEBUG
#define ETHER_REGISTER_DUMP 56
#define ETHER_STRUCTURE_DUMP 57
#endif /* OSI_DEBUG */
#define ETHER_CAP_TSC_PTP 58
#define ETHER_M2M_TSYNC 59
#ifdef OSI_DEBUG
#define ETHER_DEBUG_INTR_CONFIG 60
#endif
/** @} */ /** @} */
/**
* @brief struct arp_offload_param - Parameter to support ARP offload.
*/
struct arp_offload_param {
/** ip_addr: Byte array for decimal representation of IP address.
* For example, 192.168.1.3 is represented as
* ip_addr[0] = '192' ip_addr[1] = '168' ip_addr[2] = '1'
* ip_addr[3] = '3' */
unsigned char ip_addr[NUM_BYTES_IN_IPADDR];
};
/**
* @brief struct ptp_offload_param - Parameter to support PTP offload.
*/
struct ptp_offload_param {
int en_dis;
int mode;
int domain_num;
int mc_uc;
};
/**
* @brief struct ifr_data_timestamp_struct - common data structure between
* driver and application for sharing info through private TS ioctl
*/
struct ifr_data_timestamp_struct {
/** Clock ID */
clockid_t clockid;
/** Store kernel time */
struct timespec64 kernel_ts;
/** Store HW time */
struct timespec64 hw_ptp_ts;
};
/** /**
* @brief ether_priv_ioctl - Handle private IOCTLs * @brief ether_priv_ioctl - Handle private IOCTLs
* Algorithm: * Algorithm:

View File

@@ -576,28 +576,10 @@ exit:
} }
#endif #endif
/** void osd_receive_packet(void *priv, struct osi_rx_ring *rx_ring,
* @brief Handover received packet to network stack. unsigned int chan, unsigned int dma_buf_len,
* const struct osi_rx_pkt_cx *rx_pkt_cx,
* Algorithm: struct osi_rx_swcx *rx_swcx)
* 1) Unmap the DMA buffer address.
* 2) Updates socket buffer with len and ether type and handover to
* Linux network stack.
* 3) Refill the Rx ring based on threshold.
*
* @param[in] priv: OSD private data structure.
* @param[in] rx_ring: Pointer to DMA channel Rx ring.
* @param[in] chan: DMA Rx channel number.
* @param[in] dma_buf_len: Rx DMA buffer length.
* @param[in] rx_pkt_cx: Received packet context.
* @param[in] rx_swcx: Received packet sw context.
*
* @note Rx completion need to make sure that Rx descriptors processed properly.
*/
static void osd_receive_packet(void *priv, struct osi_rx_ring *rx_ring,
unsigned int chan, unsigned int dma_buf_len,
const struct osi_rx_pkt_cx *rx_pkt_cx,
struct osi_rx_swcx *rx_swcx)
{ {
struct ether_priv_data *pdata = (struct ether_priv_data *)priv; struct ether_priv_data *pdata = (struct ether_priv_data *)priv;
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
@@ -726,25 +708,9 @@ done:
ether_realloc_rx_skb(pdata, rx_ring, chan); ether_realloc_rx_skb(pdata, rx_ring, chan);
} }
/** void osd_transmit_complete(void *priv, const struct osi_tx_swcx *swcx,
* @brief osd_transmit_complete - Transmit completion routine. const struct osi_txdone_pkt_cx
* *txdone_pkt_cx)
* Algorithm:
* 1) Updates stats for linux network stack.
* 2) unmap and free the buffer DMA address and buffer.
* 3) Time stamp will be update to stack if available.
*
* @param[in] priv: OSD private data structure.
* @param[in] swcx: Pointer to swcx
* @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.
*
* @note Tx completion need to make sure that Tx descriptors processed properly.
*/
static void osd_transmit_complete(void *priv, const struct osi_tx_swcx *swcx,
const struct osi_txdone_pkt_cx
*txdone_pkt_cx)
{ {
struct ether_priv_data *pdata = (struct ether_priv_data *)priv; struct ether_priv_data *pdata = (struct ether_priv_data *)priv;
struct osi_dma_priv_data *osi_dma = pdata->osi_dma; struct osi_dma_priv_data *osi_dma = pdata->osi_dma;
@@ -912,7 +878,7 @@ void ether_restart_lane_bringup_task(struct tasklet_struct *t)
} }
} }
static void osd_restart_lane_bringup(void *priv, unsigned int en_disable) void osd_restart_lane_bringup(void *priv, unsigned int en_disable)
{ {
struct ether_priv_data *pdata = (struct ether_priv_data *)priv; struct ether_priv_data *pdata = (struct ether_priv_data *)priv;

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include "ether_linux.h" #include "ether_linux.h"
@@ -78,19 +78,7 @@ static inline int ether_get_hw_time(struct net_device *dev,
return 0; return 0;
} }
/** int ether_adjust_time(struct ptp_clock_info *ptp, s64 nsec_delta)
* @brief Adjust MAC hardware time
*
* Algorithm: This function is used to shift/adjust the time of the
* hardware clock.
*
* @param[in] ptp: Pointer to ptp_clock_info structure.
* @param[in] nsec_delta: Desired change in nanoseconds w.r.t System time
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_adjust_time(struct ptp_clock_info *ptp, s64 nsec_delta)
{ {
struct ether_priv_data *pdata = container_of(ptp, struct ether_priv_data *pdata = container_of(ptp,
struct ether_priv_data, struct ether_priv_data,
@@ -116,20 +104,7 @@ static int ether_adjust_time(struct ptp_clock_info *ptp, s64 nsec_delta)
return ret; return ret;
} }
/** int ether_adjust_clock(struct ptp_clock_info *ptp, long scaled_ppm)
* @brief Adjust MAC hardware frequency
*
* Algorithm: This function is used to adjust the frequency of the
* hardware clock.
*
* @param[in] ptp: Pointer to ptp_clock_info structure.
* @param[in] ppb: Desired period change in parts per billion.
* @param[in] scaled_ppm: Desired period change in parts per million.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_adjust_clock(struct ptp_clock_info *ptp, long scaled_ppm)
{ {
struct ether_priv_data *pdata = container_of(ptp, struct ether_priv_data *pdata = container_of(ptp,
struct ether_priv_data, struct ether_priv_data,
@@ -155,19 +130,7 @@ static int ether_adjust_clock(struct ptp_clock_info *ptp, long scaled_ppm)
return ret; return ret;
} }
/** int ether_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
* @brief Gets current hardware time
*
* Algorithm: This function is used to read the current time from the
* hardware clock
*
* @param[in] ptp: Pointer to ptp_clock_info structure.
* @param[in] ts: Pointer to hole time.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
{ {
struct ether_priv_data *pdata = container_of(ptp, struct ether_priv_data *pdata = container_of(ptp,
struct ether_priv_data, struct ether_priv_data,
@@ -194,20 +157,7 @@ static int ether_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
return 0; return 0;
} }
/** int ether_set_time(struct ptp_clock_info *ptp, const struct timespec64 *ts)
* @brief Set current system time to MAC Hardware
*
* Algorithm: This function is used to set the current time to the
* hardware clock.
*
* @param[in] ptp: Pointer to ptp_clock_info structure.
* @param[in] ts: Time value to set.
*
* @retval 0 on success
* @retval "negative value" on failure.
*/
static int ether_set_time(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
{ {
struct ether_priv_data *pdata = container_of(ptp, struct ether_priv_data *pdata = container_of(ptp,
struct ether_priv_data, struct ether_priv_data,

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ /* Copyright (c) 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved */
#ifndef OSI_STRIPPED_LIB #ifndef OSI_STRIPPED_LIB
#include "ether_linux.h" #include "ether_linux.h"
@@ -371,16 +371,6 @@ static const struct ether_test {
}, },
}; };
/**
* @brief ether_selftest_run - Ethernet selftests.
*
* @param[in] dev: Network device pointer.
* @param[in] etest: Ethernet ethtool test pointer.
* @param[in] buf: Buffer pointer to hold test status.
*
* @retval zero on success.
* @retval negative value on failure.
*/
void ether_selftest_run(struct net_device *dev, void ether_selftest_run(struct net_device *dev,
struct ethtool_test *etest, u64 *buf) struct ethtool_test *etest, u64 *buf)
{ {