Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b1c9dc4 authored by Don Wood's avatar Don Wood Committed by Roland Dreier
Browse files

RDMA/nes: Implement Terminate Packet



Implement the sending and receiving of Terminate packets.

Signed-off-by: default avatarDon Wood <donald.e.wood@intel.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 3c28b445
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -523,7 +523,7 @@ int nes_cm_disconn(struct nes_qp *);
void nes_cm_disconn_worker(void *);

/* nes_verbs.c */
int nes_hw_modify_qp(struct nes_device *, struct nes_qp *, u32, u32);
int nes_hw_modify_qp(struct nes_device *, struct nes_qp *, u32, u32, u32);
int nes_modify_qp(struct ib_qp *, struct ib_qp_attr *, int, struct ib_udata *);
struct nes_ib_device *nes_init_ofa_device(struct net_device *);
void nes_destroy_ofa_device(struct nes_ib_device *);
+0 −2
Original line number Diff line number Diff line
@@ -410,8 +410,6 @@ struct nes_cm_ops {
int schedule_nes_timer(struct nes_cm_node *, struct sk_buff *,
		enum nes_timer_type, int, int);

int nes_cm_disconn(struct nes_qp *);

int nes_accept(struct iw_cm_id *, struct iw_cm_conn_param *);
int nes_reject(struct iw_cm_id *, const void *, u8);
int nes_connect(struct iw_cm_id *, struct iw_cm_conn_param *);
+481 −220

File changed.

Preview size limit exceeded, changes collapsed.

+91 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ enum nes_cqp_stag_wqeword_idx {
};

#define NES_CQP_OP_IWARP_STATE_SHIFT 28
#define NES_CQP_OP_TERMLEN_SHIFT     28

enum nes_cqp_qp_bits {
	NES_CQP_QP_ARP_VALID = (1<<8),
@@ -265,6 +266,8 @@ enum nes_cqp_qp_bits {
	NES_CQP_QP_IWARP_STATE_TERMINATE = (5<<NES_CQP_OP_IWARP_STATE_SHIFT),
	NES_CQP_QP_IWARP_STATE_ERROR = (6<<NES_CQP_OP_IWARP_STATE_SHIFT),
	NES_CQP_QP_IWARP_STATE_MASK = (7<<NES_CQP_OP_IWARP_STATE_SHIFT),
	NES_CQP_QP_TERM_DONT_SEND_FIN = (1<<24),
	NES_CQP_QP_TERM_DONT_SEND_TERM_MSG = (1<<25),
	NES_CQP_QP_RESET = (1<<31),
};

@@ -633,11 +636,14 @@ enum nes_aeqe_bits {
	NES_AEQE_INBOUND_RDMA = (1<<19),
	NES_AEQE_IWARP_STATE_MASK = (7<<20),
	NES_AEQE_TCP_STATE_MASK = (0xf<<24),
	NES_AEQE_Q2_DATA_WRITTEN = (0x3<<28),
	NES_AEQE_VALID = (1<<31),
};

#define NES_AEQE_IWARP_STATE_SHIFT	20
#define NES_AEQE_TCP_STATE_SHIFT	24
#define NES_AEQE_Q2_DATA_ETHERNET       (1<<28)
#define NES_AEQE_Q2_DATA_MPA            (1<<29)

enum nes_aeqe_iwarp_state {
	NES_AEQE_IWARP_STATE_NON_EXISTANT = 0,
@@ -1119,6 +1125,7 @@ struct nes_adapter {
	u8            netdev_max;	/* from host nic address count in EEPROM */
	u8            port_count;
	u8            virtwq;
	u8            send_term_ok;
	u8            et_use_adaptive_rx_coalesce;
	u8            adapter_fcn_count;
	u8 pft_mcast_map[NES_PFT_SIZE];
@@ -1217,6 +1224,90 @@ struct nes_ib_device {
	u32 num_pd;
};

enum nes_hdrct_flags {
	DDP_LEN_FLAG                    = 0x80,
	DDP_HDR_FLAG                    = 0x40,
	RDMA_HDR_FLAG                   = 0x20
};

enum nes_term_layers {
	LAYER_RDMA			= 0,
	LAYER_DDP			= 1,
	LAYER_MPA			= 2
};

enum nes_term_error_types {
	RDMAP_CATASTROPHIC		= 0,
	RDMAP_REMOTE_PROT		= 1,
	RDMAP_REMOTE_OP			= 2,
	DDP_CATASTROPHIC		= 0,
	DDP_TAGGED_BUFFER		= 1,
	DDP_UNTAGGED_BUFFER		= 2,
	DDP_LLP				= 3
};

enum nes_term_rdma_errors {
	RDMAP_INV_STAG			= 0x00,
	RDMAP_INV_BOUNDS		= 0x01,
	RDMAP_ACCESS			= 0x02,
	RDMAP_UNASSOC_STAG		= 0x03,
	RDMAP_TO_WRAP			= 0x04,
	RDMAP_INV_RDMAP_VER		= 0x05,
	RDMAP_UNEXPECTED_OP		= 0x06,
	RDMAP_CATASTROPHIC_LOCAL	= 0x07,
	RDMAP_CATASTROPHIC_GLOBAL	= 0x08,
	RDMAP_CANT_INV_STAG		= 0x09,
	RDMAP_UNSPECIFIED		= 0xff
};

enum nes_term_ddp_errors {
	DDP_CATASTROPHIC_LOCAL		= 0x00,
	DDP_TAGGED_INV_STAG		= 0x00,
	DDP_TAGGED_BOUNDS		= 0x01,
	DDP_TAGGED_UNASSOC_STAG		= 0x02,
	DDP_TAGGED_TO_WRAP		= 0x03,
	DDP_TAGGED_INV_DDP_VER		= 0x04,
	DDP_UNTAGGED_INV_QN		= 0x01,
	DDP_UNTAGGED_INV_MSN_NO_BUF	= 0x02,
	DDP_UNTAGGED_INV_MSN_RANGE	= 0x03,
	DDP_UNTAGGED_INV_MO		= 0x04,
	DDP_UNTAGGED_INV_TOO_LONG	= 0x05,
	DDP_UNTAGGED_INV_DDP_VER	= 0x06
};

enum nes_term_mpa_errors {
	MPA_CLOSED			= 0x01,
	MPA_CRC				= 0x02,
	MPA_MARKER			= 0x03,
	MPA_REQ_RSP			= 0x04,
};

struct nes_terminate_hdr {
	u8 layer_etype;
	u8 error_code;
	u8 hdrct;
	u8 rsvd;
};

/* Used to determine how to fill in terminate error codes */
#define IWARP_OPCODE_WRITE		0
#define IWARP_OPCODE_READREQ		1
#define IWARP_OPCODE_READRSP		2
#define IWARP_OPCODE_SEND		3
#define IWARP_OPCODE_SEND_INV		4
#define IWARP_OPCODE_SEND_SE		5
#define IWARP_OPCODE_SEND_SE_INV	6
#define IWARP_OPCODE_TERM		7

/* These values are used only during terminate processing */
#define TERM_DDP_LEN_TAGGED	14
#define TERM_DDP_LEN_UNTAGGED	18
#define TERM_RDMA_LEN		28
#define RDMA_OPCODE_MASK	0x0f
#define RDMA_READ_REQ_OPCODE	1
#define BAD_FRAME_OFFSET	64
#define CQE_MAJOR_DRV		0x8000

#define nes_vlan_rx vlan_hwaccel_receive_skb
#define nes_netif_rx netif_receive_skb

+3 −0
Original line number Diff line number Diff line
@@ -183,6 +183,9 @@ int nes_read_eeprom_values(struct nes_device *nesdev, struct nes_adapter *nesada
		} else if (((major_ver == 2) && (minor_ver > 21)) || ((major_ver > 2) && (major_ver != 255))) {
			nesadapter->virtwq = 1;
		}
		if (((major_ver == 3) && (minor_ver >= 16)) || (major_ver > 3))
			nesadapter->send_term_ok = 1;

		nesadapter->firmware_version = (((u32)(u8)(eeprom_data>>8))  <<  16) +
				(u32)((u8)eeprom_data);

Loading