Re: [PATCH 8/8] net: introduce "include/linux/if_rmnet.h"

From: Bjorn Andersson
Date: Mon May 20 2019 - 13:20:10 EST


On Mon 20 May 06:53 PDT 2019, Alex Elder wrote:

> The IPA driver requires some (but not all) symbols defined in
> "drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h". Create a new
> public header file "include/linux/if_rmnet.h" and move the needed
> definitions there.
>

Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

> Signed-off-by: Alex Elder <elder@xxxxxxxxxx>
> ---
> .../ethernet/qualcomm/rmnet/rmnet_handlers.c | 1 +
> .../net/ethernet/qualcomm/rmnet/rmnet_map.h | 31 -------------
> .../qualcomm/rmnet/rmnet_map_command.c | 1 +
> .../ethernet/qualcomm/rmnet/rmnet_map_data.c | 1 +
> .../net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 1 +
> include/linux/if_rmnet.h | 45 +++++++++++++++++++
> 6 files changed, 49 insertions(+), 31 deletions(-)
> create mode 100644 include/linux/if_rmnet.h
>
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
> index 5fff6c78ecd5..8e00e14f4ac9 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
> @@ -18,6 +18,7 @@
> #include <linux/netdev_features.h>
> #include <linux/if_arp.h>
> #include <net/sock.h>
> +#include <linux/if_rmnet.h>
> #include "rmnet_private.h"
> #include "rmnet_config.h"
> #include "rmnet_vnd.h"
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
> index 775b98d34e94..d101cabb04c3 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
> @@ -39,37 +39,6 @@ enum rmnet_map_commands {
> RMNET_MAP_COMMAND_ENUM_LENGTH
> };
>
> -struct rmnet_map_header {
> - u8 cmd_pad_len; /* RMNET_MAP_* */
> - u8 mux_id;
> - __be16 pkt_len;
> -} __aligned(1);
> -
> -#define RMNET_MAP_CMD_FMASK GENMASK(0, 0) /* 0: data; 1: cmd */
> -#define RMNET_MAP_RESERVED_FMASK GENMASK(1, 1)
> -#define RMNET_MAP_PAD_LEN_FMASK GENMASK(7, 2)
> -
> -struct rmnet_map_dl_csum_trailer {
> - u8 reserved1;
> - u8 flags; /* RMNET_MAP_DL_* */
> - __be16 csum_start_offset;
> - __be16 csum_length;
> - __be16 csum_value;
> -} __aligned(1);
> -
> -#define RMNET_MAP_DL_CSUM_VALID_FMASK GENMASK(0, 0)
> -#define RMNET_MAP_DL_RESERVED_FMASK GENMASK(7, 1)
> -
> -struct rmnet_map_ul_csum_header {
> - __be16 csum_start_offset;
> - __be16 csum_info; /* RMNET_MAP_UL_* */
> -} __aligned(1);
> -
> -/* NOTE: These field masks are defined in CPU byte order */
> -#define RMNET_MAP_UL_CSUM_INSERT_FMASK GENMASK(13, 0)
> -#define RMNET_MAP_UL_CSUM_UDP_FMASK GENMASK(14, 14) /* 0: IP; 1: UDP */
> -#define RMNET_MAP_UL_CSUM_ENABLED_FMASK GENMASK(15, 15)
> -
> #define RMNET_MAP_COMMAND_REQUEST 0
> #define RMNET_MAP_COMMAND_ACK 1
> #define RMNET_MAP_COMMAND_UNSUPPORTED 2
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c
> index f675f47c3495..6832c5939cae 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c
> @@ -11,6 +11,7 @@
> */
>
> #include <linux/netdevice.h>
> +#include <linux/if_rmnet.h>
> #include "rmnet_config.h"
> #include "rmnet_map.h"
> #include "rmnet_private.h"
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> index 61b7dbab2056..370aee7402e0 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> @@ -18,6 +18,7 @@
> #include <linux/ip.h>
> #include <linux/ipv6.h>
> #include <net/ip6_checksum.h>
> +#include <linux/if_rmnet.h>
> #include "rmnet_config.h"
> #include "rmnet_map.h"
> #include "rmnet_private.h"
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> index d11c16aeb19a..6b39d4d8e523 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> @@ -17,6 +17,7 @@
> #include <linux/etherdevice.h>
> #include <linux/if_arp.h>
> #include <net/pkt_sched.h>
> +#include <linux/if_rmnet.h>
> #include "rmnet_config.h"
> #include "rmnet_handlers.h"
> #include "rmnet_private.h"
> diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h
> new file mode 100644
> index 000000000000..ae60472ecc79
> --- /dev/null
> +++ b/include/linux/if_rmnet.h
> @@ -0,0 +1,45 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
> + * Copyright (C) 2019 Linaro Ltd.
> + */
> +#ifndef _LINUX_IF_RMNET_H_
> +#define _LINUX_IF_RMNET_H_
> +
> +#include <linux/types.h>
> +
> +/* Header structure that precedes packets in ETH_P_MAP protocol */
> +struct rmnet_map_header {
> + u8 cmd_pad_len; /* RMNET_MAP_* */
> + u8 mux_id;
> + __be16 pkt_len;
> +} __aligned(1);
> +
> +#define RMNET_MAP_CMD_FMASK GENMASK(0, 0) /* 0: data; 1: cmd */
> +#define RMNET_MAP_RESERVED_FMASK GENMASK(1, 1)
> +#define RMNET_MAP_PAD_LEN_FMASK GENMASK(7, 2)
> +
> +/* Checksum offload metadata header for outbound packets*/
> +struct rmnet_map_ul_csum_header {
> + __be16 csum_start_offset;
> + __be16 csum_info; /* RMNET_MAP_UL_* */
> +} __aligned(1);
> +
> +/* NOTE: These field masks are defined in CPU byte order */
> +#define RMNET_MAP_UL_CSUM_INSERT_FMASK GENMASK(13, 0)
> +#define RMNET_MAP_UL_CSUM_UDP_FMASK GENMASK(14, 14) /* 0: IP; 1: UDP */
> +#define RMNET_MAP_UL_CSUM_ENABLED_FMASK GENMASK(15, 15)
> +
> +/* Checksum offload metadata trailer for inbound packets */
> +struct rmnet_map_dl_csum_trailer {
> + u8 reserved1;
> + u8 flags; /* RMNET_MAP_DL_* */
> + __be16 csum_start_offset;
> + __be16 csum_length;
> + __be16 csum_value;
> +} __aligned(1);
> +
> +#define RMNET_MAP_DL_CSUM_VALID_FMASK GENMASK(0, 0)
> +#define RMNET_MAP_DL_RESERVED_FMASK GENMASK(7, 1)
> +
> +#endif /* _LINUX_IF_RMNET_H_ */
> --
> 2.20.1
>