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

Commit a2c33982 authored by Harout Hedeshian's avatar Harout Hedeshian Committed by Matt Wagantall
Browse files

net: rmnet_data: use netif_tx_lock when sending MAP ACK message



The initial implementation of MAP command would grab the global
tx lock on the physical transport interface directly. It seems grabbing
the lock on its own is not enough to serialize access to the underlying
device's ndo_start_xmit() function. In addition to grabbing the lock
the transmit queue must be placed in frozen state. The fix is to use the
standard netif_tx_lock/unlock APIs as provided by the core framework
rather than manually grabbing the spinlocks.

Additionally, the null check has been optimized with an unlikely().
A new LOGD() message was added for further debugging of MAP ACK
sending.

CRs-Fixed: 841068
Change-Id: Ia76396f3075f25cdf6bf7278bba0ec78433b2934
Signed-off-by: default avatarHarout Hedeshian <harouth@codeaurora.org>
parent 1b8c353a
Loading
Loading
Loading
Loading
+6 −8
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -114,22 +114,20 @@ static uint8_t rmnet_map_do_flow_control(struct sk_buff *skb,
static void rmnet_map_send_ack(struct sk_buff *skb,
static void rmnet_map_send_ack(struct sk_buff *skb,
			       unsigned char type)
			       unsigned char type)
{
{
	struct net_device *dev;
	struct rmnet_map_control_command_s *cmd;
	struct rmnet_map_control_command_s *cmd;
	unsigned long flags;
	int xmit_status;
	int xmit_status;


	if (!skb)
	if (unlikely(!skb))
		BUG();
		BUG();


	dev = skb->dev;

	cmd = RMNET_MAP_GET_CMD_START(skb);
	cmd = RMNET_MAP_GET_CMD_START(skb);
	cmd->cmd_type = type & 0x03;
	cmd->cmd_type = type & 0x03;


	spin_lock_irqsave(&(skb->dev->tx_global_lock), flags);
	netif_tx_lock(skb->dev);
	xmit_status = skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev);
	xmit_status = skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev);
	spin_unlock_irqrestore(&(skb->dev->tx_global_lock), flags);
	netif_tx_unlock(skb->dev);

	LOGD("MAP command ACK=%hhu sent with rc: %d", type & 0x03, xmit_status);
}
}


/**
/**