linux/include/rdma/ib_pack.h

/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/*
 * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
 */

#ifndef IB_PACK_H
#define IB_PACK_H

#include <rdma/ib_verbs.h>
#include <uapi/linux/if_ether.h>

enum {};

struct ib_field {};

#define RESERVED

/*
 * This macro cleans up the definitions of constants for BTH opcodes.
 * It is used to define constants such as IB_OPCODE_UD_SEND_ONLY,
 * which becomes IB_OPCODE_UD + IB_OPCODE_SEND_ONLY, and this gives
 * the correct value.
 *
 * In short, user code should use the constants defined using the
 * macro rather than worrying about adding together other constants.
*/
#define IB_OPCODE(transport, op)

enum {};

enum {};

struct ib_unpacked_lrh {};

struct ib_unpacked_grh {};

struct ib_unpacked_bth {};

struct ib_unpacked_deth {};

struct ib_unpacked_eth {};

struct ib_unpacked_ip4 {};

struct ib_unpacked_udp {};

struct ib_unpacked_vlan {};

struct ib_ud_header {};

void ib_pack(const struct ib_field        *desc,
	     int                           desc_len,
	     void                         *structure,
	     void                         *buf);

void ib_unpack(const struct ib_field        *desc,
	       int                           desc_len,
	       void                         *buf,
	       void                         *structure);

__sum16 ib_ud_ip4_csum(struct ib_ud_header *header);

int ib_ud_header_init(int		    payload_bytes,
		      int		    lrh_present,
		      int		    eth_present,
		      int		    vlan_present,
		      int		    grh_present,
		      int		    ip_version,
		      int		    udp_present,
		      int		    immediate_present,
		      struct ib_ud_header *header);

int ib_ud_header_pack(struct ib_ud_header *header,
		      void                *buf);

int ib_ud_header_unpack(void                *buf,
			struct ib_ud_header *header);

#endif /* IB_PACK_H */