Skip to content

Commit a2e20b2

Browse files
tititiou36jgunthorpe
authored andcommitted
RDMA/irdma: Slightly optimize irdma_form_ah_cm_frame()
There is no need to zero 'pktsize' bytes of 'buf', only the header needs to be cleared, to be safe. All the other bytes are already written with some memcpy() at the end of the function. Doing so also gives the opportunity to the compiler to avoid the memset() call. It can be inlined now that the length is known as compile time. Link: https://lore.kernel.org/r/098e3c397be0436f1867899245ecfe656c472110.1675369386.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 67a00d2 commit a2e20b2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/infiniband/hw/irdma

drivers/infiniband/hw/irdma/cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static struct irdma_puda_buf *irdma_form_ah_cm_frame(struct irdma_cm_node *cm_no
337337

338338
pktsize = sizeof(*tcph) + opts_len + hdr_len + pd_len;
339339

340-
memset(buf, 0, pktsize);
340+
memset(buf, 0, sizeof(*tcph));
341341

342342
sqbuf->totallen = pktsize;
343343
sqbuf->tcphlen = sizeof(*tcph) + opts_len;

0 commit comments

Comments
 (0)