Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions platform/broadcom/saibcm-modules/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ sname:=opennsl
PACKAGE=opennsl-modules
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
KVERSION ?= 6.12.41+deb13-sonic-amd64
KERNVERSION ?= 6.12.41+deb13-sonic
KVER := $(word 1,$(subst -, ,$(KVERSION)))
KVER_ARCH := $(KVER)-sonic-amd64
KVER_COMMON := $(KVER)-common-sonic

# load generic variable handling
-include $(MA_DIR)/include/generic.make
Expand Down Expand Up @@ -64,11 +65,11 @@ kdist_clean: clean
dh_testdir
dh_clean
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 \
KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \
KERNDIR=/usr/src/linux-headers-$(KVER_COMMON) \
KERNEL_SRC=/usr/src/linux-headers-$(KVER_ARCH) \
$(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean
SDK=$(realpath .) BUILD_KNET_CB=1 \
KDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
KDIR=/usr/src/linux-headers-$(KVER_COMMON) \
$(MAKE) -C sdklt/ clean
# rm -f driver/*.o driver/*.ko
#
Expand All @@ -87,25 +88,25 @@ build-arch-stamp:
dh_testdir

# create links
cd /; sudo mkdir -p /lib/modules/$(KERNVERSION)-amd64
cd /; sudo rm /lib/modules/$(KERNVERSION)-amd64/build
cd /; sudo rm /lib/modules/$(KERNVERSION)-amd64/source
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-common/ /lib/modules/$(KERNVERSION)-amd64/source
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/ /lib/modules/$(KERNVERSION)-amd64/build
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/include/generated/ /usr/src/linux-headers-$(KERNVERSION)-common/include/generated
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/arch/x86/include/generated/ /usr/src/linux-headers-$(KERNVERSION)-common/arch/x86/include/generated
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/arch/x86/module.lds /usr/src/linux-headers-$(KERNVERSION)-common/arch/x86/module.lds
cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/include/config/ /usr/src/linux-headers-$(KERNVERSION)-common/include/config
cd /; sudo cp /usr/src/linux-headers-$(KERNVERSION)-amd64/Module.symvers /usr/src/linux-headers-$(KERNVERSION)-common/Module.symvers
cd /; sudo mkdir -p /lib/modules/$(KVER_ARCH)
cd /; sudo rm /lib/modules/$(KVER_ARCH)/build
cd /; sudo rm /lib/modules/$(KVER_ARCH)/source
cd /; sudo ln -s /usr/src/linux-headers-$(KVER_COMMON)/ /lib/modules/$(KVER_ARCH)/source
cd /; sudo ln -s /usr/src/linux-headers-$(KVER_ARCH)/ /lib/modules/$(KVER_ARCH)/build
cd /; sudo ln -s /usr/src/linux-headers-$(KVER_ARCH)/include/generated/ /usr/src/linux-headers-$(KVER_COMMON)/include/generated
cd /; sudo ln -s /usr/src/linux-headers-$(KVER_ARCH)/arch/x86/include/generated/ /usr/src/linux-headers-$(KVER_COMMON)/arch/x86/include/generated
cd /; sudo ln -s /usr/src/linux-headers-$(KVER_ARCH)/arch/x86/module.lds /usr/src/linux-headers-$(KVER_COMMON)/arch/x86/module.lds
cd /; sudo ln -s /usr/src/linux-headers-$(KVER_ARCH)/include/config/ /usr/src/linux-headers-$(KVER_COMMON)/include/config
cd /; sudo cp /usr/src/linux-headers-$(KVER_ARCH)/Module.symvers /usr/src/linux-headers-$(KVER_COMMON)/Module.symvers

# Add here command to compile/build the package.
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 \
KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \
KERNDIR=/usr/src/linux-headers-$(KVER_COMMON) \
KERNEL_SRC=/usr/src/linux-headers-$(KVER_ARCH) \
$(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6

SDK=$(realpath .) BUILD_KNET_CB=1 \
KDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
KDIR=/usr/src/linux-headers-$(KVER_COMMON) \
$(MAKE) -C sdklt/ kmod

touch $@
Expand All @@ -132,12 +133,12 @@ clean:

# Add here commands to clean up after the build process.
SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 \
KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \
KERNDIR=/usr/src/linux-headers-$(KVER_COMMON) \
KERNEL_SRC=/usr/src/linux-headers-$(KVER_ARCH) \
$(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean

SDK=$(realpath .) BUILD_KNET_CB=1 \
KDIR=/usr/src/linux-headers-$(KERNVERSION)-common \
KDIR=/usr/src/linux-headers-$(KVER_COMMON) \
$(MAKE) -C sdklt/ clean

dh_clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ
include ${SDK}/make/Makefile.linux-x86-generic-common-2_6

ifeq (,$(KFLAGS))
KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -fno-pie -mcmodel=kernel -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign
KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror=implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -fno-pie -mcmodel=kernel -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -g -Wdeclaration-after-statement -Wno-pointer-sign \
-Wno-declaration-after-statement -Wno-missing-prototypes -Wno-array-bounds -fcf-protection

ifneq (1,$(USE_CLANG))
KFLAGS += -funit-at-a-time -maccumulate-outgoing-args
endif
Expand Down
6 changes: 3 additions & 3 deletions platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ngbde_dmamem_kapi_alloc(ngbde_dmactrl_t *dmactrl, ngbde_dmamem_t *dmamem)
dmamem->baddr = baddr;

/* Write small signature for debug purposes */
strlcpy((char *)vaddr, "DMA_KAPI", dmactrl->size);
strscpy((char *)vaddr, "DMA_KAPI", dmactrl->size);

if (dma_debug) {
printk("DMA: Allocated %d KB of KAPI memory at 0x%08lx\n",
Expand Down Expand Up @@ -138,7 +138,7 @@ ngbde_dmamem_pgmem_alloc(ngbde_dmactrl_t *dmactrl, ngbde_dmamem_t *dmamem)
}

/* Write small signature for debug purposes */
strlcpy((char *)vaddr, "DMA_PGMEM", dmactrl->size);
strscpy((char *)vaddr, "DMA_PGMEM", dmactrl->size);

if (dma_debug) {
printk("DMA: Allocated %d KB of PGMEM memory at 0x%08lx\n",
Expand Down Expand Up @@ -177,7 +177,7 @@ ngbde_dmamem_alloc(ngbde_dmactrl_t *dmactrl, ngbde_dmamem_t *dmamem)
/* Always allow KAPI when CMA is available */
kapi = 1;
#else
if (dmactrl->size <= (1 << (MAX_ORDER - 1 + PAGE_SHIFT))) {
if (dmactrl->size <= (1 << (MAX_PAGE_ORDER - 1 + PAGE_SHIFT))) {
kapi = 1;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ ngbde_intr_alloc(int kdev, unsigned int num_irq)
}

/* Use new API if available (Linux 4.8 and newer) */
irq_types = PCI_IRQ_LEGACY;
irq_types = PCI_IRQ_INTX;
if (sd->use_msi) {
irq_types |= PCI_IRQ_MSI;
if (sd->use_msi == NGBDE_MSI_T_MSIX) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ iproc_cmicd_probe(struct platform_device *pldev)
*
* \retval 0 No errors
*/
static int
static void
iproc_cmicd_remove(struct platform_device *pldev)
{
return 0;
return;
}

/*! Matching compatible property with device tree. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
******************************************************************************/

/*! Maximum size the kernel can allocate in a single allocation. */
#define MEM_CHUNK_SIZE_MAX (1 << (MAX_ORDER - 1 + PAGE_SHIFT))
#define MEM_CHUNK_SIZE_MAX (1 << (MAX_PAGE_ORDER - 1 + PAGE_SHIFT))

/*! Default block size we wil request from the kernel. */
#define MEM_CHUNK_SIZE_DEFAULT (512 * ONE_KB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ static inline void page_ref_dec(struct page *page)
#define DMA_FORCE_CONTIGUOUS DMA_ATTR_FORCE_CONTIGUOUS
#endif

#ifndef PCI_IRQ_LEGACY
#ifndef PCI_IRQ_INTX
/* Emulate new IRQ API if not available */
#define PCI_IRQ_LEGACY (1 << 0)
#define PCI_IRQ_INTX (1 << 0)
#define PCI_IRQ_MSI (1 << 1)
#define PCI_IRQ_MSIX (1 << 2)
static inline int
Expand All @@ -154,7 +154,7 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
return 1;
}
}
if (flags & PCI_IRQ_LEGACY) {
if (flags & PCI_IRQ_INTX) {
return 1;
}
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ ngknet_filter_cb_register_by_name(ngknet_filter_cb_f filter_cb, const char *desc
return -1;
}
fcb->cb = filter_cb;
strlcpy(fcb->desc, desc, sizeof(fcb->desc));
strscpy(fcb->desc, desc, sizeof(fcb->desc));
list_add_tail(&fcb->list, &callback_ctrl.filter_cb_list);

/* Check if any existing filter matches the registered name */
Expand Down
16 changes: 8 additions & 8 deletions platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,15 +1684,15 @@ static const struct net_device_ops ngknet_netdev_ops = {
static void
ngknet_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *drvinfo)
{
strlcpy(drvinfo->driver, "linux_ngknet", sizeof(drvinfo->driver));
strscpy(drvinfo->driver, "linux_ngknet", sizeof(drvinfo->driver));
snprintf(drvinfo->version, sizeof(drvinfo->version), "%d", NGKNET_IOC_VERSION);
strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info));
strscpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strscpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info));
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
static int
ngknet_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info)
ngknet_get_ts_info(struct net_device *ndev, struct kernel_ethtool_ts_info *info)
{
int rv;

Expand Down Expand Up @@ -1947,7 +1947,7 @@ ngknet_dev_info_get(int dn)
}

dev->dev_info.dev_no = dn;
strlcpy(dev->dev_info.type_str, drv_ops[dev->pdma_dev.dev_type]->drv_desc,
strscpy(dev->dev_info.type_str, drv_ops[dev->pdma_dev.dev_type]->drv_desc,
sizeof(dev->dev_info.type_str));
dev->dev_info.vdev = dev->vdev;
return SHR_E_NONE;
Expand Down Expand Up @@ -2552,7 +2552,7 @@ ngknet_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
DBG_CMD(("NGKNET_DEV_INIT\n"));
if (dev->flags & NGKNET_DEV_ACTIVE) {
DBG_CMD(("NGKNET_DEV_INIT, retrieve device configurations.\n"));
strlcpy(dev_cfg->name, pdev->name, sizeof(dev_cfg->name));
strscpy(dev_cfg->name, pdev->name, sizeof(dev_cfg->name));
dev_cfg->dev_id = pdev->dev_id;
dev_cfg->nb_grp = pdev->ctrl.nb_grp;
dev_cfg->bm_grp = pdev->ctrl.bm_grp;
Expand All @@ -2578,15 +2578,15 @@ ngknet_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break;
}
memset(pdev, 0, sizeof(*pdev));
strlcpy(pdev->name, dev_cfg->name, sizeof(pdev->name));
strscpy(pdev->name, dev_cfg->name, sizeof(pdev->name));
pdev->dev_id = dev_cfg->dev_id;
for (dt = 0; dt < drv_num; dt++) {
if (!drv_ops[dt]) {
continue;
}
if (!strcasecmp(dev_cfg->type_str, drv_ops[dt]->drv_desc)) {
pdev->dev_type = dt;
strlcpy(dev->dev_info.var_str, dev_cfg->var_str,
strscpy(dev->dev_info.var_str, dev_cfg->var_str,
sizeof(dev->dev_info.var_str));
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#if _SIMPLE_MEMORY_ALLOCATION_
#include <linux/dma-mapping.h>
#ifndef CONFIG_CMA
#define DMA_MAX_ALLOC_SIZE (1 << (MAX_ORDER - 1 + PAGE_SHIFT)) /* Maximum size the kernel can allocate in one allocation */
#define DMA_MAX_ALLOC_SIZE (1 << (MAX_PAGE_ORDER - 1 + PAGE_SHIFT)) /* Maximum size the kernel can allocate in one allocation */
#endif /* !CONFIG_CMA */
#endif /* _SIMPLE_MEMORY_ALLOCATION_ */

Expand Down Expand Up @@ -139,7 +139,7 @@
#endif

#ifndef KMALLOC_MAX_SIZE
#define KMALLOC_MAX_SIZE (1UL << (MAX_ORDER - 1 + PAGE_SHIFT))
#define KMALLOC_MAX_SIZE (1UL << (MAX_PAGE_ORDER - 1 + PAGE_SHIFT))
#endif

/* Compatibility */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7619,15 +7619,15 @@ bkn_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
return;
}

strlcpy(drvinfo->driver, "bcm-knet", sizeof(drvinfo->driver));
strscpy(drvinfo->driver, "bcm-knet", sizeof(drvinfo->driver));
snprintf(drvinfo->version, sizeof(drvinfo->version), "%d", KCOM_VERSION);
strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info));
strscpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
strscpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info));
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
static int
bkn_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
bkn_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *info)
{
bkn_priv_t *priv;
bkn_switch_info_t *sinfo;
Expand Down Expand Up @@ -11099,7 +11099,7 @@ bkn_filter_cb_register_by_name(knet_filter_cb_f filter_cb, char *filter_name)
return -1;
}
fcb->cb = filter_cb;
strlcpy(fcb->desc, filter_name, sizeof(fcb->desc));
strscpy(fcb->desc, filter_name, sizeof(fcb->desc));
list_add_tail(&fcb->list, &filter_cb_list);

/* Check if any existing filter matches the registered name */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ dcb0_paddr_get(dcb_t *dcb)
* Notes:
* Function made global to resolve compiler link issue.
*/
soc_rx_reason_t *
static soc_rx_reason_t *
dcb0_rx_reason_map_get(dcb_op_t *dcb_op, dcb_t *dcb)
{
COMPILER_REFERENCE(dcb);
Expand Down