sonic-buildimage/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.h
vmittal-msft 04b9ce8e32
[BCMSAI] Update BCMSAI debian to 6.0.0.10 with 6.5.23 SDK, and opennsl module to 6.5.23 (#9046)
Manual verification on switch (TH3 device)
admin@str2-xxxxx-01:~$ bcmcmd bsv
bsv
BRCM SAI ver: [6.0.0.10], OCP SAI ver: [1.9.1], SDK ver: [sdk-6.5.23]
drivshell>

admin@str2-xxxxx-01:~$ bcmcmd version
version
Broadcom Command Monitor: Copyright (c) 1998-2021 Broadcom
Release: sdk-6.5.23 built 20211020 (Wed Oct 20 06:52:58 2021)
From root@fedbbfdbee81:/__w/2/s/output/x86-xgsall-deb/hsdk
Platform: X86
OS: Unix (Posix)
Chips:
BCM56640_A0,
BCM56850_A0,
BCM56340_A0,
BCM56960_A0, BCM56860_A0,

   BCM56970_A0, BCM56870_A0,
   BCM56980_A0, BCM56980_B0,
  
   BCM56370_A0, BCM56275_A0, BCM56770_A0,
Chips:
BCM56780_A0, BCM56782_A0, BCM56784_A0, BCM56785_A0,
BCM56786_A0, BCM56787_A0, BCM56788_A0, BCM56789_A0,
BCM56880_A0, BCM56880_B0, BCM56881_A0, BCM56881_B0,
BCM56883_A0, BCM56883_B0, BCM56990_A0, BCM56990_B0,
BCM56991_B0, BCM56992_B0, BCM56996_A0, BCM56996_B0,
BCM56997_A0, BCM56997_B0

Variant drivers:
BCM56780_A0_CNA_1_2_10, BCM56780_A0_DNA_2_7_6_0, BCM56880_A0_CNA_1_2_9, BCM56880_A0_DNA_4_9_5_0
PHYs: BCM5400, BCM54182, BCM54185, BCM54180,
BCM54140, BCM54192, BCM54195, BCM54190,
BCM54194, BCM54210, BCM54220, BCM54280,
BCM54282, BCM54240, BCM54285, BCM5428X,
BCM54290, BCM54292, BCM54294, BCM54295,
BCM54296, BCM56160-GPHY, BCM53540-GPHY, BCM56275-GPHY,
BCM8750, BCM8752, BCM8754, BCM84740,
BCM84164, BCM84758, BCM84780, BCM84784,
BCM84318, BCM84328, Sesto, BCM82780,
copper sfp

drivshell>
2021-10-28 00:12:32 -07:00

288 lines
7.1 KiB
C

/*! \file ngknet_main.h
*
* Data structure and macro definitions for NGKNET kernel module.
*
*/
/*
* $Copyright: Copyright 2018-2021 Broadcom. All rights reserved.
* The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of the GNU General Public License version 2 (GPLv2) can
* be found in the LICENSES folder.$
*/
#ifndef NGKNET_MAIN_H
#define NGKNET_MAIN_H
#include <linux/netdevice.h>
#include <lkm/lkm.h>
#include <lkm/ngknet_dev.h>
#include <bcmcnet/bcmcnet_core.h>
/*! Maximum number of PDMA devices supported */
#ifdef NGBDE_NUM_SWDEV_MAX
#define NUM_PDMA_DEV_MAX NGBDE_NUM_SWDEV_MAX
#else
#define NUM_PDMA_DEV_MAX 16
#endif
/*!
* Debug levels
*/
#define DBG_LVL_VERB 0x0001
#define DBG_LVL_PKT 0x0002
#define DBG_LVL_CMD 0x0004
#define DBG_LVL_IRQ 0x0008
#define DBG_LVL_NAPI 0x0010
#define DBG_LVL_NDEV 0x0020
#define DBG_LVL_FILT 0x0040
#define DBG_LVL_RCPU 0x0080
#define DBG_LVL_WARN 0x0100
#define DBG_LVL_PDMP 0x0200
#define DBG_LVL_RATE 0x0400
#define DBG_LVL_LINK 0x0800
#define DBG_VERB(_s) do { if (debug & DBG_LVL_VERB) printk _s; } while (0)
#define DBG_PKT(_s) do { if (debug & DBG_LVL_PKT) printk _s; } while (0)
#define DBG_CMD(_s) do { if (debug & DBG_LVL_CMD) printk _s; } while (0)
#define DBG_IRQ(_s) do { if (debug & DBG_LVL_IRQ) printk _s; } while (0)
#define DBG_NAPI(_s) do { if (debug & DBG_LVL_NAPI) printk _s; } while (0)
#define DBG_NDEV(_s) do { if (debug & DBG_LVL_NDEV) printk _s; } while (0)
#define DBG_FILT(_s) do { if (debug & DBG_LVL_FILT) printk _s; } while (0)
#define DBG_RCPU(_s) do { if (debug & DBG_LVL_RCPU) printk _s; } while (0)
#define DBG_WARN(_s) do { if (debug & DBG_LVL_WARN) printk _s; } while (0)
#define DBG_PDMP(_s) do { if (debug & DBG_LVL_PDMP) printk _s; } while (0)
#define DBG_RATE(_s) do { if (debug & DBG_LVL_RATE) printk _s; } while (0)
#define DBG_LINK(_s) do { if (debug & DBG_LVL_LINK) printk _s; } while (0)
/*!
* Device description
*/
struct ngknet_dev {
/*! Device type string */
char type_str[NGKNET_DEV_NAME_MAX];
/*! Device type string */
char var_str[NGKNET_DEV_NAME_MAX];
/*! Base address for PCI register access */
volatile void *base_addr;
/*! Required for DMA memory control */
struct device *dev;
/*! Required for PCI memory control */
struct pci_dev *pci_dev;
/*! Base network device */
struct net_device *net_dev;
/*! PDMA device */
struct pdma_dev pdma_dev;
/*! Device number (from BDE) */
int dev_no;
/*! Virtual network devices, 0 is reserved for valid number of devices. */
struct net_device *vdev[NUM_VDEV_MAX + 1];
/*! Virtual network devices bound to queue */
struct net_device *bdev[NUM_Q_MAX];
/*! Filter list */
struct list_head filt_list;
/*! Filter control, 0 is reserved */
void *fc[NUM_FILTER_MAX + 1];
/*! Callback control */
struct ngknet_callback_ctrl *cbc;
/*! RCPU control */
struct ngknet_rcpu_hdr rcpu_ctrl;
/*! NGKNET lock */
spinlock_t lock;
/*! NGKNET wait queue */
wait_queue_head_t wq;
/*! VNET wait queue */
wait_queue_head_t vnet_wq;
/*! VNET is active */
atomic_t vnet_active;
/*! HNET wait queue */
wait_queue_head_t hnet_wq;
/*! HNET is active */
atomic_t hnet_active;
/*! HNET deamon */
struct task_struct *hnet_task;
/*! HNET work */
struct work_struct hnet_work;
/*! PTP Tx queue */
struct sk_buff_head ptp_tx_queue;
/*! PTP Tx work */
struct work_struct ptp_tx_work;
/*! Flags */
int flags;
/*! NGKNET device is active */
#define NGKNET_DEV_ACTIVE (1 << 0)
};
/*!
* Network interface specific private data
*/
struct ngknet_private {
/*! Network device */
struct net_device *net_dev;
/*! Network stats */
struct net_device_stats stats;
/*! NGKNET device */
struct ngknet_dev *bkn_dev;
/*! Network interface ID */
int id;
/*! Network interface type */
int type;
/*! Network interface flags */
uint32_t flags;
/*! Network interface vlan */
uint32_t vlan;
/*! Network interface bound to */
uint32_t chan;
/*! Metadata offset from Ethernet header */
uint32_t meta_off;
/*! Metadata length */
uint32_t meta_len;
/*! Metadata used to send packets to physical port */
uint8_t meta_data[NGKNET_NETIF_META_MAX];
/*! User data gotten back through callbacks */
uint8_t user_data[NGKNET_NETIF_USER_DATA];
/*! Users of this network interface */
int users;
/*! Wait for this network interface free */
int wait;
/*! HW timestamp Rx filter */
int hwts_rx_filter;
/*! HW timestamp Tx type */
int hwts_tx_type;
/*! Matched callback filter */
struct ngknet_filter_s *filt_cb;
};
/*!
* \brief Create network interface.
*
* \param [in] dev NGKNET device structure point.
* \param [in] netif Network interface structure point.
*
* \retval SHR_E_NONE No errors.
* \retval SHR_E_XXXX Operation failed.
*/
extern int
ngknet_netif_create(struct ngknet_dev *dev, ngknet_netif_t *netif);
/*!
* \brief Destroy network interface.
*
* \param [in] dev NGKNET device structure point.
* \param [in] id Network interface ID.
*
* \retval SHR_E_NONE No errors.
* \retval SHR_E_XXXX Operation failed.
*/
extern int
ngknet_netif_destroy(struct ngknet_dev *dev, int id);
/*!
* \brief Get network interface.
*
* \param [in] dev NGKNET device structure point.
* \param [in] id Network interface ID.
* \param [out] netif Network interface structure point.
*
* \retval SHR_E_NONE No errors.
* \retval SHR_E_XXXX Operation failed.
*/
extern int
ngknet_netif_get(struct ngknet_dev *dev, int id, ngknet_netif_t *netif);
/*!
* \brief Get the next network interface.
*
* \param [in] dev NGKNET device structure point.
* \param [out] netif Network interface structure point.
*
* \retval SHR_E_NONE No errors.
* \retval SHR_E_XXXX Operation failed.
*/
extern int
ngknet_netif_get_next(struct ngknet_dev *dev, ngknet_netif_t *netif);
/*!
* \brief Get debug level.
*
* \retval Current debug level.
*/
extern int
ngknet_debug_level_get(void);
/*!
* \brief Set debug level.
*
* \param [in] debug_level Debug level to be set.
*/
extern void
ngknet_debug_level_set(int debug_level);
/*!
* \brief Get Rx rate limit.
*
* \retval Current Rx rate limit.
*/
extern int
ngknet_rx_rate_limit_get(void);
/*!
* \brief Set Rx rate limit.
*
* \param [in] rate_limit Rx rate limit to be set.
*/
extern void
ngknet_rx_rate_limit_set(int rate_limit);
#endif /* NGKNET_MAIN_H */