can: usb: etas_es58X: add support for ETAS ES58X CAN USB interfaces
PATCH v6 1/1 can: usb: etas_es58X: add support for ETAS ES58X CAN USB interfaces
This driver supports the ES581.4, ES582.1 and ES584.1 interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php).
--
*Warning*: this patch is based on the testing branch of linux-can-next:
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/log/?h=testing
Changes in v6 (2020-11-15):
- Rebase the patch on the testing branch of linux-can-next.
- Rename the helper functions according latest changes
(e.g. can_cc_get_len() -> can_cc_dlc2len())
- Fix comments of enum es58x_physical_layer and enum
es58x_sync_edge.Changes in v5 (2020-11-07):
- Add support for DLC greater than 8.
- All other patches from the previous series were either accepted or dismissed. As such, this is not a serie any more but a single patch.
Changes in v4 (2020-10-17):
- Remove struct es58x_abstracted_can_frame.
branch is already done inside net/can/af_can.c#can_send().
- Fix formating (spaces, comment style).
- Transform macros into static inline functions when possible.
- Fix the ctrlmode_supported flags in es581_4.c and removed misleading comments in enum es58x_samples_per_bit.
- Rename enums according to the type.
- Remove function es58x_can_put_echo_skb().
Reference: https://lkml.org/lkml/2020/10/10/53
Changes in v3 (2020-10-03):
- Remove all the calls to likely() and unlikely().
Reference: https://lkml.org/lkml/2020/9/30/995
Changes in v2 (2020-09-30):
- Fixed -W1 warnings (v1 was tested with GCC -WExtra but not with -W1).
v1 (2020-09-27):
- First release
--- drivers/net/can/usb/Kconfig | 9 + drivers/net/can/usb/Makefile | 1 + drivers/net/can/usb/etas_es58x/Makefile | 3 + drivers/net/can/usb/etas_es58x/es581_4.c | 550 ++++ drivers/net/can/usb/etas_es58x/es581_4.h | 206 ++ drivers/net/can/usb/etas_es58x/es58x_core.c | 2626 +++++++++++++++++++ drivers/net/can/usb/etas_es58x/es58x_core.h | 722 +++++ drivers/net/can/usb/etas_es58x/es58x_fd.c | 656 +++++ drivers/net/can/usb/etas_es58x/es58x_fd.h | 242 ++ 9 files changed, 5015 insertions(+) create mode 100644 drivers/net/can/usb/etas_es58x/Makefile create mode 100644 drivers/net/can/usb/etas_es58x/es581_4.c create mode 100644 drivers/net/can/usb/etas_es58x/es581_4.h create mode 100644 drivers/net/can/usb/etas_es58x/es58x_core.c create mode 100644 drivers/net/can/usb/etas_es58x/es58x_core.h create mode 100644 drivers/net/can/usb/etas_es58x/es58x_fd.c create mode 100644 drivers/net/can/usb/etas_es58x/es58x_fd.h
drivers/net/can/usb/Kconfig +9 -0
@@ -20,6 +20,15 @@ config CAN_ESD_USB2 This driver supports the CAN-USB/2 interface from esd electronic system design gmbh (http://www.esd.eu). +config CAN_ETAS_ES58X + tristate "ETAS ES58X CAN/USB interfaces" + help + This driver supports the ES581.4, ES582.1 and ES584.1 interfaces + from ETAS GmbH (https://www.etas.com/en/products/es58x.php). + + To compile this driver as a module, choose M here: the module + will be called etas_es58x. + config CAN_GS_USB tristate "Geschwister Schneider UG interfaces" help
drivers/net/can/usb/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_CAN_8DEV_USB) += usb_8dev.o obj-$(CONFIG_CAN_EMS_USB) += ems_usb.o obj-$(CONFIG_CAN_ESD_USB2) += esd_usb2.o +obj-$(CONFIG_CAN_ETAS_ES58X) += etas_es58x/ obj-$(CONFIG_CAN_GS_USB) += gs_usb.o obj-$(CONFIG_CAN_KVASER_USB) += kvaser_usb/ obj-$(CONFIG_CAN_MCBA_USB) += mcba_usb.o
drivers/net/can/usb/etas_es58x/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_CAN_ETAS_ES58X) += etas_es58x.o +etas_es58x-y = es58x_core.o es581_4.o es58x_fd.o
drivers/net/can/usb/etas_es58x/es581_4.c new file +550 -0
550 lines not on this page · raw message
drivers/net/can/usb/etas_es58x/es581_4.h new file +206 -0
206 lines not on this page · raw message
drivers/net/can/usb/etas_es58x/es58x_core.c new file +2626 -0
2,219 lines not on this page · raw message
drivers/net/can/usb/etas_es58x/es58x_core.h new file +722 -0
722 lines not on this page · raw message
drivers/net/can/usb/etas_es58x/es58x_fd.c new file +656 -0
656 lines not on this page · raw message
drivers/net/can/usb/etas_es58x/es58x_fd.h new file +242 -0
242 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
base-commit: bff6f1db91e330d7fba56f815cdbc412c75fe163
prerequisite-patch-id: f43825af6723fff787c2a0692443fb88d5740c8f
prerequisite-patch-id: 00e69a83c61b17b59c7aec4a581ff162f28549be
prerequisite-patch-id: d4726c467242aa3c11ab1f621fe2701a29248eca
prerequisite-patch-id: dac3ee5698166b32bc924ecc0e831e6e5d9b13bd
prerequisite-patch-id: 780ec3b28595bf1b038d7a823aa0b30f32d80f1e
prerequisite-patch-id: 65957ad057126a9b0e7253d232e5cbd0438c5c5b
prerequisite-patch-id: 9035d1fecb9a8a5f4ab066be48ad6b38177fa299
prerequisite-patch-id: e326320db7010eece042f5ec8d32aef8801a5028
prerequisite-patch-id: b37c0d9eac5e9455a77e3a360e57d04a8bcff2b7
prerequisite-patch-id: c78f7165bd545689b694bd2d397a33033b64133d
prerequisite-patch-id: baa63332a462829df616c37d701df377fd18ee2f
prerequisite-patch-id: c84ce070019ece01be32617ee21c0a992c1cda58
prerequisite-patch-id: d3adcc60e59b65362509fc81e85a448f4636465f
Signature · 1 line
2.26.2
Part of the diff is not shown here. View the raw message.
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Vincent,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on bff6f1db91e330d7fba56f815cdbc412c75fe163 v5.10-rc3 next-20201113] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vincent-Mailhol/can-usb-etas_es58X-add-support-for-ETAS-ES58X-CAN-USB-interfaces/20201114-232854 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1 config: x86_64-randconfig-a005-20201115 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9a85643cd357e412cff69067bb5c4840e228c2ab)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/80a9b72580bad04e879752fa5c54d278b486e2bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vincent-Mailhol/can-usb-etas_es58X-add-support-for-ETAS-ES58X-CAN-USB-interfaces/20201114-232854 git checkout 80a9b72580bad04e879752fa5c54d278b486e2bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/net/can/usb/etas_es58x/es58x_core.c:745:12: error: use of undeclared identifier 'CAN_MAX_RAW_DLC'
if (dlc > CAN_MAX_RAW_DLC) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:748:22: error: use of undeclared identifier 'CAN_MAX_RAW_DLC'
__func__, dlc, CAN_MAX_RAW_DLC);
^
>> drivers/net/can/usb/etas_es58x/es58x_core.c:753:9: error: implicit declaration of function 'can_fd_dlc2len' [-Werror,-Wimplicit-function-declaration]
len = can_fd_dlc2len(dlc);
^
drivers/net/can/usb/etas_es58x/es58x_core.c:753:9: note: did you mean 'can_dlc2len'?
include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here
u8 can_dlc2len(u8 can_dlc);
^
>> drivers/net/can/usb/etas_es58x/es58x_core.c:756:9: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]
len = can_cc_dlc2len(dlc);
^
drivers/net/can/usb/etas_es58x/es58x_core.c:756:9: note: did you mean 'can_dlc2len'?
include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here
u8 can_dlc2len(u8 can_dlc);
^
>> drivers/net/can/usb/etas_es58x/es58x_core.c:775:3: error: implicit declaration of function 'can_frame_set_cc_len' [-Werror,-Wimplicit-function-declaration]
can_frame_set_cc_len(ccf, dlc, es58x_priv(netdev)->can.ctrlmode);
^
5 errors generated.
--
>> drivers/net/can/usb/etas_es58x/es581_4.c:385:20: error: implicit declaration of function 'can_get_cc_dlc' [-Werror,-Wimplicit-function-declaration]
tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode);
^
>> drivers/net/can/usb/etas_es58x/es581_4.c:387:41: error: no member named 'len' in 'struct can_frame'
memcpy(tx_can_msg->data, cf->data, cf->len);
~~ ^
>> drivers/net/can/usb/etas_es58x/es581_4.c:391:13: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]
msg_len += es581_4_sizeof_rx_tx_msg(*tx_can_msg);
^
drivers/net/can/usb/etas_es58x/es581_4.c:30:29: note: expanded from macro 'es581_4_sizeof_rx_tx_msg'
offsetof(typeof(msg), data[can_cc_dlc2len((msg).dlc)])
^
drivers/net/can/usb/etas_es58x/es581_4.c:391:13: note: did you mean 'can_dlc2len'?
drivers/net/can/usb/etas_es58x/es581_4.c:30:29: note: expanded from macro 'es581_4_sizeof_rx_tx_msg'
offsetof(typeof(msg), data[can_cc_dlc2len((msg).dlc)])
^
include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here
u8 can_dlc2len(u8 can_dlc);
^
>> drivers/net/can/usb/etas_es58x/es581_4.c:515:48: error: use of undeclared identifier 'CAN_CTRLMODE_CC_LEN8_DLC' .ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | CAN_CTRLMODE_CC_LEN8_DLC,
^
4 errors generated.
--
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:119:24: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]
u16 rx_can_msg_len = es58x_fd_sizeof_rx_tx_msg(*rx_can_msg);
^
drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg'
can_cc_dlc2len(__msg.dlc); \
^
drivers/net/can/usb/etas_es58x/es58x_fd.c:119:24: note: did you mean 'can_dlc2len'?
drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg'
can_cc_dlc2len(__msg.dlc); \
^
include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here
u8 can_dlc2len(u8 can_dlc);
^
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:141:11: error: implicit declaration of function 'can_fd_len2dlc' [-Werror,-Wimplicit-function-declaration]
dlc = can_fd_len2dlc(rx_can_msg->len);
^
drivers/net/can/usb/etas_es58x/es58x_fd.c:141:11: note: did you mean 'can_len2dlc'?
include/linux/can/dev.h:193:4: note: 'can_len2dlc' declared here
u8 can_len2dlc(u8 len);
^
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:371:25: error: no member named 'len' in 'struct can_frame'
tx_can_msg->len = cf->len;
~~ ^
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:373:21: error: implicit declaration of function 'can_get_cc_dlc' [-Werror,-Wimplicit-function-declaration]
tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode);
^
drivers/net/can/usb/etas_es58x/es58x_fd.c:374:41: error: no member named 'len' in 'struct can_frame'
memcpy(tx_can_msg->data, cf->data, cf->len);
~~ ^
drivers/net/can/usb/etas_es58x/es58x_fd.c:377:13: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]
msg_len += es58x_fd_sizeof_rx_tx_msg(*tx_can_msg);
^
drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg'
can_cc_dlc2len(__msg.dlc); \
^
>> drivers/net/can/usb/etas_es58x/es58x_fd.c:617:6: error: use of undeclared identifier 'CAN_CTRLMODE_CC_LEN8_DLC'
CAN_CTRLMODE_CC_LEN8_DLC,
^7 errors generated.
vim +/CAN_MAX_RAW_DLC +745 drivers/net/can/usb/etas_es58x/es58x_core.c
718
719 /**
720 * es58x_rx_can_msg() - Handle a received a CAN message.
721 * @netdev: CAN network device.
722 * @timestamp: Hardware time stamp (only relevant in rx branches).
723 * @data: CAN payload.
724 * @can_id: CAN ID.
725 * @es58x_flags: Please refer to enum es58x_flag.
726 * @dlc: Data Length Code (raw value).
727 *
728 * Fill up a CAN skb and post it.
729 *
730 * This function handles the case where the DLC of a classical CAN
731 * frame is greater than CAN_MAX_DLEN (c.f. the len8_dlc field of
732 * struct can_frame).
733 *
734 * Return: zero on success.
735 */
736 int es58x_rx_can_msg(struct net_device *netdev, u64 timestamp, const u8 *data,
737 canid_t can_id, enum es58x_flag es58x_flags, u8 dlc)
738 {
739 struct canfd_frame *cfd;
740 struct can_frame *ccf;
741 struct sk_buff *skb;
742 u8 len;
743 bool is_can_fd = !!(es58x_flags & ES58X_FLAG_FD_DATA);
744
> 745 if (dlc > CAN_MAX_RAW_DLC) {
746 netdev_err(netdev,
747 "%s: DLC is %d but maximum should be %d\n",
748 __func__, dlc, CAN_MAX_RAW_DLC);
749 return -EMSGSIZE;
750 }
751
752 if (is_can_fd) {
> 753 len = can_fd_dlc2len(dlc);
754 skb = alloc_canfd_skb(netdev, &cfd);
755 } else {
> 756 len = can_cc_dlc2len(dlc);
757 skb = alloc_can_skb(netdev, &ccf);
758 cfd = (struct canfd_frame *)ccf;
759 }
760
761 if (!skb) {
762 netdev->stats.rx_dropped++;
763 return -ENOMEM;
764 }
765 cfd->can_id = can_id;
766 if (es58x_flags & ES58X_FLAG_EFF)
767 cfd->can_id |= CAN_EFF_FLAG;
768 if (is_can_fd) {
769 cfd->len = len;
770 if (es58x_flags & ES58X_FLAG_FD_BRS)
771 cfd->flags |= CANFD_BRS;
772 if (es58x_flags & ES58X_FLAG_FD_ESI)
773 cfd->flags |= CANFD_ESI;
774 } else {
> 775 can_frame_set_cc_len(ccf, dlc, es58x_priv(netdev)->can.ctrlmode); 776 if (es58x_flags & ES58X_FLAG_RTR) {
777 ccf->can_id |= CAN_RTR_FLAG;
778 len = 0;
779 }
780 }
781 memcpy(cfd->data, data, len);
782 netdev->stats.rx_packets++;
783 netdev->stats.rx_bytes += len;
784
785 es58x_set_skb_timestamp(netdev, skb, timestamp);
786 netif_rx(skb);
787
788 es58x_priv(netdev)->err_passive_before_rtx_success = 0;
789
790 return 0;
791 }
792
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
The report from Intel's test robot is a false positive.
Quoted 7 lines · kernel test robot
Hi Vincent,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR onbff6f1db91e330d7fba56f815cdbc412c75fe163v5.10-rc3 next-20201113] [If your patch is applied to the wrong git tree, kindly drop us a note.
Patch is applied to the wrong git tree. It is based on the testing branch of linux-can-next:
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/log/?h=testing
Quoted 2 lines
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
I did so (c.f. the base-commit and prerequisite-patch-id tags at the bottom of the patch). While the base-commit was taken into account, the prerequisite-patch-id tags seem to have been ignored.
FYI, I used the below command to generate the patch.
git format-patch --base=bff6f1db91e330d7fba56f815cdbc412c75fe163 -v6 -o patch/v6 HEAD~1
Yours sincerely,
Vincent Mailhol
Quoted 191 lines
url: https://github.com/0day-ci/linux/commits/Vincent-Mailhol/can-usb-etas_es58X-add-support-for-ETAS-ES58X-CAN-USB-interfaces/20201114-232854 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1 config: x86_64-randconfig-a005-20201115 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9a85643cd357e412cff69067bb5c4840e228c2ab)reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# installx86_64cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/80a9b72580bad04e879752fa5c54d278b486e2bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vincent-Mailhol/can-usb-etas_es58X-add-support-for-ETAS-ES58X-CAN-USB-interfaces/20201114-232854 git checkout80a9b72580bad04e879752fa5c54d278b486e2bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:745:12: error: use of undeclared identifier 'CAN_MAX_RAW_DLC'if (dlc > CAN_MAX_RAW_DLC) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:748:22: error: use of undeclared identifier 'CAN_MAX_RAW_DLC' __func__, dlc, CAN_MAX_RAW_DLC); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:753:9: error: implicit declaration of function 'can_fd_dlc2len' [-Werror,-Wimplicit-function-declaration]len = can_fd_dlc2len(dlc); ^ drivers/net/can/usb/etas_es58x/es58x_core.c:753:9: note: did you mean 'can_dlc2len'? include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:756:9: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]len = can_cc_dlc2len(dlc); ^ drivers/net/can/usb/etas_es58x/es58x_core.c:756:9: note: did you mean 'can_dlc2len'? include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:775:3: error: implicit declaration of function 'can_frame_set_cc_len' [-Werror,-Wimplicit-function-declaration]can_frame_set_cc_len(ccf, dlc, es58x_priv(netdev)->can.ctrlmode); ^5 errors generated.
--Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:385:20: error: implicit declaration of function 'can_get_cc_dlc' [-Werror,-Wimplicit-function-declaration]tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:387:41: error: no member named 'len' in 'structcan_frame'memcpy(tx_can_msg->data, cf->data, cf->len); ~~ ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:391:13: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]msg_len += es581_4_sizeof_rx_tx_msg(*tx_can_msg); ^ drivers/net/can/usb/etas_es58x/es581_4.c:30:29: note: expanded from macro 'es581_4_sizeof_rx_tx_msg' offsetof(typeof(msg), data[can_cc_dlc2len((msg).dlc)]) ^ drivers/net/can/usb/etas_es58x/es581_4.c:391:13: note: did you mean 'can_dlc2len'? drivers/net/can/usb/etas_es58x/es581_4.c:30:29: note: expanded from macro 'es581_4_sizeof_rx_tx_msg' offsetof(typeof(msg), data[can_cc_dlc2len((msg).dlc)]) ^ include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:515:48: error: use of undeclared identifier 'CAN_CTRLMODE_CC_LEN8_DLC'.ctrlmode_supported =
CAN_CTRLMODE_LOOPBACK|CAN_CTRLMODE_CC_LEN8_DLC,
^
4 errors generated.
--Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:119:24: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]u16 rx_can_msg_len = es58x_fd_sizeof_rx_tx_msg(*rx_can_msg); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg' can_cc_dlc2len(__msg.dlc); \ ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:119:24: note: did you mean 'can_dlc2len'? drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg' can_cc_dlc2len(__msg.dlc); \ ^ include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:141:11: error: implicit declaration of function 'can_fd_len2dlc' [-Werror,-Wimplicit-function-declaration]dlc = can_fd_len2dlc(rx_can_msg->len); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:141:11: note: did you mean 'can_len2dlc'? include/linux/can/dev.h:193:4: note: 'can_len2dlc' declared here u8 can_len2dlc(u8 len); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:371:25: error: no member named 'len' in 'structcan_frame'tx_can_msg->len = cf->len; ~~ ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:373:21: error: implicit declaration of function 'can_get_cc_dlc' [-Werror,-Wimplicit-function-declaration]tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:374:41: error: no member named 'len' in 'struct can_frame' memcpy(tx_can_msg->data, cf->data, cf->len); ~~ ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:377:13: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration] msg_len += es58x_fd_sizeof_rx_tx_msg(*tx_can_msg); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg' can_cc_dlc2len(__msg.dlc); \ ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:617:6: error: use of undeclared identifier 'CAN_CTRLMODE_CC_LEN8_DLC'CAN_CTRLMODE_CC_LEN8_DLC, ^7 errors generated.
vim +/CAN_MAX_RAW_DLC +745
drivers/net/can/usb/etas_es58x/es58x_core.c718 719 /** 720 * es58x_rx_can_msg() - Handle a received a CAN message. 721 * @netdev: CAN network device. 722 * @timestamp: Hardware time stamp (only relevant in rx branches). 723 * @data: CAN payload. 724 * @can_id: CAN ID. 725 * @es58x_flags: Please refer to enum es58x_flag. 726 * @dlc: Data Length Code (raw value). 727 * 728 * Fill up a CAN skb and post it. 729 * 730 * This function handles the case where the DLC of a classical CAN 731 * frame is greater than CAN_MAX_DLEN (c.f. the len8_dlc field of 732 * struct can_frame). 733 * 734 * Return: zero on success. 735 */ 736 int es58x_rx_can_msg(struct net_device *netdev, u64 timestamp, const u8 *data, 737 canid_t can_id, enum es58x_flag es58x_flags, u8 dlc) 738 { 739 struct canfd_frame *cfd; 740 struct can_frame *ccf; 741 struct sk_buff *skb; 742 u8 len; 743 bool is_can_fd = !!(es58x_flags & ES58X_FLAG_FD_DATA); 744Quoted 1 line
745 if (dlc >
CAN_MAX_RAW_DLC) {746 netdev_err(netdev,
747 "%s: DLC is %d but maximum should be %d\n",748 __func__, dlc, CAN_MAX_RAW_DLC); 749 return -EMSGSIZE; 750 } 751 752 if (is_can_fd) {Quoted 1 line
753 len =
can_fd_dlc2len(dlc);754 skb = alloc_canfd_skb(netdev, &cfd); 755 } else {Quoted 1 line
756 len =
can_cc_dlc2len(dlc);757 skb = alloc_can_skb(netdev, &ccf); 758 cfd = (struct canfd_frame *)ccf; 759 } 760 761 if (!skb) { 762 netdev->stats.rx_dropped++; 763 return -ENOMEM; 764 } 765 cfd->can_id = can_id; 766 if (es58x_flags & ES58X_FLAG_EFF) 767 cfd->can_id |= CAN_EFF_FLAG; 768 if (is_can_fd) { 769 cfd->len = len; 770 if (es58x_flags & ES58X_FLAG_FD_BRS) 771 cfd->flags |= CANFD_BRS; 772 if (es58x_flags & ES58X_FLAG_FD_ESI) 773 cfd->flags |= CANFD_ESI; 774 } else {Quoted 1 line
775
can_frame_set_cc_len(ccf, dlc, es58x_priv(netdev)->can.ctrlmode);776 if (es58x_flags & ES58X_FLAG_RTR) { 777 ccf->can_id |= CAN_RTR_FLAG; 778 len = 0; 779 } 780 } 781 memcpy(cfd->data, data, len); 782 netdev->stats.rx_packets++; 783 netdev->stats.rx_bytes += len; 784 785 es58x_set_skb_timestamp(netdev, skb, timestamp); 786 netif_rx(skb); 787 788 es58x_priv(netdev)->err_passive_before_rtx_success = 0; 789 790 return 0; 791 } 792---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 16 lines · Vincent MAILHOL
The report from Intel's test robot is a false positive.
Quoted 7 lines · kernel test robot
Hi Vincent,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR onbff6f1db91e330d7fba56f815cdbc412c75fe163v5.10-rc3 next-20201113] [If your patch is applied to the wrong git tree, kindly drop us a note.Patch is applied to the wrong git tree. It is based on the testing branch of linux-can-next:
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/log/?h=testingQuoted 2 lines
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
Quoted 7 lines
I did so (c.f. the base-commit and prerequisite-patch-id tags at the bottom of the patch). While the base-commit was taken into account, the prerequisite-patch-id tags seem to have been ignored.
FYI, I used the below command to generate the patch.
git format-patch --base=bff6f1db91e330d7fba56f815cdbc412c75fe163 -v6 -o patch/v6 HEAD~1
Hi Vincent,
Thanks for the feedback, we'll fix the problem asap.
Best Regards,
Rong Chen
Quoted 199 lines
Yours sincerely,
Vincent MailholQuoted 188 lines
url: https://github.com/0day-ci/linux/commits/Vincent-Mailhol/can-usb-etas_es58X-add-support-for-ETAS-ES58X-CAN-USB-interfaces/20201114-232854 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1 config: x86_64-randconfig-a005-20201115 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9a85643cd357e412cff69067bb5c4840e228c2ab)reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# installx86_64cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/80a9b72580bad04e879752fa5c54d278b486e2bb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vincent-Mailhol/can-usb-etas_es58X-add-support-for-ETAS-ES58X-CAN-USB-interfaces/20201114-232854 git checkout80a9b72580bad04e879752fa5c54d278b486e2bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:745:12: error: use of undeclared identifier 'CAN_MAX_RAW_DLC'if (dlc > CAN_MAX_RAW_DLC) { ^ drivers/net/can/usb/etas_es58x/es58x_core.c:748:22: error: use of undeclared identifier 'CAN_MAX_RAW_DLC' __func__, dlc, CAN_MAX_RAW_DLC); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:753:9: error: implicit declaration of function 'can_fd_dlc2len' [-Werror,-Wimplicit-function-declaration]len = can_fd_dlc2len(dlc); ^ drivers/net/can/usb/etas_es58x/es58x_core.c:753:9: note: did you mean 'can_dlc2len'? include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:756:9: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]len = can_cc_dlc2len(dlc); ^ drivers/net/can/usb/etas_es58x/es58x_core.c:756:9: note: did you mean 'can_dlc2len'? include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_core.c:775:3: error: implicit declaration of function 'can_frame_set_cc_len' [-Werror,-Wimplicit-function-declaration]can_frame_set_cc_len(ccf, dlc, es58x_priv(netdev)->can.ctrlmode); ^ 5 errors generated.--
Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:385:20: error: implicit declaration of function 'can_get_cc_dlc' [-Werror,-Wimplicit-function-declaration]tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:387:41: error: no member named 'len' in 'structcan_frame'memcpy(tx_can_msg->data, cf->data, cf->len); ~~ ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:391:13: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]msg_len += es581_4_sizeof_rx_tx_msg(*tx_can_msg); ^ drivers/net/can/usb/etas_es58x/es581_4.c:30:29: note: expanded from macro 'es581_4_sizeof_rx_tx_msg' offsetof(typeof(msg), data[can_cc_dlc2len((msg).dlc)]) ^ drivers/net/can/usb/etas_es58x/es581_4.c:391:13: note: did you mean 'can_dlc2len'? drivers/net/can/usb/etas_es58x/es581_4.c:30:29: note: expanded from macro 'es581_4_sizeof_rx_tx_msg' offsetof(typeof(msg), data[can_cc_dlc2len((msg).dlc)]) ^ include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es581_4.c:515:48: error: use of undeclared identifier 'CAN_CTRLMODE_CC_LEN8_DLC'.ctrlmode_supported =
CAN_CTRLMODE_LOOPBACK|CAN_CTRLMODE_CC_LEN8_DLC,
^
4 errors generated.
--Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:119:24: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration]u16 rx_can_msg_len = es58x_fd_sizeof_rx_tx_msg(*rx_can_msg); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg' can_cc_dlc2len(__msg.dlc); \ ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:119:24: note: did you mean 'can_dlc2len'? drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg' can_cc_dlc2len(__msg.dlc); \ ^ include/linux/can/dev.h:190:4: note: 'can_dlc2len' declared here u8 can_dlc2len(u8 can_dlc); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:141:11: error: implicit declaration of function 'can_fd_len2dlc' [-Werror,-Wimplicit-function-declaration]dlc = can_fd_len2dlc(rx_can_msg->len); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:141:11: note: did you mean 'can_len2dlc'? include/linux/can/dev.h:193:4: note: 'can_len2dlc' declared here u8 can_len2dlc(u8 len); ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:371:25: error: no member named 'len' in 'structcan_frame'tx_can_msg->len = cf->len; ~~ ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:373:21: error: implicit declaration of function 'can_get_cc_dlc' [-Werror,-Wimplicit-function-declaration]tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:374:41: error: no member named 'len' in 'struct can_frame' memcpy(tx_can_msg->data, cf->data, cf->len); ~~ ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:377:13: error: implicit declaration of function 'can_cc_dlc2len' [-Werror,-Wimplicit-function-declaration] msg_len += es58x_fd_sizeof_rx_tx_msg(*tx_can_msg); ^ drivers/net/can/usb/etas_es58x/es58x_fd.c:36:3: note: expanded from macro 'es58x_fd_sizeof_rx_tx_msg' can_cc_dlc2len(__msg.dlc); \ ^Quoted 1 line
Quoted 1 line
drivers/net/can/usb/etas_es58x/es58x_fd.c:617:6: error: use of undeclared identifier 'CAN_CTRLMODE_CC_LEN8_DLC'
CAN_CTRLMODE_CC_LEN8_DLC,
^
7 errors generated.vim +/CAN_MAX_RAW_DLC +745
drivers/net/can/usb/etas_es58x/es58x_core.c718 719 /** 720 * es58x_rx_can_msg() - Handle a received a CAN message. 721 * @netdev: CAN network device. 722 * @timestamp: Hardware time stamp (only relevant in rx branches). 723 * @data: CAN payload. 724 * @can_id: CAN ID. 725 * @es58x_flags: Please refer to enum es58x_flag. 726 * @dlc: Data Length Code (raw value). 727 * 728 * Fill up a CAN skb and post it. 729 * 730 * This function handles the case where the DLC of a classical CAN 731 * frame is greater than CAN_MAX_DLEN (c.f. the len8_dlc field of 732 * struct can_frame). 733 * 734 * Return: zero on success. 735 */ 736 int es58x_rx_can_msg(struct net_device *netdev, u64 timestamp, const u8 *data, 737 canid_t can_id, enum es58x_flag es58x_flags, u8 dlc) 738 { 739 struct canfd_frame *cfd; 740 struct can_frame *ccf; 741 struct sk_buff *skb; 742 u8 len; 743 bool is_can_fd = !!(es58x_flags & ES58X_FLAG_FD_DATA); 744Quoted 1 line
745 if (dlc >
CAN_MAX_RAW_DLC) {746 netdev_err(netdev, 747 "%s: DLC is %d but maximum should be %d\n", 748 __func__, dlc, CAN_MAX_RAW_DLC); 749 return -EMSGSIZE; 750 } 751 752 if (is_can_fd) {Quoted 1 line
753 len =
can_fd_dlc2len(dlc);754 skb = alloc_canfd_skb(netdev, &cfd); 755 } else {Quoted 1 line
756 len =
can_cc_dlc2len(dlc);757 skb = alloc_can_skb(netdev, &ccf); 758 cfd = (struct canfd_frame *)ccf; 759 } 760 761 if (!skb) { 762 netdev->stats.rx_dropped++; 763 return -ENOMEM; 764 } 765 cfd->can_id = can_id; 766 if (es58x_flags & ES58X_FLAG_EFF) 767 cfd->can_id |= CAN_EFF_FLAG; 768 if (is_can_fd) { 769 cfd->len = len; 770 if (es58x_flags & ES58X_FLAG_FD_BRS) 771 cfd->flags |= CANFD_BRS; 772 if (es58x_flags & ES58X_FLAG_FD_ESI) 773 cfd->flags |= CANFD_ESI; 774 } else {Quoted 1 line
775
can_frame_set_cc_len(ccf, dlc, es58x_priv(netdev)->can.ctrlmode);776 if (es58x_flags & ES58X_FLAG_RTR) { 777 ccf->can_id |= CAN_RTR_FLAG; 778 len = 0; 779 } 780 } 781 memcpy(cfd->data, data, len); 782 netdev->stats.rx_packets++; 783 netdev->stats.rx_bytes += len; 784 785 es58x_set_skb_timestamp(netdev, skb, timestamp); 786 netif_rx(skb); 787 788 es58x_priv(netdev)->err_passive_before_rtx_success = 0; 789 790 return 0; 791 } 792Quoted 3 lines
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org_______________________________________________
kbuild-all mailing list -- kbuild-all(a)lists.01.org To unsubscribe send an email to kbuild-all-leave(a)lists.01.org
Marc Kleine-Budde
maintainerQuoted 6 lines · Vincent Mailhol
This driver supports the ES581.4, ES582.1 and ES584.1 interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php).
Co-developed-by Arunachalam Santhanam <[email protected]>Signed-off-by Arunachalam Santhanam <[email protected]>Signed-off-by Vincent Mailhol <[email protected]>
The driver fails to compile with CONFIG_SYSFS switched off
CC [M] drivers/net/can/usb/etas_es58x/es58x_core.odrivers/net/can/usb/etas_es58x/es58x_core.c: In function ‘es58x_init_netdev’:drivers/net/can/usb/etas_es58x/es58x_core.c:2380:32: error: ‘struct netdev_queue’ has no member named ‘dql’
2380 | netdev_get_tx_queue(netdev, 0)->dql.min_limit =
| ^~
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 8 lines · Marc Kleine-Budde
Quoted 6 lines · Vincent Mailhol
This driver supports the ES581.4, ES582.1 and ES584.1 interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php).
Co-developed-by Arunachalam Santhanam <[email protected]>Signed-off-by Arunachalam Santhanam <[email protected]>Signed-off-by Vincent Mailhol <[email protected]>
Quoted 7 lines
The driver fails to compile with
CONFIG_SYSFSswitched offCC [M]
drivers/net/can/usb/etas_es58x/es58x_core.odrivers/net/can/usb/etas_es58x/es58x_core.c: In function ‘es58x_init_netdev’:drivers/net/can/usb/etas_es58x/es58x_core.c:2380:32: error: ‘struct netdev_queue’ has no member named ‘dql’
2380 |netdev_get_tx_queue(netdev, 0)->dql.min_limit =
| ^~
Thanks, nice catch!CONFIG_SYSFS is an expert setting, I totally missed that one. Took me actually a couple of minutes navigating in the menuconfig to find how to remove the option.
The root cause is actually on CONFIG_BQL (which depends onCONFIG_SYSFS).
Reference: https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#L636
Will send a v7 patch right after.
Out of curiosity, how did you find this? Did you find it during a code review or did you just happen to have a .config with CONFIG_SYSFS
Yours sincerely,
Vincent Mailhol
Marc Kleine-Budde
maintainerQuoted 17 lines · Vincent MAILHOL
Quoted 8 lines · Marc Kleine-Budde
Quoted 6 lines · Vincent Mailhol
This driver supports the ES581.4, ES582.1 and ES584.1 interfaces from ETAS GmbH (https://www.etas.com/en/products/es58x.php).
Co-developed-by Arunachalam Santhanam <[email protected]>Signed-off-by Arunachalam Santhanam <[email protected]>Signed-off-by Vincent Mailhol <[email protected]>Quoted 7 lines
The driver fails to compile with
CONFIG_SYSFSswitched offCC [M]
drivers/net/can/usb/etas_es58x/es58x_core.odrivers/net/can/usb/etas_es58x/es58x_core.c: In function ‘es58x_init_netdev’:drivers/net/can/usb/etas_es58x/es58x_core.c:2380:32: error: ‘struct netdev_queue’ has no member named ‘dql’
2380 |netdev_get_tx_queue(netdev, 0)->dql.min_limit =
| ^~
Quoted 4 lines
Thanks, nice catch!
CONFIG_SYSFSis an expert setting, I totally missed that one. Took me actually a couple of minutes navigating in the menuconfig to find how to remove the option.
me too :)
Quoted 8 lines
The root cause is actually on
CONFIG_BQL(which depends onCONFIG_SYSFS).
Reference: https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#L636Will send a v7 patch right after.
Out of curiosity, how did you find this? Did you find it during a code review or did you just happen to have a .config with
CONFIG_SYSFS
During code review, I found that the dql had a ifdef CONFIG_SYSFS.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |