/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2021 MediaTek Inc.
 */

#ifndef A330_ALP_ROHC_COMMON_H
#define A330_ALP_ROHC_COMMON_H

#include <linux/types.h>
#include "rohc_packet.h"

enum {
	ROHC_STATIC_CHAIN_IPV4_LEN = 10,
	ROHC_STATIC_CHAIN_UDP_LEN = 4,
	ROHC_STATIC_CHAIN_LEN = (ROHC_STATIC_CHAIN_IPV4_LEN + ROHC_STATIC_CHAIN_UDP_LEN),

	ROHC_DYNAMIC_CHAIN_IPV4_LEN = 5, /* remove 1 BYTE FOR GENERIC EXTENSION HEADER LIST */
	ROHC_DNYAMIC_CHAIN_UDP_LEN = 4,
	ROHC_DYNAMIC_CHAIN_LEN = (ROHC_DYNAMIC_CHAIN_IPV4_LEN + ROHC_DNYAMIC_CHAIN_UDP_LEN),

	ROHC_FULL_CONTEXT_SIZE = (ROHC_STATIC_CHAIN_LEN + ROHC_DYNAMIC_CHAIN_LEN),
};

enum {
	ROHC_PROFILE_UDP = 0x0002,
	ROHC_PROFILE_MAX,
};

typedef struct {
	u8 s_chain_len;
	u8 d_chain_len;
	u8 s_chain[ROHC_STATIC_CHAIN_LEN];
	u8 d_chain[ROHC_DYNAMIC_CHAIN_LEN];
} rohc_packet_decomp_decomp_context_t;

typedef struct {
	u8 cid;
	u8 crc;
	rohc_cid_type_t cid_type;
	rohc_packet_t packet_type;
	u8 tot_header_len;
	u16 SN;
	u16 ip_id;	//network byte order
	u16 udp_checksum; //network byte order
	rohc_packet_decomp_decomp_context_t ctx;
} rohc_packet_info_t;

typedef struct {
	bool rnd;
	bool en_udp_csum;
} rohc_dynamic_flags_t;

#endif /* A330_ALP_ROHC_COMMON_H */
