From 550c8ed60b9d5f356282592a20565373fd2e238d Mon Sep 17 00:00:00 2001 From: tzachid Date: Wed, 10 Sep 2008 16:00:16 +0000 Subject: [PATCH] [MLX4, MTHCA, IPoIB] Reuse of receive options for checksum value. Signed off by: xalex@mellanox.co.il & alex.estrin@qlogic.com git-svn-id: svn://openib.tc.cornell.edu/gen1@1583 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/hw/mlx4/kernel/bus/ib/cq.c | 8 ++++---- trunk/hw/mthca/kernel/mthca_cq.c | 9 +++++---- trunk/inc/iba/ib_types.h | 4 +++- trunk/ulp/ipoib/kernel/ipoib_port.c | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/trunk/hw/mlx4/kernel/bus/ib/cq.c b/trunk/hw/mlx4/kernel/bus/ib/cq.c index 4c504bc4..579d4794 100644 --- a/trunk/hw/mlx4/kernel/bus/ib/cq.c +++ b/trunk/hw/mlx4/kernel/bus/ib/cq.c @@ -338,10 +338,10 @@ static void mlx4_ib_handle_error_cqe(struct mlx4_err_cqe *cqe, wc->vendor_specific = cqe->vendor_err_syndrome; } -static uint8_t mlx4_ib_ipoib_csum_ok(__be32 status, __be16 checksum) { +static uint32_t mlx4_ib_ipoib_csum_ok(__be32 status, __be16 checksum) { #define CSUM_VALID_NUM 0xffff - uint8_t res = 0; + uint32_t res = 0; // Verify that IP_OK bit is set and the packet is pure IPv4 packet if ((status & cpu_to_be32(MLX4_CQE_IPOIB_STATUS_IPV4 | @@ -361,7 +361,7 @@ static uint8_t mlx4_ib_ipoib_csum_ok(__be32 status, __be16 checksum) { ASSERT( status & cpu_to_be32(MLX4_CQE_IPOIB_STATUS_TCP | MLX4_CQE_IPOIB_STATUS_UDP)); } } - return res; + return (( res << 8 ) & IB_RECV_OPT_CSUM_MASK ); } static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, @@ -498,7 +498,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, wc->recv.ud.path_bits = (u8)(cqe->g_mlpath_rqpn & 0x7f); wc->recv.ud.recv_opt |= cqe->g_mlpath_rqpn & 0x080 ? IB_RECV_OPT_GRH_VALID : 0; wc->recv.ud.pkey_index = (u16)(be32_to_cpu(cqe->immed_rss_invalid) & 0x7f); - wc->recv.ud.csum_ok = mlx4_ib_ipoib_csum_ok(cqe->ipoib_status,cqe->checksum); + wc->recv.ud.recv_opt |= mlx4_ib_ipoib_csum_ok(cqe->ipoib_status,cqe->checksum); } if (!is_send && cqe->rlid == 0){ MLX4_PRINT(TRACE_LEVEL_INFORMATION,MLX4_DBG_CQ,("found rlid == 0 \n ")); diff --git a/trunk/hw/mthca/kernel/mthca_cq.c b/trunk/hw/mthca/kernel/mthca_cq.c index 558b2153..a0410299 100644 --- a/trunk/hw/mthca/kernel/mthca_cq.c +++ b/trunk/hw/mthca/kernel/mthca_cq.c @@ -445,10 +445,10 @@ static void handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq, *free_cqe = 0; } -static inline uint8_t mthca_ib_ipoib_csum_ok(u16 checksum, u8 ip_ok) { +static inline uint32_t mthca_ib_ipoib_csum_ok(u16 checksum, u8 ip_ok) { #define CSUM_VALID_NUM 0xffff - uint8_t res = 0; + uint32_t res = 0; // Verify that IP_OK bit is set and the packet is pure IPv4 packet if (ip_ok) @@ -461,7 +461,7 @@ static inline uint8_t mthca_ib_ipoib_csum_ok(u16 checksum, u8 ip_ok) { MTHCA_NdisPacketTcpChecksumSucceeded ); } } - return res; + return ( ( res << 8 ) & IB_RECV_OPT_CSUM_MASK ); } static inline int mthca_poll_one(struct mthca_dev *dev, @@ -610,7 +610,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev, entry->recv.ud.recv_opt |= cqe->g_mlpath & 0x80 ? IB_RECV_OPT_GRH_VALID : 0; checksum = (u16)((cl_ntoh32(cqe->rqpn) >> 24) | ((cl_ntoh32(cqe->my_ee) >> 16) & 0xff00)); - entry->recv.ud.csum_ok = mthca_ib_ipoib_csum_ok(checksum, cqe->sl_ipok & 1); + entry->recv.ud.recv_opt |= mthca_ib_ipoib_csum_ok(checksum, cqe->sl_ipok & 1); } if (!is_send && cqe->rlid == 0){ HCA_PRINT(TRACE_LEVEL_INFORMATION,HCA_DBG_CQ,("found rlid == 0 \n ")); @@ -992,3 +992,4 @@ void mthca_cleanup_cq_table(struct mthca_dev *dev) } + diff --git a/trunk/inc/iba/ib_types.h b/trunk/inc/iba/ib_types.h index 587b3d35..0f43b127 100644 --- a/trunk/inc/iba/ib_types.h +++ b/trunk/inc/iba/ib_types.h @@ -10609,6 +10609,7 @@ typedef uint32_t ib_recv_opt_t; #define IB_RECV_OPT_FORWARD 0x00000002 #define IB_RECV_OPT_GRH_VALID 0x00000004 #define IB_RECV_OPT_VEND_MASK 0xFFFF0000 +#define IB_RECV_OPT_CSUM_MASK 0x0000FF00 /* * VALUES * IB_RECV_OPT_IMMEDIATE @@ -10665,7 +10666,6 @@ typedef struct _ib_wc ib_net16_t remote_lid; uint8_t remote_sl; uint8_t path_bits; - uint8_t csum_ok; } ud; @@ -11395,3 +11395,5 @@ typedef struct _ib_cm_rdma_req + + diff --git a/trunk/ulp/ipoib/kernel/ipoib_port.c b/trunk/ulp/ipoib/kernel/ipoib_port.c index f98981a8..1f0d4275 100644 --- a/trunk/ulp/ipoib/kernel/ipoib_port.c +++ b/trunk/ulp/ipoib/kernel/ipoib_port.c @@ -1978,7 +1978,7 @@ __recv_mgr_filter( } /* Successful completion. Get the receive information. */ - p_desc->ndis_csum.Value = (ULONG) p_wc->recv.ud.csum_ok; + p_desc->ndis_csum.Value = ( (p_wc->recv.ud.recv_opt & IB_RECV_OPT_CSUM_MASK ) >> 8 ); cl_perf_start( GetRecvEndpts ); __recv_get_endpts( p_port, p_desc, p_wc, &p_src, &p_dst ); cl_perf_stop( &p_port->p_adapter->perf, GetRecvEndpts ); @@ -6312,3 +6312,4 @@ static void __port_mcast_garbage_dpc(KDPC *p_gc_dpc,void *context,void *s_arg1, __port_do_mcast_garbage(p_port); } + -- 2.41.0