/** ipa_start_xmit() - Transmit an skb * @skb: Socket buffer to be transmitted * @netdev: Network device * * Return: NETDEV_TX_OK if successful (or dropped), NETDEV_TX_BUSY otherwise
* Normally NETDEV_TX_OK indicates the buffer was successfully transmitted. * If the buffer has an unexpected protocol or its size is out of range it * is quietly dropped, returning NETDEV_TX_OK. NETDEV_TX_BUSY indicates * the buffer cannot be sent at this time and should retried later.
*/ static netdev_tx_t
ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev)
{ struct net_device_stats *stats = &netdev->stats; struct ipa_priv *priv = netdev_priv(netdev); struct ipa_endpoint *endpoint; struct ipa *ipa = priv->ipa;
u32 skb_len = skb->len; struct device *dev; int ret;
/* The hardware must be powered for us to transmit, so if we're not * ready we want the network stack to stop queueing until power is * ACTIVE. Once runtime resume has completed, we inform the network * stack it's OK to try transmitting again. * * We learn from pm_runtime_get() whether the hardware is powered. * If it was not, powering up is either started or already underway. * And in that case we want to disable queueing, expecting it to be * re-enabled once power is ACTIVE. But runtime PM and network * transmit run concurrently, and if we're not careful the requests * to stop and start queueing could occur in the wrong order. * * For that reason we *always* stop queueing here, *before* the call * to pm_runtime_get(). If we determine here that power is ACTIVE, * we restart queueing before transmitting the SKB. Otherwise * queueing will eventually be enabled after resume completes.
*/
netif_stop_queue(netdev);
dev = ipa->dev;
ret = pm_runtime_get(dev); if (ret < 1) { /* If a resume won't happen, just drop the packet */ if (ret < 0 && ret != -EINPROGRESS) {
netif_wake_queue(netdev);
pm_runtime_put_noidle(dev); goto err_drop_skb;
}
/** * ipa_modem_wake_queue_work() - enable modem netdev queue * @work: Work structure * * Re-enable transmit on the modem network device. This is called * in (power management) work queue context, scheduled when resuming * the modem. We can't enable the queue directly in ipa_modem_resume() * because transmits restart the instant the queue is awakened; but the * device power state won't be ACTIVE until *after* ipa_modem_resume() * returns.
*/ staticvoid ipa_modem_wake_queue_work(struct work_struct *work)
{ struct ipa_priv *priv = container_of(work, struct ipa_priv, work);
netif_wake_queue(priv->tx->netdev);
}
/** ipa_modem_resume() - resume callback for runtime_pm * @dev: pointer to device * * Resume the modem's endpoints.
*/ void ipa_modem_resume(struct net_device *netdev)
{ struct ipa_priv *priv;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.