Skip to content

Commit d993444

Browse files
authored
[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: [email protected] Signed-off-by: [email protected]
1 parent 5073dc0 commit d993444

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Kbuild

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# A copy of the GNU General Public License version 2 (GPLv2) can
1818
# be found in the LICENSES folder.$
1919
#
20-
ifeq ($(BUILD_PSAMPLE),1)
21-
PSAMPLE_CFLAGS=-DPSAMPLE_SUPPORT
20+
ifneq ($(CONFIG_PSAMPLE),)
2221
PSAMPLE_CB_OBJS=psample-cb.o
2322
endif
2423

platform/broadcom/saibcm-modules/sdklt/linux/knetcb/ngknetcb_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ static struct sk_buff *
307307
ngknet_rx_cb(struct sk_buff *skb)
308308
{
309309
skb = strip_tag_rx_cb(skb);
310-
#ifdef PSAMPLE_SUPPORT
311-
skb = psample_rx_cb(skb);
310+
#if IS_ENABLED(CONFIG_PSAMPLE)
311+
skb = psample_rx_cb(skb);
312312
#endif
313313
return skb;
314314
}
@@ -324,7 +324,7 @@ static int
324324
ngknet_netif_create_cb(struct net_device *dev)
325325
{
326326
int retv = 0;
327-
#ifdef PSAMPLE_SUPPORT
327+
#if IS_ENABLED(CONFIG_PSAMPLE)
328328
retv = psample_netif_create_cb(dev);
329329
#endif
330330
return retv;
@@ -334,7 +334,7 @@ static int
334334
ngknet_netif_destroy_cb(struct net_device *dev)
335335
{
336336
int retv = 0;
337-
#ifdef PSAMPLE_SUPPORT
337+
#if IS_ENABLED(CONFIG_PSAMPLE)
338338
retv = psample_netif_destroy_cb(dev);
339339
#endif
340340
return retv;
@@ -431,7 +431,7 @@ ngknetcb_init_module(void)
431431
ngknet_rx_cb_register(ngknet_rx_cb);
432432
ngknet_tx_cb_register(ngknet_tx_cb);
433433

434-
#ifdef PSAMPLE_SUPPORT
434+
#if IS_ENABLED(CONFIG_PSAMPLE)
435435
psample_init();
436436
#endif
437437

@@ -446,7 +446,7 @@ ngknetcb_exit_module(void)
446446
ngknet_netif_create_cb_unregister(ngknet_netif_create_cb);
447447
ngknet_netif_destroy_cb_unregister(ngknet_netif_destroy_cb);
448448

449-
#ifdef PSAMPLE_SUPPORT
449+
#if IS_ENABLED(CONFIG_PSAMPLE)
450450
psample_cleanup();
451451
#endif
452452

platform/broadcom/saibcm-modules/sdklt/linux/knetcb/psample-cb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <lkm/lkm.h>
2525
#include <linux/netdevice.h>
2626

27-
//#define PSAMPLE_SUPPORT 1 // TODO: MLI@BRCM - Add this as part of conditional in Makefile
2827
#define PSAMPLE_CB_NAME "psample"
2928

3029
extern int

platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include <linux/if_vlan.h>
4747

4848
/* Enable sflow sampling using psample */
49-
#ifdef PSAMPLE_SUPPORT
49+
#if IS_ENABLED(CONFIG_PSAMPLE)
5050
#include "psample-cb.h"
5151
#endif
5252

@@ -334,7 +334,7 @@ knet_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta,
334334
int chan, kcom_filter_t *kf)
335335
{
336336
/* check for filter callback handler */
337-
#ifdef PSAMPLE_SUPPORT
337+
#if IS_ENABLED(CONFIG_PSAMPLE)
338338
if (strncmp(kf->desc, PSAMPLE_CB_NAME, strlen(PSAMPLE_CB_NAME)) == 0) {
339339
return psample_filter_cb (pkt, size, dev_no, meta, chan, kf);
340340
}
@@ -346,7 +346,7 @@ static int
346346
knet_netif_create_cb(int unit, kcom_netif_t *netif, uint16 spa, struct net_device *dev)
347347
{
348348
int retv = 0;
349-
#ifdef PSAMPLE_SUPPORT
349+
#if IS_ENABLED(CONFIG_PSAMPLE)
350350
retv = psample_netif_create_cb(unit, netif, spa, dev);
351351
#endif
352352
return retv;
@@ -356,7 +356,7 @@ static int
356356
knet_netif_destroy_cb(int unit, kcom_netif_t *netif, uint16 spa, struct net_device *dev)
357357
{
358358
int retv = 0;
359-
#ifdef PSAMPLE_SUPPORT
359+
#if IS_ENABLED(CONFIG_PSAMPLE)
360360
retv = psample_netif_destroy_cb(unit, netif, spa, dev);
361361
#endif
362362
return retv;
@@ -367,7 +367,7 @@ knet_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta,
367367
int chan, kcom_filter_t *kf)
368368
{
369369
/* check for filter callback handler */
370-
#ifdef PSAMPLE_SUPPORT
370+
#if IS_ENABLED(CONFIG_PSAMPLE)
371371
if (strncmp(kf->desc, PSAMPLE_CB_NAME, KCOM_FILTER_DESC_MAX) == 0) {
372372
return psample_filter_cb (pkt, size, dev_no, meta, chan, kf);
373373
}
@@ -379,7 +379,7 @@ static int
379379
knet_netif_create_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
380380
{
381381
int retv = 0;
382-
#ifdef PSAMPLE_SUPPORT
382+
#if IS_ENABLED(CONFIG_PSAMPLE)
383383
retv = psample_netif_create_cb(unit, netif, dev);
384384
#endif
385385
return retv;
@@ -389,7 +389,7 @@ static int
389389
knet_netif_destroy_cb(int unit, kcom_netif_t *netif, struct net_device *dev)
390390
{
391391
int retv = 0;
392-
#ifdef PSAMPLE_SUPPORT
392+
#if IS_ENABLED(CONFIG_PSAMPLE)
393393
retv = psample_netif_destroy_cb(unit, netif, dev);
394394
#endif
395395
return retv;
@@ -427,7 +427,7 @@ _cleanup(void)
427427
bkn_netif_create_cb_unregister(knet_netif_create_cb);
428428
bkn_netif_destroy_cb_unregister(knet_netif_destroy_cb);
429429

430-
#ifdef PSAMPLE_SUPPORT
430+
#if IS_ENABLED(CONFIG_PSAMPLE)
431431
psample_cleanup();
432432
#endif
433433
return 0;
@@ -445,7 +445,7 @@ _init(void)
445445
bkn_tx_skb_cb_register(strip_tag_tx_cb);
446446
}
447447

448-
#ifdef PSAMPLE_SUPPORT
448+
#if IS_ENABLED(CONFIG_PSAMPLE)
449449
psample_init();
450450
#endif
451451
bkn_filter_cb_register(knet_filter_cb);

0 commit comments

Comments
 (0)