X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=module%2Fcan327.c;h=d522c08720563fb9c57b84829f83c9f79bf9386f;hb=90de9535e18d66f5a182dc9689dc7015d551da23;hp=833171cae03ceb55f5397be962cf9979b5dd9f6c;hpb=d9e0b5ad7fbdeb07bdda81950e8c42d42d02621e;p=elmcan.git diff --git a/module/can327.c b/module/can327.c index 833171c..d522c08 100644 --- a/module/can327.c +++ b/module/can327.c @@ -14,14 +14,10 @@ #include #include -#include -#include #include #include -#include #include -#include #include #include #include @@ -57,7 +53,7 @@ #define ELM327_NAPI_WEIGHT 4 -#define ELM327_SIZE_RXBUF 224 +#define ELM327_SIZE_RXBUF 992 #define ELM327_SIZE_TXBUF 32 #define ELM327_CAN_CONFIG_SEND_SFF 0x8000 @@ -444,6 +440,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len) /* The line is likely garbled anyway, so bail. * The main code will restart listening. */ + kfree_skb(skb); return -ENODATA; } @@ -462,6 +459,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len) /* This is not a well-formatted data line. * Assume it's an error message. */ + kfree_skb(skb); return -ENODATA; } @@ -469,6 +467,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len) /* The line is too short to be a valid frame hex dump. * Something interrupted the hex dump or it is invalid. */ + kfree_skb(skb); return -ENODATA; } @@ -520,6 +519,7 @@ static int elm327_parse_frame(struct can327 *elm, size_t len) * However, this will correctly drop the state machine back into * command mode. */ + kfree_skb(skb); return -ENODATA; } @@ -762,6 +762,16 @@ static void elm327_parse_rxbuf(struct can327 *elm, size_t first_new_char_idx) #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) /* Dummy needed to use can_rx_offload */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0) +static unsigned int *can327_mailbox_read(struct can_rx_offload *offload, + struct can_frame *cf, + u32 *timestamp, unsigned int n) +{ + WARN_ON_ONCE(1); /* This function is a dummy, so don't call it! */ + + return -ENOBUFS; +} +#else /* Since 4e9c9484b085 (included in v5.5) */ static struct sk_buff *can327_mailbox_read(struct can_rx_offload *offload, unsigned int n, u32 *timestamp, bool drop) @@ -771,6 +781,7 @@ static struct sk_buff *can327_mailbox_read(struct can_rx_offload *offload, return ERR_PTR(-ENOBUFS); } #endif +#endif static int can327_netdev_open(struct net_device *dev) { @@ -982,7 +993,7 @@ static void can327_ldisc_rx(struct tty_struct *tty, } if (count >= 0) { - netdev_err(elm->dev, "Receive buffer overflowed. Bad chip or wiring?"); + netdev_err(elm->dev, "Receive buffer overflowed. Bad chip or wiring? count = %i", count); elm327_uart_side_failure(elm); @@ -1041,7 +1052,7 @@ static void can327_ldisc_tx_wakeup(struct tty_struct *tty) * or 7/8 of that. Divisors are 1 to 64. * Currently we don't implement support for 7/8 rates. */ -static const u32 can327_bitrate_const[64] = { +static const u32 can327_bitrate_const[] = { 7812, 7936, 8064, 8196, 8333, 8474, 8620, 8771, 8928, 9090, 9259, 9433, 9615, 9803, 10000, 10204, 10416, 10638, 10869, 11111, 11363, 11627, 11904, 12195,