JacobCrabill commented on code in PR #6057: URL: https://github.com/apache/incubator-nuttx/pull/6057#discussion_r866064551
########## arch/arm/src/stm32h7/stm32_fdcan_sock.c: ########## @@ -0,0 +1,2522 @@ +/**************************************************************************** + * arch/arm/src/stm32h7/stm32_fdcan_sock.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#include <debug.h> +#include <errno.h> + +#include <nuttx/can.h> +#include <nuttx/wdog.h> +#include <nuttx/irq.h> +#include <nuttx/arch.h> +#include <nuttx/wqueue.h> +#include <nuttx/signal.h> +#include <nuttx/net/netdev.h> +#include <nuttx/net/can.h> +#include <netpacket/can.h> + +#ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE +#include <sys/time.h> +#endif + +#include <arch/board/board.h> + +#include "arm_internal.h" +#include "chip.h" +#include "stm32.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* General Configuration ****************************************************/ + +#if !defined(CONFIG_SCHED_WORKQUEUE) +# error Work queue support is required; HPWORK is recommended +#endif + +#ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE +# define TX_TIMEOUT_WQ +#endif + +/* If processing is not done at the interrupt level, then work queue support + * is required. + * + * The high-priority work queue is suggested in order to minimize latency of + * critical Rx/Tx transactions on the CAN bus. + */ + +#define CANWORK HPWORK Review Comment: > Can we make this configurable with default LPWORK enabled ? Good point. Implemented. > Bu, the lp work will hunt performance in our test since it's priority is same as normal thread by default: Agreed; for my use case, I will continue to use HPWORK (there's no blocking operations in the socket stack that I'm aware of) so I'm not very concerned about a deadlock here. I think it's fine to have the option to choose LPWORK or HPWORK. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
