RDMA/rxe: Cleanup ICRC
Subsystems (2)
cover RDMA/rxe: Cleanup ICRC
This series of patches cleans up the code in the rdma_rxe driver that handles computing and checking of the ICRC checksum in RoCE packets. All the ICRC related code is isolated in the file rxe_icrc.c. The overall performance is modestly improved. (ib_write_bw loopback performance is increased from 2.7GB/sec to 2.8GB/sec.) There is no change required to the user space provider.
Bob Pearson (5):
RDMA/rxe: Move ICRC checking to a subroutine
RDMA/rxe: Move rxe_xmit_packet to a subroutine
RDMA/rxe: Move ICRC generation to a subroutine
RDMA/rxe: Move rxe_crc32 to a subroutine
RDMA/rxe: Move crc32 init code to rxe_icrc.c
drivers/infiniband/sw/rxe/rxe.h | 22 ----- drivers/infiniband/sw/rxe/rxe_comp.c | 4 +- drivers/infiniband/sw/rxe/rxe_icrc.c | 136 +++++++++++++++++++++++--- drivers/infiniband/sw/rxe/rxe_loc.h | 61 ++---------- drivers/infiniband/sw/rxe/rxe_mr.c | 47 ++++----- drivers/infiniband/sw/rxe/rxe_net.c | 62 ++++++++++-- drivers/infiniband/sw/rxe/rxe_recv.c | 23 +---- drivers/infiniband/sw/rxe/rxe_req.c | 13 +-- drivers/infiniband/sw/rxe/rxe_resp.c | 33 ++----- drivers/infiniband/sw/rxe/rxe_verbs.c | 11 +-- 10 files changed, 225 insertions(+), 187 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/5 RDMA/rxe: Move ICRC checking to a subroutine
Move the code in rxe_recv that checks the ICRC on incoming packets to a subroutine rxe_check_icrc() and move it to rxe_icrc.c.
--- drivers/infiniband/sw/rxe/rxe_icrc.c | 38 ++++++++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_loc.h | 2 ++ drivers/infiniband/sw/rxe/rxe_recv.c | 23 ++--------------- 3 files changed, 42 insertions(+), 21 deletions(-)
drivers/infiniband/sw/rxe/rxe_icrc.c +38 -0
@@ -67,3 +67,41 @@ u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb) rxe_opcode[pkt->opcode].length - RXE_BTH_BYTES);return crc; } + +/** +* rxe_icrc_check - Compute ICRC for a packet and compare to the ICRC +* delivered in the packet. +* @skb: The packet buffer with packet info in skb->cb[] (receive path) +* +* Returns 0 on success or an error on failure +*/ +int rxe_icrc_check (struct sk_buff *skb) +{ +struct rxe_pkt_info *pkt =SKB_TO_PKT (skb); +__be32 *icrcp; +u32 pkt_icrc; +u32 icrc; + + icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); + pkt_icrc =be32_to_cpu (*icrcp); + + icrc =rxe_icrc_hdr (pkt, skb); + icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), +payload_size (pkt) +bth_pad (pkt)); + icrc = (__force u32 )cpu_to_be32 (~icrc); + +if (unlikely (icrc != pkt_icrc)) { +if (skb->protocol ==htons (ETH_P_IPV6 )) +pr_warn_ratelimited ("bad ICRC from %pI6c\n" , + &ipv6_hdr (skb)->saddr); +else if (skb->protocol ==htons (ETH_P_IP )) +pr_warn_ratelimited ("bad ICRC from %pI4\n" , + &ip_hdr (skb)->saddr); +else +pr_warn_ratelimited ("bad ICRC from unknown\n" ); + +return -EINVAL ; + } + +return 0 ; +}
drivers/infiniband/sw/rxe/rxe_loc.h +2 -0
@@ -193,7 +193,9 @@ int rxe_completer(void *arg);int rxe_requester (void *arg);int rxe_responder (void *arg); +/* rxe_icrc.c */ u32 rxe_icrc_hdr (struct rxe_pkt_info *pkt,struct sk_buff *skb); +int rxe_icrc_check (struct sk_buff *skb);void rxe_resp_queue_pkt (struct rxe_qp *qp,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_recv.c +2 -21
@@ -361,8 +361,6 @@ void rxe_rcv(struct sk_buff *skb)int err;struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);struct rxe_dev *rxe = pkt->rxe; -__be32 *icrcp; -u32 calc_icrc, pack_icrc;if (unlikely (skb->len <RXE_BTH_BYTES )) goto drop;
@@ -384,26 +382,9 @@ void rxe_rcv(struct sk_buff *skb)if (unlikely (err)) goto drop; -/* Verify ICRC */ - icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); - pack_icrc =be32_to_cpu (*icrcp); - - calc_icrc =rxe_icrc_hdr (pkt, skb); - calc_icrc =rxe_crc32 (rxe, calc_icrc, (u8 *)payload_addr (pkt), -payload_size (pkt) +bth_pad (pkt)); - calc_icrc = (__force u32 )cpu_to_be32 (~calc_icrc); -if (unlikely (calc_icrc != pack_icrc)) { -if (skb->protocol ==htons (ETH_P_IPV6 )) -pr_warn_ratelimited ("bad ICRC from %pI6c\n" , - &ipv6_hdr (skb)->saddr); -else if (skb->protocol ==htons (ETH_P_IP )) -pr_warn_ratelimited ("bad ICRC from %pI4\n" , - &ip_hdr (skb)->saddr); -else -pr_warn_ratelimited ("bad ICRC from unknown\n" ); - + err =rxe_icrc_check (skb); +if (unlikely (err)) goto drop; - }rxe_counter_inc (rxe,RXE_CNT_RCVD_PKTS );
Signature · 1 line
2.30.2
PATCH 2/5 RDMA/rxe: Move rxe_xmit_packet to a subroutine
In reply to Bob Pearsonrxe_xmit_packet() was an overlong inline subroutine. Move it into rxe_net.c as an ordinary subroutine. Change rxe_loopback() and rxe_send() to static subroutines since they are no longer shared. Allow rxe_loopback to return an error.
--- drivers/infiniband/sw/rxe/rxe_loc.h | 47 ++----------------------- drivers/infiniband/sw/rxe/rxe_net.c | 54 ++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 50 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +2 -45
@@ -99,11 +99,11 @@ struct rxe_mw *rxe_lookup_mw(struct rxe_qp *qp, int access, u32 rkey);void rxe_mw_cleanup (struct rxe_pool_entry *arg);/* rxe_net.c */ -void rxe_loopback (struct sk_buff *skb); -int rxe_send (struct rxe_pkt_info *pkt,struct sk_buff *skb);struct sk_buff *rxe_init_packet (struct rxe_dev *rxe,struct rxe_av *av,int paylen,struct rxe_pkt_info *pkt);int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb,u32 *crc); +int rxe_xmit_packet (struct rxe_qp *qp,struct rxe_pkt_info *pkt, +struct sk_buff *skb);const char *rxe_parent_name (struct rxe_dev *rxe,unsigned int port_num);int rxe_mcast_add (struct rxe_dev *rxe,union ib_gid *mgid);int rxe_mcast_delete (struct rxe_dev *rxe,union ib_gid *mgid);
@@ -206,47 +206,4 @@ static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp) return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type]; } -static inline int rxe_xmit_packet (struct rxe_qp *qp,struct rxe_pkt_info *pkt, -struct sk_buff *skb) -{ -int err; -int is_request = pkt->mask &RXE_REQ_MASK ; -struct rxe_dev *rxe =to_rdev (qp->ibqp.device); - -if ((is_request && (qp->req.state !=QP_STATE_READY )) || - (!is_request && (qp->resp.state !=QP_STATE_READY ))) { -pr_info ("Packet dropped. QP is not in ready state\n" ); - goto drop; - } - -if (pkt->mask &RXE_LOOPBACK_MASK ) { -memcpy (SKB_TO_PKT (skb), pkt,sizeof (*pkt)); -rxe_loopback (skb); - err =0 ; - }else { - err =rxe_send (pkt, skb); - } - -if (err) { - rxe->xmit_errors++; -rxe_counter_inc (rxe,RXE_CNT_SEND_ERR ); -return err; - } - -if ((qp_type (qp) !=IB_QPT_RC ) && - (pkt->mask &RXE_END_MASK )) { - pkt->wqe->state = wqe_state_done; -rxe_run_task (&qp->comp.task,1 ); - } - -rxe_counter_inc (rxe,RXE_CNT_SENT_PKTS ); - goto done; - -drop: -kfree_skb (skb); - err =0 ; -done: -return err; -} -#endif /* RXE_LOC_H */
drivers/infiniband/sw/rxe/rxe_net.c +49 -5
75 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 3/5 RDMA/rxe: Move ICRC generation to a subroutine
In reply to Bob PearsonIsolate ICRC generation into a single subroutine named rxe_generate_icrc() in rxe_icrc.c. Remove scattered crc generation code from elsewhere.
--- drivers/infiniband/sw/rxe/rxe_comp.c | 4 +-- drivers/infiniband/sw/rxe/rxe_icrc.c | 13 ++++++++ drivers/infiniband/sw/rxe/rxe_loc.h | 10 +++--- drivers/infiniband/sw/rxe/rxe_mr.c | 47 ++++++++++++---------------- drivers/infiniband/sw/rxe/rxe_net.c | 8 ++--- drivers/infiniband/sw/rxe/rxe_req.c | 13 ++------ drivers/infiniband/sw/rxe/rxe_resp.c | 33 +++++-------------- 7 files changed, 54 insertions(+), 74 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +2 -2
@@ -349,7 +349,7 @@ static inline enum comp_state do_read(struct rxe_qp *qp, ret =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &wqe->dma,payload_addr (pkt), -payload_size (pkt),RXE_TO_MR_OBJ ,NULL ); +payload_size (pkt),RXE_TO_MR_OBJ );if (ret) { wqe->status =IB_WC_LOC_PROT_ERR ;return COMPST_ERROR ;
@@ -371,7 +371,7 @@ static inline enum comp_state do_atomic(struct rxe_qp *qp, ret =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &wqe->dma, &atomic_orig, -sizeof (u64),RXE_TO_MR_OBJ ,NULL ); +sizeof (u64),RXE_TO_MR_OBJ );if (ret) { wqe->status =IB_WC_LOC_PROT_ERR ;return COMPST_ERROR ;
drivers/infiniband/sw/rxe/rxe_icrc.c +13 -0
@@ -105,3 +105,16 @@ int rxe_icrc_check(struct sk_buff *skb)return 0 ; } + +/* rxe_icrc_generate- compute ICRC for a packet. */ +void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb) +{ +__be32 *icrcp; +u32 icrc; + + icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); + icrc =rxe_icrc_hdr (pkt, skb); + icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), +payload_size (pkt) +bth_pad (pkt)); + *icrcp = ~icrc; +}
drivers/infiniband/sw/rxe/rxe_loc.h +5 -5
@@ -77,10 +77,9 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, int access, struct rxe_mr *mr);int rxe_mr_init_fast (struct rxe_pd *pd,int max_pages,struct rxe_mr *mr);int rxe_mr_copy (struct rxe_mr *mr,u64 iova,void *addr,int length, -enum rxe_mr_copy_dir dir,u32 *crcp); -int copy_data (struct rxe_pd *pd,int access, -struct rxe_dma_info *dma,void *addr,int length, -enum rxe_mr_copy_dir dir,u32 *crcp); +enum rxe_mr_copy_dir dir); +int copy_data (struct rxe_pd *pd,int access,struct rxe_dma_info *dma, +void *addr,int length,enum rxe_mr_copy_dir dir);void *iova_to_vaddr (struct rxe_mr *mr,u64 iova,int length);struct rxe_mr *lookup_mr (struct rxe_pd *pd,int access,u32 key,enum rxe_mr_lookup_type type);
@@ -101,7 +100,7 @@ void rxe_mw_cleanup(struct rxe_pool_entry *arg);/* rxe_net.c */ struct sk_buff *rxe_init_packet (struct rxe_dev *rxe,struct rxe_av *av,int paylen,struct rxe_pkt_info *pkt); -int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb,u32 *crc); +int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb);int rxe_xmit_packet (struct rxe_qp *qp,struct rxe_pkt_info *pkt,struct sk_buff *skb);const char *rxe_parent_name (struct rxe_dev *rxe,unsigned int port_num);
@@ -196,6 +195,7 @@ int rxe_responder(void *arg);/* rxe_icrc.c */ u32 rxe_icrc_hdr (struct rxe_pkt_info *pkt,struct sk_buff *skb);int rxe_icrc_check (struct sk_buff *skb); +void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb);void rxe_resp_queue_pkt (struct rxe_qp *qp,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_mr.c +20 -27
100 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_net.c +4 -4
@@ -343,7 +343,7 @@ static int prepare6(struct rxe_pkt_info *pkt, struct sk_buff *skb)return 0 ; } -int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb,u32 *crc) +int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb) {int err =0 ;
@@ -352,8 +352,6 @@ int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc)else if (skb->protocol ==htons (ETH_P_IPV6 )) err =prepare6 (pkt, skb); - *crc =rxe_icrc_hdr (pkt, skb); -if (ether_addr_equal (skb->dev->dev_addr,rxe_get_av (pkt)->dmac)) pkt->mask |=RXE_LOOPBACK_MASK ;
@@ -396,7 +394,7 @@ static int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb) }if (unlikely (net_xmit_eval (err))) { -pr_debug ("error sending packet: %d\n" , err); +pr_info ("error sending packet: %d\n" , err);return -EAGAIN ; }
@@ -438,6 +436,8 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, goto drop; } +rxe_icrc_generate (pkt, skb); +if (pkt->mask &RXE_LOOPBACK_MASK ) err =rxe_loopback (pkt, skb);else
drivers/infiniband/sw/rxe/rxe_req.c +2 -11
@@ -466,12 +466,9 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, struct rxe_pkt_info *pkt, struct sk_buff *skb, int paylen) { - struct rxe_dev *rxe = to_rdev(qp->ibqp.device); -u32 crc =0 ; -u32 *p; int err; - err =rxe_prepare (pkt, skb, &crc); + err =rxe_prepare (pkt, skb);if (err)return err;
@@ -479,7 +476,6 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,if (wqe->wr.send_flags &IB_SEND_INLINE ) {u8 *tmp = &wqe->dma.inline_data[wqe->dma.sge_offset]; - crc =rxe_crc32 (rxe, crc, tmp, paylen);memcpy (payload_addr (pkt), tmp, paylen); wqe->dma.resid -= paylen;
@@ -487,8 +483,7 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, }else { err =copy_data (qp->pd,0 , &wqe->dma,payload_addr (pkt), paylen, -RXE_FROM_MR_OBJ , - &crc); +RXE_FROM_MR_OBJ );if (err)return err; }
@@ -496,12 +491,8 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,u8 *pad =payload_addr (pkt) + paylen;memset (pad,0 ,bth_pad (pkt)); - crc =rxe_crc32 (rxe, crc, pad,bth_pad (pkt)); } } - p =payload_addr (pkt) + paylen +bth_pad (pkt); - - *p = ~crc;return 0 ; }
drivers/infiniband/sw/rxe/rxe_resp.c +8 -25
@@ -536,7 +536,7 @@ static enum resp_states send_data_in(struct rxe_qp *qp, void *data_addr,int err; err =copy_data (qp->pd,IB_ACCESS_LOCAL_WRITE , &qp->resp.wqe->dma, - data_addr, data_len,RXE_TO_MR_OBJ ,NULL ); + data_addr, data_len,RXE_TO_MR_OBJ );if (unlikely (err))return (err == -ENOSPC ) ?RESPST_ERR_LENGTH :RESPST_ERR_MALFORMED_WQE ;
@@ -552,7 +552,7 @@ static enum resp_states write_data_in(struct rxe_qp *qp,int data_len =payload_size (pkt); err =rxe_mr_copy (qp->resp.mr, qp->resp.va + qp->resp.offset, -payload_addr (pkt), data_len,RXE_TO_MR_OBJ ,NULL ); +payload_addr (pkt), data_len,RXE_TO_MR_OBJ );if (err) { rc =RESPST_ERR_RKEY_VIOLATION ; goto out;
@@ -613,13 +613,10 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,int opcode, int payload, u32 psn, - u8 syndrome, - u32 *crcp) + u8 syndrome) { struct rxe_dev *rxe = to_rdev(qp->ibqp.device);struct sk_buff *skb; -u32 crc =0 ; -u32 *p;int paylen;int pad;int err;
@@ -651,20 +648,12 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,if (ack->mask &RXE_ATMACK_MASK )atmack_set_orig (ack, qp->resp.atomic_orig); - err =rxe_prepare (ack, skb, &crc); + err =rxe_prepare (ack, skb);if (err) {kfree_skb (skb);return NULL ; } -if (crcp) { -/* CRC computation will be continued by the caller */ - *crcp = crc; - }else { - p =payload_addr (ack) + payload +bth_pad (ack); - *p = ~crc; - } -return skb; }
@@ -682,8 +671,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,int opcode;int err;struct resp_res *res = qp->resp.res; -u32 icrc; -u32 *p;if (!res) {/* This is the first time we process that request. Get a
@@ -742,24 +729,20 @@ static enum resp_states read_reply(struct rxe_qp *qp, payload =min_t (int, res->read.resid, mtu); skb =prepare_ack_packet (qp, req_pkt, &ack_pkt, opcode, payload, - res->cur_psn,AETH_ACK_UNLIMITED , &icrc); + res->cur_psn,AETH_ACK_UNLIMITED );if (!skb)return RESPST_ERR_RNR ; err =rxe_mr_copy (res->read.mr, res->read.va,payload_addr (&ack_pkt), - payload,RXE_FROM_MR_OBJ , &icrc); + payload,RXE_FROM_MR_OBJ );if (err)pr_err ("Failed copying memory\n" );if (bth_pad (&ack_pkt)) { -struct rxe_dev *rxe =to_rdev (qp->ibqp.device);u8 *pad =payload_addr (&ack_pkt) + payload;memset (pad,0 ,bth_pad (&ack_pkt)); - icrc =rxe_crc32 (rxe, icrc, pad,bth_pad (&ack_pkt)); } - p =payload_addr (&ack_pkt) + payload +bth_pad (&ack_pkt); - *p = ~icrc; err =rxe_xmit_packet (qp, &ack_pkt, skb);if (err) {
@@ -984,7 +967,7 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,struct sk_buff *skb; skb =prepare_ack_packet (qp, pkt, &ack_pkt,IB_OPCODE_RC_ACKNOWLEDGE , -0 , psn, syndrome,NULL ); +0 , psn, syndrome);if (!skb) { err = -ENOMEM ; goto err1;
@@ -1008,7 +991,7 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, skb =prepare_ack_packet (qp, pkt, &ack_pkt,IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE ,0 , pkt->psn, - syndrome,NULL ); + syndrome);if (!skb) { rc = -ENOMEM ; goto out;
Signature · 1 line
2.30.2
PATCH 4/5 RDMA/rxe: Move rxe_crc32 to a subroutine
In reply to Bob PearsonMove rxe_crc32 from rxe.h to rxe_icrc.c as a static local function. Add some comments to rxe_icrc.c
--- drivers/infiniband/sw/rxe/rxe.h | 21 ------------ drivers/infiniband/sw/rxe/rxe_icrc.c | 50 +++++++++++++++++++++++++--- drivers/infiniband/sw/rxe/rxe_loc.h | 1 - 3 files changed, 45 insertions(+), 27 deletions(-)
drivers/infiniband/sw/rxe/rxe.h +0 -21
@@ -42,27 +42,6 @@extern bool rxe_initialized; -static inline u32 rxe_crc32 (struct rxe_dev *rxe, -u32 crc,void *next,size_t len) -{ -u32 retval; -int err; - -SHASH_DESC_ON_STACK (shash, rxe->tfm); - - shash->tfm = rxe->tfm; - *(u32 *)shash_desc_ctx (shash) = crc; - err =crypto_shash_update (shash, next, len); -if (unlikely (err)) { -pr_warn_ratelimited ("failed crc calculation, err: %d\n" , err); -return crc32_le (crc, next, len); - } - - retval = *(u32 *)shash_desc_ctx (shash); -barrier_data (shash_desc_ctx (shash)); -return retval; -} -void rxe_set_mtu (struct rxe_dev *rxe,unsigned int dev_mtu);int rxe_add (struct rxe_dev *rxe,unsigned int mtu,const char *ibdev_name);
drivers/infiniband/sw/rxe/rxe_icrc.c +45 -5
69 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_loc.h +0 -1
@@ -193,7 +193,6 @@ int rxe_requester(void *arg);int rxe_responder (void *arg);/* rxe_icrc.c */ -u32 rxe_icrc_hdr (struct rxe_pkt_info *pkt,struct sk_buff *skb);int rxe_icrc_check (struct sk_buff *skb);void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb);
Signature · 1 line
2.30.2
PATCH 5/5 RDMA/rxe: Move crc32 init code to rxe_icrc.c
In reply to Bob PearsonThis patch collects the code from rxe_register_device() that sets up the crc32 calculation into a subroutine rxe_icrc_init() in rxe_icrc.c. This completes collecting all the code specific to computing ICRC into one file with a simple set of APIs.
Minor cleanups in rxe_icrc.c to
Comments
byte order types
--- drivers/infiniband/sw/rxe/rxe.h | 1 - drivers/infiniband/sw/rxe/rxe_icrc.c | 75 +++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_loc.h | 1 + drivers/infiniband/sw/rxe/rxe_verbs.c | 11 ++-- 4 files changed, 53 insertions(+), 35 deletions(-)
drivers/infiniband/sw/rxe/rxe.h +0 -1
@@ -14,7 +14,6 @@#include <linux/module.h> #include <linux/skbuff.h> -#include <linux/crc32.h> #include <rdma/ib_verbs.h> #include <rdma/ib_user_verbs.h>
drivers/infiniband/sw/rxe/rxe_icrc.c +49 -26
151 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_loc.h +1 -0
@@ -193,6 +193,7 @@ int rxe_requester(void *arg);int rxe_responder (void *arg);/* rxe_icrc.c */ +int rxe_icrc_init (struct rxe_dev *rxe);int rxe_icrc_check (struct sk_buff *skb);void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_verbs.c +3 -8
@@ -1154,7 +1154,6 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) {int err;struct ib_device *dev = &rxe->ib_dev; -struct crypto_shash *tfm;strscpy (dev->node_desc,"rxe" ,sizeof (dev->node_desc));
@@ -1173,13 +1172,9 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)if (err)return err; - tfm =crypto_alloc_shash ("crc32" ,0 ,0 ); -if (IS_ERR (tfm)) { -pr_err ("failed to allocate crc algorithm err:%ld\n" , -PTR_ERR (tfm)); -return PTR_ERR (tfm); - } - rxe->tfm = tfm; + err =rxe_icrc_init (rxe); +if (err) +return err; err =ib_register_device (dev, ibdev_name,NULL );if (err)
Signature · 1 line
2.30.2
Zhu Yanjun
maintainerRe: [PATCH 5/5] RDMA/rxe: Move crc32 init code to rxe_icrc.c
Quoted 10 lines · Bob Pearson
This patch collects the code from
rxe_register_device()that sets up the crc32 calculation into a subroutinerxe_icrc_init()inrxe_icrc.c. This completes collecting all the code specific to computing ICRC into one file with a simple set of APIs.
Minor cleanups inrxe_icrc.cto
Comments
byte order typesSigned-off-by Bob Pearson <[email protected]>
Why are the same patch series sent twice?
Which one is official? "[for-next,resending,1/5] RDMA/rxe: Move ICRC checking to a subroutine" is official? or this one?
Zhu Yanjun
Quoted 225 lines
--- drivers/infiniband/sw/rxe/rxe.h | 1 - drivers/infiniband/sw/rxe/rxe_icrc.c | 75 +++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_loc.h | 1 + drivers/infiniband/sw/rxe/rxe_verbs.c | 11 ++-- 4 files changed, 53 insertions(+), 35 deletions(-)drivers/infiniband/sw/rxe/rxe.h +0
-1@@ -14,7 +14,6 @@#include <linux/module.h> #include <linux/skbuff.h> -#include <linux/crc32.h> #include <rdma/ib_verbs.h> #include <rdma/ib_user_verbs.h> drivers/infiniband/sw/rxe/rxe_icrc.c +49
-26@@ -4,34 +4,59 @@* Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. */ +#include <linux/crc32.h> #include "rxe.h" #include "rxe_loc.h" /** -* rxe_crc32 - Compute incremental crc32 for a contiguous segment +* rxe_icrc_init - Initialize crypto function for computing crc32 +* @rxe: rdma_rxe device object +* +* Returns 0 on success else an error +*/ +int rxe_icrc_init (struct rxe_dev *rxe) +{ +struct crypto_shash *tfm; + + tfm =crypto_alloc_shash ("crc32" ,0 ,0 ); +if (IS_ERR (tfm)) { +pr_err ("failed to init crc32 algorithm err:%ld\n" , +PTR_ERR (tfm)); +return PTR_ERR (tfm); + } + + rxe->tfm = tfm; + +return 0 ; +} + +/** +* rxe_crc32 - Compute cumulative crc32 for a contiguous segment * @rxe: rdma_rxe device object * @crc: starting crc32 value from previous segments * @addr: starting address of segment * @len: length of the segment in bytes * -* Returns the crc32 checksum of the segment starting from crc. +* Returns the crc32 cumulative checksum including the segment starting +* from crc. */ -static u32 rxe_crc32 (struct rxe_dev *rxe,u32 crc,void *addr,size_t len) +static __be32 rxe_crc32 (struct rxe_dev *rxe,__be32 crc,void *addr, +size_t len) { -u32 icrc; +__be32 icrc;int err;SHASH_DESC_ON_STACK (shash, rxe->tfm); shash->tfm = rxe->tfm; - *(u32 *)shash_desc_ctx (shash) = crc; + *(__be32 *)shash_desc_ctx (shash) = crc; err =crypto_shash_update (shash, addr, len);if (unlikely (err)) {pr_warn_ratelimited ("failed crc calculation, err: %d\n" , err);return crc32_le (crc, addr, len); } - icrc = *(u32 *)shash_desc_ctx (shash); + icrc = *(__be32 *)shash_desc_ctx (shash);barrier_data (shash_desc_ctx (shash));return icrc;@@ -39,19 +64,16 @@ static u32 rxe_crc32(struct rxe_dev *rxe, u32 crc, void *addr, size_t len)/** * rxe_icrc_hdr - Compute a partial ICRC for the IB transport headers. -* @pkt: Information about the current packet -* @skb: The packet buffer +* @pkt: packet information +* @skb: packet buffer * * Returns the partial ICRC */ static u32 rxe_icrc_hdr (struct rxe_pkt_info *pkt,struct sk_buff *skb) { -unsigned int bth_offset =0 ; -struct iphdr *ip4h =NULL ; -struct ipv6hdr *ip6h =NULL ;struct udphdr *udph;struct rxe_bth *bth; -int crc; +__be32 crc;int length; int hdr_size = sizeof(struct udphdr) + (skb->protocol == htons(ETH_P_IP) ?@@ -69,6 +91,8 @@ static u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb) crc =0xdebb20e3 ;if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ +struct iphdr *ip4h =NULL ; +memcpy (pshdr,ip_hdr (skb), hdr_size); ip4h = (struct iphdr *)pshdr; udph = (struct udphdr *)(ip4h +1 );@@ -77,6 +101,8 @@ static u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb) ip4h->check =CSUM_MANGLED_0 ; ip4h->tos =0xff ; }else {/* IPv6 */ +struct ipv6hdr *ip6h =NULL ; +memcpy (pshdr,ipv6_hdr (skb), hdr_size); ip6h = (struct ipv6hdr *)pshdr; udph = (struct udphdr *)(ip6h +1 );@@ -85,12 +111,9 @@ static u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb) ip6h->priority =0xf ; ip6h->hop_limit =0xff ; } - udph->check =CSUM_MANGLED_0 ; - - bth_offset += hdr_size; -memcpy (&pshdr[bth_offset], pkt->hdr,RXE_BTH_BYTES ); - bth = (struct rxe_bth *)&pshdr[bth_offset]; + bth = (struct rxe_bth *)(udph +1 ); +memcpy (bth, pkt->hdr,RXE_BTH_BYTES );/* exclude bth.resv8a */ bth->qpn |=cpu_to_be32 (~BTH_QPN_MASK );@@ -115,18 +138,18 @@ int rxe_icrc_check(struct sk_buff *skb) {struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);__be32 *icrcp; -u32 pkt_icrc; -u32 icrc; +__be32 packet_icrc; +__be32 computed_icrc; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); - pkt_icrc =be32_to_cpu (*icrcp); + packet_icrc = *icrcp; - icrc =rxe_icrc_hdr (pkt, skb); - icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), -payload_size (pkt) +bth_pad (pkt)); - icrc = (__force u32 )cpu_to_be32 (~icrc); + computed_icrc =rxe_icrc_hdr (pkt, skb); + computed_icrc =rxe_crc32 (pkt->rxe, computed_icrc, + (u8 *)payload_addr (pkt),payload_size (pkt) +bth_pad (pkt)); + computed_icrc = ~computed_icrc; -if (unlikely (icrc != pkt_icrc)) { +if (unlikely (computed_icrc != packet_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))pr_warn_ratelimited ("bad ICRC from %pI6c\n" , &ipv6_hdr (skb)->saddr);@@ -150,7 +173,7 @@ int rxe_icrc_check(struct sk_buff *skb)void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb) {__be32 *icrcp; -u32 icrc; +__be32 icrc; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); icrc =rxe_icrc_hdr (pkt, skb);drivers/infiniband/sw/rxe/rxe_loc.h +1
-0@@ -193,6 +193,7 @@ int rxe_requester(void *arg);int rxe_responder (void *arg);/* rxe_icrc.c */ +int rxe_icrc_init (struct rxe_dev *rxe);int rxe_icrc_check (struct sk_buff *skb);void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb);drivers/infiniband/sw/rxe/rxe_verbs.c +3
-9@@ -1154,7 +1154,6 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) {int err;struct ib_device *dev = &rxe->ib_dev; -struct crypto_shash *tfm;strscpy (dev->node_desc,"rxe" ,sizeof (dev->node_desc));@@ -1173,13 +1172,9 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)if (err)return err; - tfm =crypto_alloc_shash ("crc32" ,0 ,0 ); -if (IS_ERR (tfm)) { -pr_err ("failed to allocate crc algorithm err:%ld\n" , -PTR_ERR (tfm)); -return PTR_ERR (tfm); - } - rxe->tfm = tfm; + err =rxe_icrc_init (rxe); +if (err) +return err; err =ib_register_device (dev, ibdev_name,NULL );if (err) --2.30.2
RE: [PATCH 5/5] RDMA/rxe: Move crc32 init code to rxe_icrc.c
The second one. i.e. the resent one. When I sent it the first time things got confused.
They are exactly the same except: in the cover letter the first time it had 0/7 should have been 0/5. The resent one got that right. Also the first time it sent patches 6/7 and 7/7 which was not what I wanted to do.
Thanks
Bob
-----Original Message-----
From: Zhu Yanjun <[email protected]>
Sent: Tuesday, June 29, 2021 11:09 PM
To: Bob Pearson <[email protected]>
Cc: Jason Gunthorpe <[email protected]>; RDMA mailing list <[email protected]>
Subject: Re: [PATCH 5/5] RDMA/rxe: Move crc32 init code to rxe_icrc.c
Quoted 10 lines · Bob Pearson
This patch collects the code from
rxe_register_device()that sets up the crc32 calculation into a subroutinerxe_icrc_init()inrxe_icrc.c. This completes collecting all the code specific to computing ICRC into one file with a simple set of APIs.
Minor cleanups inrxe_icrc.cto
Comments
byte order typesSigned-off-by Bob Pearson <[email protected]>
Why are the same patch series sent twice?
Which one is official? "[for-next,resending,1/5] RDMA/rxe: Move ICRC checking to a subroutine" is official? or this one?
Zhu Yanjun
Quoted 228 lines
--- drivers/infiniband/sw/rxe/rxe.h | 1 - drivers/infiniband/sw/rxe/rxe_icrc.c | 75 +++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_loc.h | 1 + drivers/infiniband/sw/rxe/rxe_verbs.c | 11 ++-- 4 files changed, 53 insertions(+), 35 deletions(-)(quoted diff) +0
-0
b/drivers/infiniband/sw/rxe/rxe.hindex65a73c1c8b35..1bb3fb618bf5100644drivers/infiniband/sw/rxe/rxe.h +0
-1@@ -14,7 +14,6 @@#include <linux/module.h> #include <linux/skbuff.h> -#include <linux/crc32.h> #include <rdma/ib_verbs.h> #include <rdma/ib_user_verbs.h> drivers/infiniband/sw/rxe/rxe_icrc.c +33
-12@@ -4,34 +4,59 @@* Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. */ +#include <linux/crc32.h> #include "rxe.h" #include "rxe_loc.h" /** -* rxe_crc32 - Compute incremental crc32 for a contiguous segment +* rxe_icrc_init - Initialize crypto function for computing crc32 +* @rxe: rdma_rxe device object +* +* Returns 0 on success else an error */ int rxe_icrc_init (struct +rxe_dev *rxe) { +struct crypto_shash *tfm; + + tfm =crypto_alloc_shash ("crc32" ,0 ,0 ); +if (IS_ERR (tfm)) { +pr_err ("failed to init crc32 algorithm err:%ld\n" , +PTR_ERR (tfm)); +return PTR_ERR (tfm); + } + + rxe->tfm = tfm; + +return 0 ; +} + +/** +* rxe_crc32 - Compute cumulative crc32 for a contiguous segment * @rxe: rdma_rxe device object * @crc: starting crc32 value from previous segments * @addr: starting address of segment * @len: length of the segment in bytes * -* Returns the crc32 checksum of the segment starting from crc. +* Returns the crc32 cumulative checksum including the segment +starting +* from crc. */ -static u32 rxe_crc32 (struct rxe_dev *rxe,u32 crc,void *addr,size_t len) +static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *addr, +size_t len) { -u32 icrc; +__be32 icrc;int err;SHASH_DESC_ON_STACK (shash, rxe->tfm); shash->tfm = rxe->tfm; - *(u32 *)shash_desc_ctx (shash) = crc; + *(__be32 *)shash_desc_ctx (shash) = crc; err =crypto_shash_update (shash, addr, len);if (unlikely (err)) {pr_warn_ratelimited ("failed crc calculation, err: %d\n" , err);return crc32_le (crc, addr, len); } - icrc = *(u32 *)shash_desc_ctx (shash); + icrc = *(__be32 *)shash_desc_ctx (shash);barrier_data (shash_desc_ctx (shash));return icrc;@@ -39,19 +64,16 @@ static u32 rxe_crc32(struct rxe_dev *rxe, u32 crc, void *addr, size_t len)/** * rxe_icrc_hdr - Compute a partial ICRC for the IB transport headers. -* @pkt: Information about the current packet -* @skb: The packet buffer +* @pkt: packet information +* @skb: packet buffer * * Returns the partial ICRC */ static u32 rxe_icrc_hdr (struct rxe_pkt_info *pkt,struct sk_buff *skb) { -unsigned int bth_offset =0 ; -struct iphdr *ip4h =NULL ; -struct ipv6hdr *ip6h =NULL ;struct udphdr *udph;struct rxe_bth *bth; -int crc; +__be32 crc;int length; int hdr_size = sizeof(struct udphdr) +(skb->protocol == htons(ETH_P_IP) ?drivers/infiniband/sw/rxe/rxe_icrc.c +2
-0@@ -69,6 +91,8 @@ static u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb) crc =0xdebb20e3 ;if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ +struct iphdr *ip4h =NULL ; +memcpy (pshdr,ip_hdr (skb), hdr_size); ip4h = (struct iphdr *)pshdr; udph = (struct udphdr *)(ip4h + 1); @@ -77,6 +101,8 @@static u32
rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)ip4h->check = CSUM_MANGLED_0; ip4h->tos = 0xff; } else { /* IPv6 */drivers/infiniband/sw/rxe/rxe_icrc.c +2
-0+struct ipv6hdr *ip6h =NULL ; +memcpy (pshdr,ipv6_hdr (skb), hdr_size); ip6h = (struct ipv6hdr *)pshdr; udph = (struct udphdr *)(ip6h + 1); @@ -85,12 +111,9@@ static u32
rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)ip6h->priority = 0xf; ip6h->hop_limit = 0xff; }drivers/infiniband/sw/rxe/rxe_icrc.c +2
-5- udph->check =CSUM_MANGLED_0 ; - - bth_offset += hdr_size; -memcpy (&pshdr[bth_offset], pkt->hdr,RXE_BTH_BYTES ); - bth = (struct rxe_bth *)&pshdr[bth_offset]; + bth = (struct rxe_bth *)(udph +1 ); +memcpy (bth, pkt->hdr,RXE_BTH_BYTES );/* exclude bth.resv8a */ bth->qpn |= cpu_to_be32(~BTH_QPN_MASK); @@ -115,18 +138,18 @@int rxe_icrc_check(struct sk_buff *skb) { struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); __be32 *icrcp;drivers/infiniband/sw/rxe/rxe_icrc.c +8
-9-u32 pkt_icrc; -u32 icrc; +__be32 packet_icrc; +__be32 computed_icrc; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); - pkt_icrc =be32_to_cpu (*icrcp); + packet_icrc = *icrcp; - icrc =rxe_icrc_hdr (pkt, skb); - icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), -payload_size (pkt) +bth_pad (pkt)); - icrc = (__force u32 )cpu_to_be32 (~icrc); + computed_icrc =rxe_icrc_hdr (pkt, skb); + computed_icrc =rxe_crc32 (pkt->rxe, computed_icrc, + (u8 *)payload_addr (pkt),payload_size (pkt) +bth_pad (pkt)); + computed_icrc = ~computed_icrc; -if (unlikely (icrc != pkt_icrc)) { +if (unlikely (computed_icrc != packet_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))pr_warn_ratelimited ("bad ICRC from %pI6c\n" , &ipv6_hdr(skb)->saddr); @@ -150,7 +173,7 @@ int rxe_icrc_check(struct sk_buff *skb) voidrxe_icrc_generate(struct rxe_pkt_info *pkt, struct sk_buff *skb) { __be32 *icrcp;drivers/infiniband/sw/rxe/rxe_icrc.c +1
-1-u32 icrc; +__be32 icrc; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); icrc = rxe_icrc_hdr(pkt, skb); diff --git
a/drivers/infiniband/sw/rxe/rxe_loc.hb/drivers/infiniband/sw/rxe/rxe_loc.h
indexb08689b664ec..f98378f8ff31100644drivers/infiniband/sw/rxe/rxe_loc.h +1
-0@@ -193,6 +193,7 @@ int rxe_requester(void *arg); intrxe_responder (void *arg);/* rxe_icrc.c */ +int rxe_icrc_init (struct rxe_dev *rxe);int rxe_icrc_check (struct sk_buff *skb);void rxe_icrc_generate (struct rxe_pkt_info *pkt,struct sk_buff *skb);drivers/infiniband/sw/rxe/rxe_verbs.c +3
-9@@ -1154,7 +1154,6 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) {int err;struct ib_device *dev = &rxe->ib_dev; -struct crypto_shash *tfm;strscpy (dev->node_desc,"rxe" ,sizeof (dev->node_desc));@@ -1173,13 +1172,9 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)if (err)return err; - tfm =crypto_alloc_shash ("crc32" ,0 ,0 ); -if (IS_ERR (tfm)) { -pr_err ("failed to allocate crc algorithm err:%ld\n" , -PTR_ERR (tfm)); -return PTR_ERR (tfm); - } - rxe->tfm = tfm; + err =rxe_icrc_init (rxe); +if (err) +return err; err =ib_register_device (dev, ibdev_name,NULL );if (err) --2.30.2
kernel test robot
build botRe: [PATCH 5/5] RDMA/rxe: Move crc32 init code to rxe_icrc.c
In reply to Bob PearsonThank you for the patch! Perhaps something to improve:
Hi Bob,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rdma/for-next]
[also build test WARNING on next-20210630]
[cannot apply to v5.13]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bob-Pearson/RDMA-rxe-Move-ICRC-checking-to-a-subroutine/20210630-051423 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: riscv-randconfig-s032-20210630 (attached as .config) compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/e231ff2c1bb74fd5f86e9e1a7d43770a98209bf9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bob-Pearson/RDMA-rxe-Move-ICRC-checking-to-a-subroutine/20210630-051423 git checkout e231ff2c1bb74fd5f86e9e1a7d43770a98209bf9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
sparse warnings: (new ones prefixed by >>)
>> drivers/infiniband/sw/rxe/rxe_icrc.c:56:33: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] crc @@ got restricted __be32 [usertype] crc @@ drivers/infiniband/sw/rxe/rxe_icrc.c:56:33: sparse: expected unsigned int [usertype] crc drivers/infiniband/sw/rxe/rxe_icrc.c:56:33: sparse: got restricted __be32 [usertype] crc >> drivers/infiniband/sw/rxe/rxe_icrc.c:56:32: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got unsigned int @@ drivers/infiniband/sw/rxe/rxe_icrc.c:56:32: sparse: expected restricted __be32 drivers/infiniband/sw/rxe/rxe_icrc.c:56:32: sparse: got unsigned int >> drivers/infiniband/sw/rxe/rxe_icrc.c:91:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] crc @@ got unsigned int @@ drivers/infiniband/sw/rxe/rxe_icrc.c:91:13: sparse: expected restricted __be32 [usertype] crc drivers/infiniband/sw/rxe/rxe_icrc.c:91:13: sparse: got unsigned int >> drivers/infiniband/sw/rxe/rxe_icrc.c:127:16: sparse: sparse: incorrect type in return expression (different base types) @@ expected unsigned int @@ got restricted __be32 [assigned] [usertype] crc @@ drivers/infiniband/sw/rxe/rxe_icrc.c:127:16: sparse: expected unsigned int drivers/infiniband/sw/rxe/rxe_icrc.c:127:16: sparse: got restricted __be32 [assigned] [usertype] crc >> drivers/infiniband/sw/rxe/rxe_icrc.c:147:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] computed_icrc @@ got unsigned int @@ drivers/infiniband/sw/rxe/rxe_icrc.c:147:23: sparse: expected restricted __be32 [usertype] computed_icrc drivers/infiniband/sw/rxe/rxe_icrc.c:147:23: sparse: got unsigned int >> drivers/infiniband/sw/rxe/rxe_icrc.c:179:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] icrc @@ got unsigned int @@
drivers/infiniband/sw/rxe/rxe_icrc.c:179:14: sparse: expected restricted __be32 [usertype] icrc
drivers/infiniband/sw/rxe/rxe_icrc.c:179:14: sparse: got unsigned int
vim +56 drivers/infiniband/sw/rxe/rxe_icrc.c
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 32
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 33 /**
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 34 * rxe_crc32 - Compute cumulative crc32 for a contiguous segment
46bb188d442e9494 Bob Pearson 2021-06-29 35 * @rxe: rdma_rxe device object
46bb188d442e9494 Bob Pearson 2021-06-29 36 * @crc: starting crc32 value from previous segments
46bb188d442e9494 Bob Pearson 2021-06-29 37 * @addr: starting address of segment
46bb188d442e9494 Bob Pearson 2021-06-29 38 * @len: length of the segment in bytes
46bb188d442e9494 Bob Pearson 2021-06-29 39 *
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 40 * Returns the crc32 cumulative checksum including the segment starting
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 41 * from crc.
46bb188d442e9494 Bob Pearson 2021-06-29 42 */
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 43 static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *addr,
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 44 size_t len)
46bb188d442e9494 Bob Pearson 2021-06-29 45 {
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 46 __be32 icrc;
46bb188d442e9494 Bob Pearson 2021-06-29 47 int err;
46bb188d442e9494 Bob Pearson 2021-06-29 48
46bb188d442e9494 Bob Pearson 2021-06-29 49 SHASH_DESC_ON_STACK(shash, rxe->tfm);
46bb188d442e9494 Bob Pearson 2021-06-29 50
46bb188d442e9494 Bob Pearson 2021-06-29 51 shash->tfm = rxe->tfm;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 52 *(__be32 *)shash_desc_ctx(shash) = crc;
46bb188d442e9494 Bob Pearson 2021-06-29 53 err = crypto_shash_update(shash, addr, len);
46bb188d442e9494 Bob Pearson 2021-06-29 54 if (unlikely(err)) {
46bb188d442e9494 Bob Pearson 2021-06-29 55 pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
46bb188d442e9494 Bob Pearson 2021-06-29 @56 return crc32_le(crc, addr, len);
46bb188d442e9494 Bob Pearson 2021-06-29 57 }
46bb188d442e9494 Bob Pearson 2021-06-29 58
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 59 icrc = *(__be32 *)shash_desc_ctx(shash);
46bb188d442e9494 Bob Pearson 2021-06-29 60 barrier_data(shash_desc_ctx(shash));
46bb188d442e9494 Bob Pearson 2021-06-29 61
46bb188d442e9494 Bob Pearson 2021-06-29 62 return icrc;
46bb188d442e9494 Bob Pearson 2021-06-29 63 }
46bb188d442e9494 Bob Pearson 2021-06-29 64
46bb188d442e9494 Bob Pearson 2021-06-29 65 /**
46bb188d442e9494 Bob Pearson 2021-06-29 66 * rxe_icrc_hdr - Compute a partial ICRC for the IB transport headers.
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 67 * @pkt: packet information
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 68 * @skb: packet buffer
46bb188d442e9494 Bob Pearson 2021-06-29 69 *
46bb188d442e9494 Bob Pearson 2021-06-29 70 * Returns the partial ICRC
46bb188d442e9494 Bob Pearson 2021-06-29 71 */
46bb188d442e9494 Bob Pearson 2021-06-29 72 static u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)
8700e3e7c4857d28 Moni Shoua 2016-06-16 73 {
8700e3e7c4857d28 Moni Shoua 2016-06-16 74 struct udphdr *udph;
8700e3e7c4857d28 Moni Shoua 2016-06-16 75 struct rxe_bth *bth;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 76 __be32 crc;
8700e3e7c4857d28 Moni Shoua 2016-06-16 77 int length;
8700e3e7c4857d28 Moni Shoua 2016-06-16 78 int hdr_size = sizeof(struct udphdr) +
8700e3e7c4857d28 Moni Shoua 2016-06-16 79 (skb->protocol == htons(ETH_P_IP) ?
8700e3e7c4857d28 Moni Shoua 2016-06-16 80 sizeof(struct iphdr) : sizeof(struct ipv6hdr));
8700e3e7c4857d28 Moni Shoua 2016-06-16 81 /* pseudo header buffer size is calculate using ipv6 header size since
8700e3e7c4857d28 Moni Shoua 2016-06-16 82 * it is bigger than ipv4
8700e3e7c4857d28 Moni Shoua 2016-06-16 83 */
8700e3e7c4857d28 Moni Shoua 2016-06-16 84 u8 pshdr[sizeof(struct udphdr) +
8700e3e7c4857d28 Moni Shoua 2016-06-16 85 sizeof(struct ipv6hdr) +
8700e3e7c4857d28 Moni Shoua 2016-06-16 86 RXE_BTH_BYTES];
8700e3e7c4857d28 Moni Shoua 2016-06-16 87
8700e3e7c4857d28 Moni Shoua 2016-06-16 88 /* This seed is the result of computing a CRC with a seed of
8700e3e7c4857d28 Moni Shoua 2016-06-16 89 * 0xfffffff and 8 bytes of 0xff representing a masked LRH.
8700e3e7c4857d28 Moni Shoua 2016-06-16 90 */
8700e3e7c4857d28 Moni Shoua 2016-06-16 @91 crc = 0xdebb20e3;
8700e3e7c4857d28 Moni Shoua 2016-06-16 92
8700e3e7c4857d28 Moni Shoua 2016-06-16 93 if (skb->protocol == htons(ETH_P_IP)) { /* IPv4 */
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 94 struct iphdr *ip4h = NULL;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 95
8700e3e7c4857d28 Moni Shoua 2016-06-16 96 memcpy(pshdr, ip_hdr(skb), hdr_size);
8700e3e7c4857d28 Moni Shoua 2016-06-16 97 ip4h = (struct iphdr *)pshdr;
8700e3e7c4857d28 Moni Shoua 2016-06-16 98 udph = (struct udphdr *)(ip4h + 1);
8700e3e7c4857d28 Moni Shoua 2016-06-16 99
8700e3e7c4857d28 Moni Shoua 2016-06-16 100 ip4h->ttl = 0xff;
8700e3e7c4857d28 Moni Shoua 2016-06-16 101 ip4h->check = CSUM_MANGLED_0;
8700e3e7c4857d28 Moni Shoua 2016-06-16 102 ip4h->tos = 0xff;
8700e3e7c4857d28 Moni Shoua 2016-06-16 103 } else { /* IPv6 */
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 104 struct ipv6hdr *ip6h = NULL;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 105
8700e3e7c4857d28 Moni Shoua 2016-06-16 106 memcpy(pshdr, ipv6_hdr(skb), hdr_size);
8700e3e7c4857d28 Moni Shoua 2016-06-16 107 ip6h = (struct ipv6hdr *)pshdr;
8700e3e7c4857d28 Moni Shoua 2016-06-16 108 udph = (struct udphdr *)(ip6h + 1);
8700e3e7c4857d28 Moni Shoua 2016-06-16 109
8700e3e7c4857d28 Moni Shoua 2016-06-16 110 memset(ip6h->flow_lbl, 0xff, sizeof(ip6h->flow_lbl));
8700e3e7c4857d28 Moni Shoua 2016-06-16 111 ip6h->priority = 0xf;
8700e3e7c4857d28 Moni Shoua 2016-06-16 112 ip6h->hop_limit = 0xff;
8700e3e7c4857d28 Moni Shoua 2016-06-16 113 }
8700e3e7c4857d28 Moni Shoua 2016-06-16 114
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 115 bth = (struct rxe_bth *)(udph + 1);
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 116 memcpy(bth, pkt->hdr, RXE_BTH_BYTES);
8700e3e7c4857d28 Moni Shoua 2016-06-16 117
8700e3e7c4857d28 Moni Shoua 2016-06-16 118 /* exclude bth.resv8a */
8700e3e7c4857d28 Moni Shoua 2016-06-16 119 bth->qpn |= cpu_to_be32(~BTH_QPN_MASK);
8700e3e7c4857d28 Moni Shoua 2016-06-16 120
8700e3e7c4857d28 Moni Shoua 2016-06-16 121 length = hdr_size + RXE_BTH_BYTES;
cee2688e3cd60e0d yonatanc 2017-04-20 122 crc = rxe_crc32(pkt->rxe, crc, pshdr, length);
8700e3e7c4857d28 Moni Shoua 2016-06-16 123
8700e3e7c4857d28 Moni Shoua 2016-06-16 124 /* And finish to compute the CRC on the remainder of the headers. */
cee2688e3cd60e0d yonatanc 2017-04-20 125 crc = rxe_crc32(pkt->rxe, crc, pkt->hdr + RXE_BTH_BYTES,
8700e3e7c4857d28 Moni Shoua 2016-06-16 126 rxe_opcode[pkt->opcode].length - RXE_BTH_BYTES);
8700e3e7c4857d28 Moni Shoua 2016-06-16 @127 return crc;
8700e3e7c4857d28 Moni Shoua 2016-06-16 128 }
0ce4db51163d271a Bob Pearson 2021-06-29 129
0ce4db51163d271a Bob Pearson 2021-06-29 130 /**
0ce4db51163d271a Bob Pearson 2021-06-29 131 * rxe_icrc_check - Compute ICRC for a packet and compare to the ICRC
0ce4db51163d271a Bob Pearson 2021-06-29 132 * delivered in the packet.
46bb188d442e9494 Bob Pearson 2021-06-29 133 * @skb: packet buffer with packet info in skb->cb[] (receive path)
0ce4db51163d271a Bob Pearson 2021-06-29 134 *
46bb188d442e9494 Bob Pearson 2021-06-29 135 * Returns 0 if the ICRCs match or an error on failure
0ce4db51163d271a Bob Pearson 2021-06-29 136 */
0ce4db51163d271a Bob Pearson 2021-06-29 137 int rxe_icrc_check(struct sk_buff *skb)
0ce4db51163d271a Bob Pearson 2021-06-29 138 {
0ce4db51163d271a Bob Pearson 2021-06-29 139 struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
0ce4db51163d271a Bob Pearson 2021-06-29 140 __be32 *icrcp;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 141 __be32 packet_icrc;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 142 __be32 computed_icrc;
0ce4db51163d271a Bob Pearson 2021-06-29 143
0ce4db51163d271a Bob Pearson 2021-06-29 144 icrcp = (__be32 *)(pkt->hdr + pkt->paylen - RXE_ICRC_SIZE);
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 145 packet_icrc = *icrcp;
0ce4db51163d271a Bob Pearson 2021-06-29 146
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 @147 computed_icrc = rxe_icrc_hdr(pkt, skb);
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 148 computed_icrc = rxe_crc32(pkt->rxe, computed_icrc,
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 149 (u8 *)payload_addr(pkt), payload_size(pkt) + bth_pad(pkt));
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 150 computed_icrc = ~computed_icrc;
0ce4db51163d271a Bob Pearson 2021-06-29 151
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 152 if (unlikely(computed_icrc != packet_icrc)) {
0ce4db51163d271a Bob Pearson 2021-06-29 153 if (skb->protocol == htons(ETH_P_IPV6))
0ce4db51163d271a Bob Pearson 2021-06-29 154 pr_warn_ratelimited("bad ICRC from %pI6c\n",
0ce4db51163d271a Bob Pearson 2021-06-29 155 &ipv6_hdr(skb)->saddr);
0ce4db51163d271a Bob Pearson 2021-06-29 156 else if (skb->protocol == htons(ETH_P_IP))
0ce4db51163d271a Bob Pearson 2021-06-29 157 pr_warn_ratelimited("bad ICRC from %pI4\n",
0ce4db51163d271a Bob Pearson 2021-06-29 158 &ip_hdr(skb)->saddr);
0ce4db51163d271a Bob Pearson 2021-06-29 159 else
0ce4db51163d271a Bob Pearson 2021-06-29 160 pr_warn_ratelimited("bad ICRC from unknown\n");
0ce4db51163d271a Bob Pearson 2021-06-29 161
0ce4db51163d271a Bob Pearson 2021-06-29 162 return -EINVAL;
0ce4db51163d271a Bob Pearson 2021-06-29 163 }
0ce4db51163d271a Bob Pearson 2021-06-29 164
0ce4db51163d271a Bob Pearson 2021-06-29 165 return 0;
0ce4db51163d271a Bob Pearson 2021-06-29 166 }
a142747477c2d184 Bob Pearson 2021-06-29 167
46bb188d442e9494 Bob Pearson 2021-06-29 168 /**
46bb188d442e9494 Bob Pearson 2021-06-29 169 * rxe_icrc_generate - Compute ICRC for a packet.
46bb188d442e9494 Bob Pearson 2021-06-29 170 * @pkt: packet information
46bb188d442e9494 Bob Pearson 2021-06-29 171 * @skb: packet buffer
46bb188d442e9494 Bob Pearson 2021-06-29 172 */
a142747477c2d184 Bob Pearson 2021-06-29 173 void rxe_icrc_generate(struct rxe_pkt_info *pkt, struct sk_buff *skb)
a142747477c2d184 Bob Pearson 2021-06-29 174 {
a142747477c2d184 Bob Pearson 2021-06-29 175 __be32 *icrcp;
e231ff2c1bb74fd5 Bob Pearson 2021-06-29 176 __be32 icrc;
a142747477c2d184 Bob Pearson 2021-06-29 177
a142747477c2d184 Bob Pearson 2021-06-29 178 icrcp = (__be32 *)(pkt->hdr + pkt->paylen - RXE_ICRC_SIZE);a142747477c2d184 Bob Pearson 2021-06-29 @179 icrc = rxe_icrc_hdr(pkt, skb);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 6/7 RDMA/rxe: Add parameters to control checking/generating ICRC
In reply to Bob PearsonAdd module parameters rxe_must_check_icrc and rxe_must_generat_icrc which default to 1 and which suppresses checking/generating ICRC if set to 0. The parameter is displayed in /sys as "check_icrc" or "generate_icrc".
--- drivers/infiniband/sw/rxe/rxe.c | 9 +++++++++ drivers/infiniband/sw/rxe/rxe.h | 4 ++++ drivers/infiniband/sw/rxe/rxe_net.c | 3 ++- drivers/infiniband/sw/rxe/rxe_recv.c | 8 +++++--- 4 files changed, 20 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +9 -0
@@ -15,6 +15,15 @@ MODULE_LICENSE("Dual BSD/GPL");bool rxe_initialized; +/* If set to false these parameters disable checking and/or generating +* the packet ICRC +*/ +bool rxe_must_check_icrc = true; +module_param_named (check_icrc, rxe_must_check_icrc, bool,0660 ); + +bool rxe_must_generate_icrc = true; +module_param_named (generate_icrc, rxe_must_generate_icrc, bool,0660 ); +/* free resources for a rxe device all objects created for this device must * have been destroyed */
drivers/infiniband/sw/rxe/rxe.h +4 -0
@@ -13,6 +13,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/skbuff.h> #include <rdma/ib_verbs.h>
@@ -39,6 +40,9 @@#define RXE_ROCE_V2_SPORT (0xc000) +extern bool rxe_must_check_icrc; +extern bool rxe_must_generate_icrc; +extern bool rxe_initialized;void rxe_set_mtu (struct rxe_dev *rxe,unsigned int dev_mtu);
drivers/infiniband/sw/rxe/rxe_net.c +2 -1
@@ -434,7 +434,8 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, goto drop; } -rxe_icrc_generate (skb, pkt); +if (rxe_must_generate_icrc) +rxe_icrc_generate (skb, pkt);if (pkt->mask &RXE_LOOPBACK_MASK ) {memcpy (SKB_TO_PKT (skb), pkt,sizeof (*pkt));
drivers/infiniband/sw/rxe/rxe_recv.c +5 -3
@@ -382,9 +382,11 @@ void rxe_rcv(struct sk_buff *skb)if (unlikely (err)) goto drop; - err =rxe_icrc_check (skb); -if (unlikely (err)) - goto drop; +if (rxe_must_check_icrc) { + err =rxe_icrc_check (skb); +if (unlikely (err)) + goto drop; + }rxe_counter_inc (rxe,RXE_CNT_RCVD_PKTS );
Signature · 1 line
2.30.2
PATCH 7/7 RDMA/rxe: Extend ICRC to support nonlinear skbs
In reply to Bob PearsonMake ICRC calculations aware of potential non-linear skbs. This is a step towards getting rid of skb_linearize() and its extra data copy.
--- drivers/infiniband/sw/rxe/rxe_icrc.c | 150 +++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_loc.h | 4 +- drivers/infiniband/sw/rxe/rxe_net.c | 7 +- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- 4 files changed, 103 insertions(+), 60 deletions(-)
drivers/infiniband/sw/rxe/rxe_icrc.c +95 -55
@@ -63,97 +63,134 @@ static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *addr, }/** -* rxe_icrc_hdr - Compute a partial ICRC for the IB transport headers. +* rxe_icrc_packet - Compute the ICRC for a packet * @skb: packet buffer * @pkt: packet information +* @icrcp: pointer to returned ICRC * -* Returns the partial ICRC +* Support linear or nonlinear skbs with frags +* +* Returns ICRC in *icrcp and 0 if no error occurs +* else returns an error. * For details see the InfiniBand Architecture spec and Annex 17 * the RoCE v2 spec. */ -static __be32 rxe_icrc_hdr (struct sk_buff *skb,struct rxe_pkt_info *pkt) +static int rxe_icrc_packet (struct sk_buff *skb,struct rxe_pkt_info *pkt, +__be32 *icrcp) { +struct skb_shared_info *info =skb_shinfo (skb); +struct rxe_dev *rxe = pkt->rxe; +struct iphdr *ip4h; +struct ipv6hdr *ip6h;struct udphdr *udph;struct rxe_bth *bth; -__be32 crc; -int length; -int hdr_size =sizeof (struct udphdr ) + +__be32 icrc; +int hdr_size; +u8 pseudo_hdr[128 ]; +int resid; +int bytes; +int nfrag; +skb_frag_t *frag; +u8 *addr; +int page_offset; +int start; +int len; +int ret; + + hdr_size = rxe_opcode[pkt->opcode].length +sizeof (struct udphdr ) + (skb->protocol ==htons (ETH_P_IP ) ? -sizeof (struct iphdr ) :sizeof (struct ipv6hdr )); -/* pseudo header buffer size is calculate using ipv6 header size since -* it is bigger than ipv4 -*/ -u8 pshdr[sizeof (struct udphdr ) + -sizeof (struct ipv6hdr ) + -RXE_BTH_BYTES ]; - -/* This seed is the result of computing a CRC with a seed of -* 0xfffffff and 8 bytes of 0xff representing a masked LRH. -*/ - crc =0xdebb20e3 ; +sizeof (struct iphdr ) :sizeof (struct ipv6hdr )); -if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ -struct iphdr *ip4h; + start = skb->network_header + skb->head - skb->data; + ret =skb_copy_bits (skb, start, pseudo_hdr, hdr_size); +if (unlikely (ret)) { +pr_warn_ratelimited ("Malformed skb\n" ); +return ret; + } -memcpy (pshdr,ip_hdr (skb), hdr_size); - ip4h = (struct iphdr *)pshdr; +if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ + ip4h = (struct iphdr *)pseudo_hdr; udph = (struct udphdr *)(ip4h +1 ); + bth = (struct rxe_bth *)(udph +1 ); ip4h->ttl =0xff ; ip4h->check =CSUM_MANGLED_0 ; ip4h->tos =0xff ; }else {/* IPv6 */ -struct ipv6hdr *ip6h; - -memcpy (pshdr,ipv6_hdr (skb), hdr_size); - ip6h = (struct ipv6hdr *)pshdr; + ip6h = (struct ipv6hdr *)pseudo_hdr; udph = (struct udphdr *)(ip6h +1 ); + bth = (struct rxe_bth *)(udph +1 ); -memset (ip6h->flow_lbl,0xff ,sizeof (ip6h->flow_lbl)); ip6h->priority =0xf ; ip6h->hop_limit =0xff ; } udph->check =CSUM_MANGLED_0 ; - - bth = (struct rxe_bth *)(udph +1 ); -memcpy (bth, pkt->hdr,RXE_BTH_BYTES ); - -/* exclude bth.resv8a */ bth->qpn |=cpu_to_be32 (~BTH_QPN_MASK ); - length = hdr_size +RXE_BTH_BYTES ; - crc =rxe_crc32 (pkt->rxe, crc, pshdr, length); + icrc =0xdebb20e3 ; + icrc =rxe_crc32 (pkt->rxe, icrc, pseudo_hdr, hdr_size); + + resid = (payload_size (pkt) +0x3 ) & ~0x3 ; + nfrag =-1 ; + +while (resid) { +if (nfrag <0 ) { + addr =skb_network_header (skb) + hdr_size; + len =skb_tail_pointer (skb) -skb_network_header (skb); + }else if (nfrag < info->nr_frags) { + frag = &info->frags[nfrag]; + page_offset = frag->bv_offset + hdr_size; + addr =kmap_atomic (frag->bv_page) + page_offset; + len = frag->bv_len; + }else { +pr_warn_ratelimited ("Malformed skb\n" ); +return -EINVAL ; + } + + bytes = len - hdr_size; +if (bytes >0 ) { +if (bytes > resid) + bytes = resid; + icrc =rxe_crc32 (rxe, icrc, addr, bytes); + resid -= bytes; + hdr_size =0 ; + }else { + hdr_size -= len; + } + +if (nfrag++ >=0 ) +kunmap_atomic (addr); + } + + *icrcp = ~icrc; -/* And finish to compute the CRC on the remainder of the headers. */ - crc =rxe_crc32 (pkt->rxe, crc, pkt->hdr +RXE_BTH_BYTES , - rxe_opcode[pkt->opcode].length -RXE_BTH_BYTES ); -return crc; +return 0 ; }/** * rxe_check_icrc - Compute ICRC for a packet and compare to the ICRC -* delivered in the packet. -* @skb: packet buffer with packet info in cb[] (receive path) +* in the packet. +* @skb: packet buffer +* @pkt: packet information * * Returns 0 if the ICRCs match or an error on failure */ -int rxe_icrc_check (struct sk_buff *skb) +int rxe_icrc_check (struct sk_buff *skb,struct rxe_pkt_info *pkt) { -struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);__be32 *icrcp;__be32 packet_icrc; -__be32 computed_icrc; +__be32 icrc; +int ret; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); packet_icrc = *icrcp; - computed_icrc =rxe_icrc_hdr (skb, pkt); - computed_icrc =rxe_crc32 (pkt->rxe, computed_icrc, - (u8 *)payload_addr (pkt),payload_size (pkt) +bth_pad (pkt)); - computed_icrc = ~computed_icrc; + ret =rxe_icrc_packet (skb, pkt, &icrc); +if (unlikely (ret)) +return ret; -if (unlikely (computed_icrc != packet_icrc)) { +if (unlikely (icrc != packet_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))pr_warn_ratelimited ("bad ICRC from %pI6c\n" , &ipv6_hdr (skb)->saddr);
@@ -162,7 +199,6 @@ int rxe_icrc_check(struct sk_buff *skb) &ip_hdr(skb)->saddr); else pr_warn_ratelimited("bad ICRC from unknown\n"); -return -EINVAL ; }
@@ -174,15 +210,19 @@ int rxe_icrc_check(struct sk_buff *skb)* correct position after the payload and pad. * @skb: packet buffer * @pkt: packet information +* +* Returns 0 on success or an error */ -void rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt) +int rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt) {__be32 *icrcp; -__be32 icrc; +int ret; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); - icrc =rxe_icrc_hdr (skb, pkt); - icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), -payload_size (pkt) +bth_pad (pkt)); - *icrcp = ~icrc; + + ret =rxe_icrc_packet (skb, pkt, icrcp); +if (unlikely (ret)) +return ret; + +return 0 ; }
drivers/infiniband/sw/rxe/rxe_loc.h +2 -2
@@ -194,8 +194,8 @@ int rxe_responder(void *arg);/* rxe_icrc.c */ int rxe_icrc_init (struct rxe_dev *rxe); -int rxe_icrc_check (struct sk_buff *skb); -void rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt); +int rxe_icrc_check (struct sk_buff *skb,struct rxe_pkt_info *pkt); +int rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt);void rxe_resp_queue_pkt (struct rxe_qp *qp,struct sk_buff *skb);
drivers/infiniband/sw/rxe/rxe_net.c +5 -2
@@ -434,8 +434,11 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, goto drop; } -if (rxe_must_generate_icrc) -rxe_icrc_generate (skb, pkt); +if (rxe_must_generate_icrc) { + err =rxe_icrc_generate (skb, pkt); +if (unlikely (err)) + goto drop; + }if (pkt->mask &RXE_LOOPBACK_MASK ) {memcpy (SKB_TO_PKT (skb), pkt,sizeof (*pkt));
drivers/infiniband/sw/rxe/rxe_recv.c +1 -1
@@ -383,7 +383,7 @@ void rxe_rcv(struct sk_buff *skb) goto drop;if (rxe_must_check_icrc) { - err =rxe_icrc_check (skb); + err =rxe_icrc_check (skb, pkt);if (unlikely (err)) goto drop; }
Signature · 1 line
2.30.2
Re: [PATCH 7/7] RDMA/rxe: Extend ICRC to support nonlinear skbs
Quoted 272 lines · Bob Pearson
Make ICRC calculations aware of potential non-linear skbs. This is a step towards getting rid of
skb_linearize()and its extra data copy.Signed-off-by Bob Pearson <[email protected]>--- drivers/infiniband/sw/rxe/rxe_icrc.c | 150 +++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_loc.h | 4 +- drivers/infiniband/sw/rxe/rxe_net.c | 7 +- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- 4 files changed, 103 insertions(+), 60 deletions(-)drivers/infiniband/sw/rxe/rxe_icrc.c +95
-55@@ -63,97 +63,134 @@ static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *addr, }/** -* rxe_icrc_hdr - Compute a partial ICRC for the IB transport headers. +* rxe_icrc_packet - Compute the ICRC for a packet * @skb: packet buffer * @pkt: packet information +* @icrcp: pointer to returned ICRC * -* Returns the partial ICRC +* Support linear or nonlinear skbs with frags +* +* Returns ICRC in *icrcp and 0 if no error occurs +* else returns an error. * For details see the InfiniBand Architecture spec and Annex 17 * the RoCE v2 spec. */ -static __be32 rxe_icrc_hdr (struct sk_buff *skb,struct rxe_pkt_info *pkt) +static int rxe_icrc_packet (struct sk_buff *skb,struct rxe_pkt_info *pkt, +__be32 *icrcp) { +struct skb_shared_info *info =skb_shinfo (skb); +struct rxe_dev *rxe = pkt->rxe; +struct iphdr *ip4h; +struct ipv6hdr *ip6h;struct udphdr *udph;struct rxe_bth *bth; -__be32 crc; -int length; -int hdr_size =sizeof (struct udphdr ) + +__be32 icrc; +int hdr_size; +u8 pseudo_hdr[128 ]; +int resid; +int bytes; +int nfrag; +skb_frag_t *frag; +u8 *addr; +int page_offset; +int start; +int len; +int ret; + + hdr_size = rxe_opcode[pkt->opcode].length +sizeof (struct udphdr ) + (skb->protocol ==htons (ETH_P_IP ) ? -sizeof (struct iphdr ) :sizeof (struct ipv6hdr )); -/* pseudo header buffer size is calculate using ipv6 header size since -* it is bigger than ipv4 -*/ -u8 pshdr[sizeof (struct udphdr ) + -sizeof (struct ipv6hdr ) + -RXE_BTH_BYTES ]; - -/* This seed is the result of computing a CRC with a seed of -* 0xfffffff and 8 bytes of 0xff representing a masked LRH. -*/ - crc =0xdebb20e3 ; +sizeof (struct iphdr ) :sizeof (struct ipv6hdr )); -if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ -struct iphdr *ip4h; + start = skb->network_header + skb->head - skb->data; + ret =skb_copy_bits (skb, start, pseudo_hdr, hdr_size); +if (unlikely (ret)) { +pr_warn_ratelimited ("Malformed skb\n" ); +return ret; + } -memcpy (pshdr,ip_hdr (skb), hdr_size); - ip4h = (struct iphdr *)pshdr; +if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ + ip4h = (struct iphdr *)pseudo_hdr; udph = (struct udphdr *)(ip4h +1 ); + bth = (struct rxe_bth *)(udph +1 ); ip4h->ttl =0xff ; ip4h->check =CSUM_MANGLED_0 ; ip4h->tos =0xff ; }else {/* IPv6 */ -struct ipv6hdr *ip6h; - -memcpy (pshdr,ipv6_hdr (skb), hdr_size); - ip6h = (struct ipv6hdr *)pshdr; + ip6h = (struct ipv6hdr *)pseudo_hdr; udph = (struct udphdr *)(ip6h +1 ); + bth = (struct rxe_bth *)(udph +1 ); -memset (ip6h->flow_lbl,0xff ,sizeof (ip6h->flow_lbl)); ip6h->priority =0xf ; ip6h->hop_limit =0xff ; } udph->check =CSUM_MANGLED_0 ; - - bth = (struct rxe_bth *)(udph +1 ); -memcpy (bth, pkt->hdr,RXE_BTH_BYTES ); - -/* exclude bth.resv8a */ bth->qpn |=cpu_to_be32 (~BTH_QPN_MASK ); - length = hdr_size +RXE_BTH_BYTES ; - crc =rxe_crc32 (pkt->rxe, crc, pshdr, length); + icrc =0xdebb20e3 ; + icrc =rxe_crc32 (pkt->rxe, icrc, pseudo_hdr, hdr_size); + + resid = (payload_size (pkt) +0x3 ) & ~0x3 ; + nfrag =-1 ; + +while (resid) { +if (nfrag <0 ) { + addr =skb_network_header (skb) + hdr_size; + len =skb_tail_pointer (skb) -skb_network_header (skb); + }else if (nfrag < info->nr_frags) { + frag = &info->frags[nfrag]; + page_offset = frag->bv_offset + hdr_size; + addr =kmap_atomic (frag->bv_page) + page_offset; + len = frag->bv_len; + }else { +pr_warn_ratelimited ("Malformed skb\n" ); +return -EINVAL ; + } + + bytes = len - hdr_size; +if (bytes >0 ) { +if (bytes > resid) + bytes = resid; + icrc =rxe_crc32 (rxe, icrc, addr, bytes); + resid -= bytes; + hdr_size =0 ; + }else { + hdr_size -= len; + } + +if (nfrag++ >=0 ) +kunmap_atomic (addr); + } + + *icrcp = ~icrc; -/* And finish to compute the CRC on the remainder of the headers. */ - crc =rxe_crc32 (pkt->rxe, crc, pkt->hdr +RXE_BTH_BYTES , - rxe_opcode[pkt->opcode].length -RXE_BTH_BYTES ); -return crc; +return 0 ; }/** * rxe_check_icrc - Compute ICRC for a packet and compare to the ICRC -* delivered in the packet. -* @skb: packet buffer with packet info in cb[] (receive path) +* in the packet. +* @skb: packet buffer +* @pkt: packet information * * Returns 0 if the ICRCs match or an error on failure */ -int rxe_icrc_check (struct sk_buff *skb) +int rxe_icrc_check (struct sk_buff *skb,struct rxe_pkt_info *pkt) { -struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);__be32 *icrcp;__be32 packet_icrc; -__be32 computed_icrc; +__be32 icrc; +int ret; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); packet_icrc = *icrcp; - computed_icrc =rxe_icrc_hdr (skb, pkt); - computed_icrc =rxe_crc32 (pkt->rxe, computed_icrc, - (u8 *)payload_addr (pkt),payload_size (pkt) +bth_pad (pkt)); - computed_icrc = ~computed_icrc; + ret =rxe_icrc_packet (skb, pkt, &icrc); +if (unlikely (ret)) +return ret; -if (unlikely (computed_icrc != packet_icrc)) { +if (unlikely (icrc != packet_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))pr_warn_ratelimited ("bad ICRC from %pI6c\n" , &ipv6_hdr (skb)->saddr);@@ -162,7 +199,6 @@ int rxe_icrc_check(struct sk_buff *skb) &ip_hdr(skb)->saddr); else pr_warn_ratelimited("bad ICRC from unknown\n"); -return -EINVAL ; }@@ -174,15 +210,19 @@ int rxe_icrc_check(struct sk_buff *skb)* correct position after the payload and pad. * @skb: packet buffer * @pkt: packet information +* +* Returns 0 on success or an error */ -void rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt) +int rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt) {__be32 *icrcp; -__be32 icrc; +int ret; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); - icrc =rxe_icrc_hdr (skb, pkt); - icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), -payload_size (pkt) +bth_pad (pkt)); - *icrcp = ~icrc; + + ret =rxe_icrc_packet (skb, pkt, icrcp); +if (unlikely (ret)) +return ret; + +return 0 ; }drivers/infiniband/sw/rxe/rxe_loc.h +2
-2@@ -194,8 +194,8 @@ int rxe_responder(void *arg);/* rxe_icrc.c */ int rxe_icrc_init (struct rxe_dev *rxe); -int rxe_icrc_check (struct sk_buff *skb); -void rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt); +int rxe_icrc_check (struct sk_buff *skb,struct rxe_pkt_info *pkt); +int rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt);void rxe_resp_queue_pkt (struct rxe_qp *qp,struct sk_buff *skb);drivers/infiniband/sw/rxe/rxe_net.c +5
-2@@ -434,8 +434,11 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, goto drop; } -if (rxe_must_generate_icrc) -rxe_icrc_generate (skb, pkt); +if (rxe_must_generate_icrc) { + err =rxe_icrc_generate (skb, pkt); +if (unlikely (err)) + goto drop; + }if (pkt->mask &RXE_LOOPBACK_MASK ) {memcpy (SKB_TO_PKT (skb), pkt,sizeof (*pkt));drivers/infiniband/sw/rxe/rxe_recv.c +0
-0
drivers/infiniband/sw/rxe/rxe_recv.c void rxe_rcv(struct sk_buff *skb) · line 389
Quoted 8 lines
drivers/infiniband/sw/rxe/rxe_recv.c +1
-1@@ -383,7 +383,7 @@ void rxe_rcv(struct sk_buff *skb) goto drop;if (rxe_must_check_icrc) { - err =rxe_icrc_check (skb); + err =rxe_icrc_check (skb, pkt);if (unlikely (err)) goto drop; }
Please ignore. This was sent in error. Only patches 0-5 belong.
Re: [PATCH 7/7] RDMA/rxe: Extend ICRC to support nonlinear skbs
In reply to Bob PearsonQuoted 272 lines · Bob Pearson
Make ICRC calculations aware of potential non-linear skbs. This is a step towards getting rid of
skb_linearize()and its extra data copy.Signed-off-by Bob Pearson <[email protected]>--- drivers/infiniband/sw/rxe/rxe_icrc.c | 150 +++++++++++++++++---------- drivers/infiniband/sw/rxe/rxe_loc.h | 4 +- drivers/infiniband/sw/rxe/rxe_net.c | 7 +- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- 4 files changed, 103 insertions(+), 60 deletions(-)drivers/infiniband/sw/rxe/rxe_icrc.c +95
-55@@ -63,97 +63,134 @@ static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *addr, }/** -* rxe_icrc_hdr - Compute a partial ICRC for the IB transport headers. +* rxe_icrc_packet - Compute the ICRC for a packet * @skb: packet buffer * @pkt: packet information +* @icrcp: pointer to returned ICRC * -* Returns the partial ICRC +* Support linear or nonlinear skbs with frags +* +* Returns ICRC in *icrcp and 0 if no error occurs +* else returns an error. * For details see the InfiniBand Architecture spec and Annex 17 * the RoCE v2 spec. */ -static __be32 rxe_icrc_hdr (struct sk_buff *skb,struct rxe_pkt_info *pkt) +static int rxe_icrc_packet (struct sk_buff *skb,struct rxe_pkt_info *pkt, +__be32 *icrcp) { +struct skb_shared_info *info =skb_shinfo (skb); +struct rxe_dev *rxe = pkt->rxe; +struct iphdr *ip4h; +struct ipv6hdr *ip6h;struct udphdr *udph;struct rxe_bth *bth; -__be32 crc; -int length; -int hdr_size =sizeof (struct udphdr ) + +__be32 icrc; +int hdr_size; +u8 pseudo_hdr[128 ]; +int resid; +int bytes; +int nfrag; +skb_frag_t *frag; +u8 *addr; +int page_offset; +int start; +int len; +int ret; + + hdr_size = rxe_opcode[pkt->opcode].length +sizeof (struct udphdr ) + (skb->protocol ==htons (ETH_P_IP ) ? -sizeof (struct iphdr ) :sizeof (struct ipv6hdr )); -/* pseudo header buffer size is calculate using ipv6 header size since -* it is bigger than ipv4 -*/ -u8 pshdr[sizeof (struct udphdr ) + -sizeof (struct ipv6hdr ) + -RXE_BTH_BYTES ]; - -/* This seed is the result of computing a CRC with a seed of -* 0xfffffff and 8 bytes of 0xff representing a masked LRH. -*/ - crc =0xdebb20e3 ; +sizeof (struct iphdr ) :sizeof (struct ipv6hdr )); -if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ -struct iphdr *ip4h; + start = skb->network_header + skb->head - skb->data; + ret =skb_copy_bits (skb, start, pseudo_hdr, hdr_size); +if (unlikely (ret)) { +pr_warn_ratelimited ("Malformed skb\n" ); +return ret; + } -memcpy (pshdr,ip_hdr (skb), hdr_size); - ip4h = (struct iphdr *)pshdr; +if (skb->protocol ==htons (ETH_P_IP )) {/* IPv4 */ + ip4h = (struct iphdr *)pseudo_hdr; udph = (struct udphdr *)(ip4h +1 ); + bth = (struct rxe_bth *)(udph +1 ); ip4h->ttl =0xff ; ip4h->check =CSUM_MANGLED_0 ; ip4h->tos =0xff ; }else {/* IPv6 */ -struct ipv6hdr *ip6h; - -memcpy (pshdr,ipv6_hdr (skb), hdr_size); - ip6h = (struct ipv6hdr *)pshdr; + ip6h = (struct ipv6hdr *)pseudo_hdr; udph = (struct udphdr *)(ip6h +1 ); + bth = (struct rxe_bth *)(udph +1 ); -memset (ip6h->flow_lbl,0xff ,sizeof (ip6h->flow_lbl)); ip6h->priority =0xf ; ip6h->hop_limit =0xff ; } udph->check =CSUM_MANGLED_0 ; - - bth = (struct rxe_bth *)(udph +1 ); -memcpy (bth, pkt->hdr,RXE_BTH_BYTES ); - -/* exclude bth.resv8a */ bth->qpn |=cpu_to_be32 (~BTH_QPN_MASK ); - length = hdr_size +RXE_BTH_BYTES ; - crc =rxe_crc32 (pkt->rxe, crc, pshdr, length); + icrc =0xdebb20e3 ; + icrc =rxe_crc32 (pkt->rxe, icrc, pseudo_hdr, hdr_size); + + resid = (payload_size (pkt) +0x3 ) & ~0x3 ; + nfrag =-1 ; + +while (resid) { +if (nfrag <0 ) { + addr =skb_network_header (skb) + hdr_size; + len =skb_tail_pointer (skb) -skb_network_header (skb); + }else if (nfrag < info->nr_frags) { + frag = &info->frags[nfrag]; + page_offset = frag->bv_offset + hdr_size; + addr =kmap_atomic (frag->bv_page) + page_offset; + len = frag->bv_len; + }else { +pr_warn_ratelimited ("Malformed skb\n" ); +return -EINVAL ; + } + + bytes = len - hdr_size; +if (bytes >0 ) { +if (bytes > resid) + bytes = resid; + icrc =rxe_crc32 (rxe, icrc, addr, bytes); + resid -= bytes; + hdr_size =0 ; + }else { + hdr_size -= len; + } + +if (nfrag++ >=0 ) +kunmap_atomic (addr); + } + + *icrcp = ~icrc; -/* And finish to compute the CRC on the remainder of the headers. */ - crc =rxe_crc32 (pkt->rxe, crc, pkt->hdr +RXE_BTH_BYTES , - rxe_opcode[pkt->opcode].length -RXE_BTH_BYTES ); -return crc; +return 0 ; }/** * rxe_check_icrc - Compute ICRC for a packet and compare to the ICRC -* delivered in the packet. -* @skb: packet buffer with packet info in cb[] (receive path) +* in the packet. +* @skb: packet buffer +* @pkt: packet information * * Returns 0 if the ICRCs match or an error on failure */ -int rxe_icrc_check (struct sk_buff *skb) +int rxe_icrc_check (struct sk_buff *skb,struct rxe_pkt_info *pkt) { -struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);__be32 *icrcp;__be32 packet_icrc; -__be32 computed_icrc; +__be32 icrc; +int ret; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); packet_icrc = *icrcp; - computed_icrc =rxe_icrc_hdr (skb, pkt); - computed_icrc =rxe_crc32 (pkt->rxe, computed_icrc, - (u8 *)payload_addr (pkt),payload_size (pkt) +bth_pad (pkt)); - computed_icrc = ~computed_icrc; + ret =rxe_icrc_packet (skb, pkt, &icrc); +if (unlikely (ret)) +return ret; -if (unlikely (computed_icrc != packet_icrc)) { +if (unlikely (icrc != packet_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))pr_warn_ratelimited ("bad ICRC from %pI6c\n" , &ipv6_hdr (skb)->saddr);@@ -162,7 +199,6 @@ int rxe_icrc_check(struct sk_buff *skb) &ip_hdr(skb)->saddr); else pr_warn_ratelimited("bad ICRC from unknown\n"); -return -EINVAL ; }@@ -174,15 +210,19 @@ int rxe_icrc_check(struct sk_buff *skb)* correct position after the payload and pad. * @skb: packet buffer * @pkt: packet information +* +* Returns 0 on success or an error */ -void rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt) +int rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt) {__be32 *icrcp; -__be32 icrc; +int ret; icrcp = (__be32 *)(pkt->hdr + pkt->paylen -RXE_ICRC_SIZE ); - icrc =rxe_icrc_hdr (skb, pkt); - icrc =rxe_crc32 (pkt->rxe, icrc, (u8 *)payload_addr (pkt), -payload_size (pkt) +bth_pad (pkt)); - *icrcp = ~icrc; + + ret =rxe_icrc_packet (skb, pkt, icrcp); +if (unlikely (ret)) +return ret; + +return 0 ; }drivers/infiniband/sw/rxe/rxe_loc.h +2
-2@@ -194,8 +194,8 @@ int rxe_responder(void *arg);/* rxe_icrc.c */ int rxe_icrc_init (struct rxe_dev *rxe); -int rxe_icrc_check (struct sk_buff *skb); -void rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt); +int rxe_icrc_check (struct sk_buff *skb,struct rxe_pkt_info *pkt); +int rxe_icrc_generate (struct sk_buff *skb,struct rxe_pkt_info *pkt);void rxe_resp_queue_pkt (struct rxe_qp *qp,struct sk_buff *skb);drivers/infiniband/sw/rxe/rxe_net.c +5
-2@@ -434,8 +434,11 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, goto drop; } -if (rxe_must_generate_icrc) -rxe_icrc_generate (skb, pkt); +if (rxe_must_generate_icrc) { + err =rxe_icrc_generate (skb, pkt); +if (unlikely (err)) + goto drop; + }if (pkt->mask &RXE_LOOPBACK_MASK ) {memcpy (SKB_TO_PKT (skb), pkt,sizeof (*pkt));drivers/infiniband/sw/rxe/rxe_recv.c +0
-0
drivers/infiniband/sw/rxe/rxe_recv.c void rxe_rcv(struct sk_buff *skb) · line 389
Quoted 8 lines
drivers/infiniband/sw/rxe/rxe_recv.c +1
-1@@ -383,7 +383,7 @@ void rxe_rcv(struct sk_buff *skb) goto drop;if (rxe_must_check_icrc) { - err =rxe_icrc_check (skb); + err =rxe_icrc_check (skb, pkt);if (unlikely (err)) goto drop; }
please ignore. This was sent in error. Only 0-5 were supposed to be sent.