[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210225072306.wdxtzbpowuorhxlp@pengutronix.de>
Date: Thu, 25 Feb 2021 08:23:06 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Dario Binacchi <dariobin@...ero.it>
Cc: linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Wolfgang Grandegger <wg@...ndegger.com>,
YueHaibing <yuehaibing@...wei.com>,
Zhang Qilong <zhangqilong3@...wei.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 5/6] can: c_can: prepare to up the message objects number
Hey Dario,
just a quick note...
On 24.02.2021 23:52:45, Dario Binacchi wrote:
> -struct net_device *alloc_c_can_dev(void)
> +struct net_device *alloc_c_can_dev(int msg_obj_num)
> {
> struct net_device *dev;
> struct c_can_priv *priv;
> + int msg_obj_tx_num = msg_obj_num / 2;
>
> - dev = alloc_candev(sizeof(struct c_can_priv), C_CAN_MSG_OBJ_TX_NUM);
> + dev = alloc_candev(sizeof(struct c_can_priv), msg_obj_tx_num);
> if (!dev)
> return NULL;
>
> priv = netdev_priv(dev);
> - netif_napi_add(dev, &priv->napi, c_can_poll, C_CAN_NAPI_WEIGHT);
> + priv->msg_obj_num = msg_obj_num;
> + priv->msg_obj_rx_num = msg_obj_num - msg_obj_tx_num;
> + priv->msg_obj_rx_first = 1;
> + priv->msg_obj_rx_last =
> + priv->msg_obj_rx_first + priv->msg_obj_rx_num - 1;
> + priv->msg_obj_rx_mask = ((u64)1 << priv->msg_obj_rx_num) - 1;
> +
> + priv->msg_obj_tx_num = msg_obj_tx_num;
> + priv->msg_obj_tx_first = priv->msg_obj_rx_last + 1;
> + priv->msg_obj_tx_last =
> + priv->msg_obj_tx_first + priv->msg_obj_tx_num - 1;
> +
> + priv->dlc = kcalloc(msg_obj_tx_num, sizeof(*priv->dlc), GFP_KERNEL);
You can pass a larger size to alloc_candev() so that it includes the mem
you allocate here.
> + if (!priv->dlc) {
> + free_candev(dev);
> + return NULL;
> + }
> +
> + netif_napi_add(dev, &priv->napi, c_can_poll, priv->msg_obj_rx_num);
Marc
--
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists