Altera TSE: Fix Sparse errors and misc issues
Subsystems (3)
v2 cover Altera TSE: Fix Sparse errors and misc issues
This is version 2 of a patch series to correct sparse errors, cppcheck warnings, and workaound a multicast filtering issue in the Altera TSE Ethernet driver. Multicast filtering is not working as expected, so if present in the hardware will not be used and promiscuous mode enabled instead. This workaround will be replaced with a working solution when completely debugged, integrated and tested.
Version 2 is different from the first submission by breaking out the workaround as a seperate patch and addressing a few structure instance declarations by making them const per review comments.
If you find this patch acceptable, please consider this for inclusion into the Altera TSE driver source code.
Thank you
Vince
Vince Bridgers (2):
Altera TSE: Fix sparse errors and warnings
Altera TSE: Disable Multicast filtering to workaround problem
drivers/net/ethernet/altera/Makefile | 1 + drivers/net/ethernet/altera/altera_msgdma.c | 110 ++++++------- drivers/net/ethernet/altera/altera_msgdmahw.h | 13 +- drivers/net/ethernet/altera/altera_sgdma.c | 181 +++++++++++----------- drivers/net/ethernet/altera/altera_sgdmahw.h | 26 ++-- drivers/net/ethernet/altera/altera_tse.h | 47 ++++++ drivers/net/ethernet/altera/altera_tse_ethtool.c | 108 ++++++++----- drivers/net/ethernet/altera/altera_tse_main.c | 133 +++++++++------- drivers/net/ethernet/altera/altera_utils.c | 20 +-- drivers/net/ethernet/altera/altera_utils.h | 8 +- 10 files changed, 372 insertions(+), 275 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/2 Altera TSE: Fix sparse errors and warnings
This patch fixes the many sparse errors and warnings contained in the initial submission of the Altera Triple Speed Ethernet driver, and a few minor cppcheck warnings. Changes are tested on ARM and NIOS2 example designs, and compile tested against multiple architectures. Typical issues addressed were as follows:
altera_tse_ethtool.c:136:19: warning: incorrect type in argument
1 (different address spaces)
altera_tse_ethtool.c:136:19: expected void const volatile
[noderef] <asn:2>*addr
altera_tse_ethtool.c:136:19: got unsigned int *<noident>
...
altera_sgdma.c:129:31: warning: cast removes address space of
expression
---
V2: - Break out workaround for multicast filtering into seperate patch
per comments from Tobias
- Make altera_dmaops structure instances const per comments from Tobias
--- drivers/net/ethernet/altera/Makefile | 1 + drivers/net/ethernet/altera/altera_msgdma.c | 110 ++++++------- drivers/net/ethernet/altera/altera_msgdmahw.h | 13 +- drivers/net/ethernet/altera/altera_sgdma.c | 181 +++++++++++----------- drivers/net/ethernet/altera/altera_sgdmahw.h | 26 ++-- drivers/net/ethernet/altera/altera_tse.h | 47 ++++++ drivers/net/ethernet/altera/altera_tse_ethtool.c | 108 ++++++++----- drivers/net/ethernet/altera/altera_tse_main.c | 128 ++++++++------- drivers/net/ethernet/altera/altera_utils.c | 20 +-- drivers/net/ethernet/altera/altera_utils.h | 8 +- 10 files changed, 367 insertions(+), 275 deletions(-)
drivers/net/ethernet/altera/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_ALTERA_TSE) += altera_tse.o altera_tse-objs := altera_tse_main.o altera_tse_ethtool.o \ altera_msgdma.o altera_sgdma.o altera_utils.o +ccflags-y += -D__CHECK_ENDIAN__
drivers/net/ethernet/altera/altera_msgdma.c +55 -55
198 lines not on this page · raw message
drivers/net/ethernet/altera/altera_msgdmahw.h +4 -9
@@ -17,15 +17,6 @@#ifndef __ALTERA_MSGDMAHW_H__#define __ALTERA_MSGDMAHW_H__ -/* mSGDMA standard descriptor format -*/ -struct msgdma_desc { -u32 read_addr;/* data buffer source address */ -u32 write_addr;/* data buffer destination address */ -u32 len;/* the number of bytes to transfer per descriptor */ -u32 control;/* characteristics of the transfer */ -}; -/* mSGDMA extended descriptor format */ struct msgdma_extended_desc {
@@ -159,6 +150,10 @@ struct msgdma_response {u32 status; }; +#define msgdma_respoffs (a) (offsetof(struct msgdma_response, a)) +#define msgdma_csroffs (a) (offsetof(struct msgdma_csr, a)) +#define msgdma_descroffs (a) (offsetof(struct msgdma_extended_desc, a)) +/* mSGDMA response register bit definitions */ #define MSGDMA_RESP_EARLY_TERM BIT(8)
drivers/net/ethernet/altera/altera_sgdma.c +90 -91
374 lines not on this page · raw message
drivers/net/ethernet/altera/altera_sgdmahw.h +14 -12
@@ -19,16 +19,16 @@/* SGDMA descriptor structure */ struct sgdma_descrip { -unsigned int raddr;/* address of data to be read */ -unsigned int pad1; -unsigned int waddr; -unsigned int pad2; -unsigned int next; -unsigned int pad3; -unsigned short bytes; -unsigned char rburst; -unsigned char wburst; -unsigned short bytes_xferred;/* 16 bits, bytes xferred */ +u32 raddr;/* address of data to be read */ +u32 pad1; +u32 waddr; +u32 pad2; +u32 next; +u32 pad3; +u16 bytes; +u8 rburst; +u8 wburst; +u16 bytes_xferred;/* 16 bits, bytes xferred */ /* bit 0: error * bit 1: length error
@@ -39,7 +39,7 @@ struct sgdma_descrip {* bit 6: reserved * bit 7: status eop for recv case */ -unsigned char status; +u8 status;/* bit 0: eop * bit 1: read_fixed
@@ -47,7 +47,7 @@ struct sgdma_descrip {* bits 3,4,5,6: Channel (always 0) * bit 7: hardware owned */ -unsigned char control; +u8 control; } __packed;
@@ -101,6 +101,8 @@ struct sgdma_csr {u32 pad3[3 ]; }; +#define sgdma_csroffs (a) (offsetof(struct sgdma_csr, a)) +#define sgdma_descroffs (a) (offsetof(struct sgdma_descrip, a))#define SGDMA_STSREG_ERR BIT(0)/* Error */ #define SGDMA_STSREG_EOP BIT(1)/* EOP */
drivers/net/ethernet/altera/altera_tse.h +47 -0
57 lines not on this page · raw message
drivers/net/ethernet/altera/altera_tse_ethtool.c +71 -37
139 lines not on this page · raw message
drivers/net/ethernet/altera/altera_tse_main.c +71 -57
313 lines not on this page · raw message
drivers/net/ethernet/altera/altera_utils.c +10 -10
@@ -17,28 +17,28 @@#include "altera_tse.h" #include "altera_utils.h" -void tse_set_bit (void __iomem *ioaddr,u32 bit_mask) +void tse_set_bit (void __iomem *ioaddr,size_t offs,u32 bit_mask) { -u32 value =ioread32 (ioaddr); +u32 value =csrrd32 (ioaddr, offs); value |= bit_mask; -iowrite32 (value, ioaddr); +csrwr32 (value, ioaddr, offs); } -void tse_clear_bit (void __iomem *ioaddr,u32 bit_mask) +void tse_clear_bit (void __iomem *ioaddr,size_t offs,u32 bit_mask) { -u32 value =ioread32 (ioaddr); +u32 value =csrrd32 (ioaddr, offs); value &= ~bit_mask; -iowrite32 (value, ioaddr); +csrwr32 (value, ioaddr, offs); } -int tse_bit_is_set (void __iomem *ioaddr,u32 bit_mask) +int tse_bit_is_set (void __iomem *ioaddr,size_t offs,u32 bit_mask) { -u32 value =ioread32 (ioaddr); +u32 value =csrrd32 (ioaddr, offs);return (value & bit_mask) ?1 :0 ; } -int tse_bit_is_clear (void __iomem *ioaddr,u32 bit_mask) +int tse_bit_is_clear (void __iomem *ioaddr,size_t offs,u32 bit_mask) { -u32 value =ioread32 (ioaddr); +u32 value =csrrd32 (ioaddr, offs);return (value & bit_mask) ?0 :1 ; }
drivers/net/ethernet/altera/altera_utils.h +4 -4
@@ -19,9 +19,9 @@#ifndef __ALTERA_UTILS_H__#define __ALTERA_UTILS_H__ -void tse_set_bit (void __iomem *ioaddr,u32 bit_mask); -void tse_clear_bit (void __iomem *ioaddr,u32 bit_mask); -int tse_bit_is_set (void __iomem *ioaddr,u32 bit_mask); -int tse_bit_is_clear (void __iomem *ioaddr,u32 bit_mask); +void tse_set_bit (void __iomem *ioaddr,size_t offs,u32 bit_mask); +void tse_clear_bit (void __iomem *ioaddr,size_t offs,u32 bit_mask); +int tse_bit_is_set (void __iomem *ioaddr,size_t offs,u32 bit_mask); +int tse_bit_is_clear (void __iomem *ioaddr,size_t offs,u32 bit_mask);#endif /* __ALTERA_UTILS_H__*/
Signature · 1 line
1.7.9.5
PATCH v2 2/2 Altera TSE: Disable Multicast filtering to workaround problem
In reply to Vince BridgersThis patch disables multicast hash filtering if present in the hardware and uses promiscuous mode instead until the problem with multicast filtering has been debugged, integrated and tested.
---
V2: - Create seperate patch from V1 for multicast filtering
workaround
--- drivers/net/ethernet/altera/altera_tse_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/altera/altera_tse_main.c +5 -0
@@ -1376,6 +1376,11 @@ static int altera_tse_probe(struct platform_device *pdev)of_property_read_bool (pdev->dev.of_node,"altr,has-hash-multicast-filter" ); +/* Set hash filter to not set for now until the +* multicast filter receive issue is debugged +*/ + priv->hash_filter =0 ; +/* get supplemental address settings for this instance */ priv->added_unicast = of_property_read_bool(pdev->dev.of_node,
Signature · 1 line
1.7.9.5
David Miller
maintainerFrom: Vince Bridgers <[email protected]>
Date: Wed, 14 May 2014 14:38:35 -0500
Quoted 7 lines
This is version 2 of a patch series to correct sparse errors, cppcheck warnings, and workaound a multicast filtering issue in the Altera TSE Ethernet driver. Multicast filtering is not working as expected, so if present in the hardware will not be used and promiscuous mode enabled instead. This workaround will be replaced with a working solution when completely debugged, integrated and tested.
Quoted 6 lines
Version 2 is different from the first submission by breaking out the workaround as a seperate patch and addressing a few structure instance declarations by making them const per review comments.
If you find this patch acceptable, please consider this for inclusion into the Altera TSE driver source code.
Series applied to 'net', thanks.