Subject: Re: [PATCH net] drivers/net/wan/hdlc_cisco: Add hard_header_len

From: Krzysztof Hałasa <[email-masked]>
Date: Fri, 28 Aug 2020 12:37:37 +0200

Hello Xie,

Xie He <[email-masked]> writes:

> This driver didn't set hard_header_len. This patch sets hard_header_len
> for it according to its header_ops->create function.

BTW it's 4 bytes long:

struct hdlc_header {
        u8 address;
        u8 control;
        __be16 protocol;
}__packed;

OTOH hdlc_setup_dev() initializes hard_header_len to 16,
but in this case I guess 4 bytes are better.

Acked-by: Krzysztof Halasa <[email-masked]>

> Cc: Martin Schiller <[email-masked]>
> Signed-off-by: Xie He <[email-masked]>
> ---

> --- a/drivers/net/wan/hdlc_cisco.c
> +++ b/drivers/net/wan/hdlc_cisco.c
> @@ -370,6 +370,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
>  		memcpy(&state(hdlc)->settings, &new_settings, size);
>  		spin_lock_init(&state(hdlc)->lock);
>  		dev->header_ops = &cisco_header_ops;
> +		dev->hard_header_len = sizeof(struct hdlc_header);
>  		dev->type = ARPHRD_CISCO;
>  		call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
>  		netif_dormant_on(dev);

-- 
Krzysztof Halasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa