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

Commit b85e06f7 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

hv_netvsc: replace divide with mask when computing padding



Packet alignment is always a power of 2 therefore modulus can
be replaced with a faster and operation

Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 200a5699
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -712,11 +712,12 @@ static u32 netvsc_copy_to_send_buf(struct netvsc_device *net_device,
	int i;
	u32 msg_size = 0;
	u32 padding = 0;
	u32 remain = packet->total_data_buflen % net_device->pkt_align;
	u32 page_count = packet->cp_partial ? packet->rmsg_pgcnt :
		packet->page_buf_cnt;
	u32 remain;

	/* Add padding */
	remain = packet->total_data_buflen & (net_device->pkt_align - 1);
	if (skb->xmit_more && remain && !packet->cp_partial) {
		padding = net_device->pkt_align - remain;
		rndis_msg->msg_len += padding;