[sflow]: Unblocked psample_*() function calls in BRCM ESW platforms for proper functionality of sflow feature (#12918)

*Replaced BRCM SDK's psample support flag(PSAMPLE_SUPPORT) with linux kernel psample module support config flag(CONFIG_PSAMPLE) in saibcm-modules.
*Replaced BUILD_PSAMPLE conditioanl check with CONFIG_PSAMPLE to build psample callback library(psample-cb.o), only if psample config is enabled in linux kernel.
*Cleaned up PSAMPLE_SUPPORT related commented code.

Signed-off-by: haris@celestica.com

Signed-off-by: haris@celestica.com
This commit is contained in:
hari-selvam 2022-12-08 06:44:34 +05:30 committed by GitHub
parent 5073dc0f8b
commit d993444883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 18 deletions

View File

@ -17,8 +17,7 @@
# A copy of the GNU General Public License version 2 (GPLv2) can
# be found in the LICENSES folder.$
#
ifeq ($(BUILD_PSAMPLE),1)
PSAMPLE_CFLAGS=-DPSAMPLE_SUPPORT
ifneq ($(CONFIG_PSAMPLE),)
PSAMPLE_CB_OBJS=psample-cb.o
endif

View File

@ -307,8 +307,8 @@ static struct sk_buff *
ngknet_rx_cb(struct sk_buff *skb)
{
skb = strip_tag_rx_cb(skb);
#ifdef PSAMPLE_SUPPORT
skb = psample_rx_cb(skb);
#if IS_ENABLED(CONFIG_PSAMPLE)
skb = psample_rx_cb(skb);
#endif
return skb;
}
@ -324,7 +324,7 @@ static int
ngknet_netif_create_cb(struct net_device *dev)
{
int retv = 0;
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
retv = psample_netif_create_cb(dev);
#endif
return retv;
@ -334,7 +334,7 @@ static int
ngknet_netif_destroy_cb(struct net_device *dev)
{
int retv = 0;
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
retv = psample_netif_destroy_cb(dev);
#endif
return retv;
@ -431,7 +431,7 @@ ngknetcb_init_module(void)
ngknet_rx_cb_register(ngknet_rx_cb);
ngknet_tx_cb_register(ngknet_tx_cb);
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
psample_init();
#endif
@ -446,7 +446,7 @@ ngknetcb_exit_module(void)
ngknet_netif_create_cb_unregister(ngknet_netif_create_cb);
ngknet_netif_destroy_cb_unregister(ngknet_netif_destroy_cb);
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
psample_cleanup();
#endif

View File

@ -24,7 +24,6 @@
#include <lkm/lkm.h>
#include <linux/netdevice.h>
//#define PSAMPLE_SUPPORT 1 // TODO: MLI@BRCM - Add this as part of conditional in Makefile
#define PSAMPLE_CB_NAME "psample"
extern int

View File

@ -46,7 +46,7 @@
#include <linux/if_vlan.h>
/* Enable sflow sampling using psample */
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
#include "psample-cb.h"
#endif
@ -334,7 +334,7 @@ knet_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta,
int chan, kcom_filter_t *kf)
{
/* check for filter callback handler */
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
if (strncmp(kf->desc, PSAMPLE_CB_NAME, strlen(PSAMPLE_CB_NAME)) == 0) {
return psample_filter_cb (pkt, size, dev_no, meta, chan, kf);
}
@ -346,7 +346,7 @@ static int
knet_netif_create_cb(int unit, kcom_netif_t *netif, uint16 spa, struct net_device *dev)
{
int retv = 0;
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
retv = psample_netif_create_cb(unit, netif, spa, dev);
#endif
return retv;
@ -356,7 +356,7 @@ static int
knet_netif_destroy_cb(int unit, kcom_netif_t *netif, uint16 spa, struct net_device *dev)
{
int retv = 0;
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
retv = psample_netif_destroy_cb(unit, netif, spa, dev);
#endif
return retv;
@ -367,7 +367,7 @@ knet_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta,
int chan, kcom_filter_t *kf)
{
/* check for filter callback handler */
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
if (strncmp(kf->desc, PSAMPLE_CB_NAME, KCOM_FILTER_DESC_MAX) == 0) {
return psample_filter_cb (pkt, size, dev_no, meta, chan, kf);
}
@ -379,7 +379,7 @@ static int
knet_netif_create_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
{
int retv = 0;
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
retv = psample_netif_create_cb(unit, netif, dev);
#endif
return retv;
@ -389,7 +389,7 @@ static int
knet_netif_destroy_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
{
int retv = 0;
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
retv = psample_netif_destroy_cb(unit, netif, dev);
#endif
return retv;
@ -427,7 +427,7 @@ _cleanup(void)
bkn_netif_create_cb_unregister(knet_netif_create_cb);
bkn_netif_destroy_cb_unregister(knet_netif_destroy_cb);
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
psample_cleanup();
#endif
return 0;
@ -445,7 +445,7 @@ _init(void)
bkn_tx_skb_cb_register(strip_tag_tx_cb);
}
#ifdef PSAMPLE_SUPPORT
#if IS_ENABLED(CONFIG_PSAMPLE)
psample_init();
#endif
bkn_filter_cb_register(knet_filter_cb);