s2e/source/s2e-linux-kernel/linux-4.9.3/drivers/net/ethernet/ti/davinci_emac.c
/**
 * emac_dev_xmit - EMAC Transmit function
 * @skb: SKB pointer
 * @ndev: The DaVinci EMAC network adapter
 *
 * Called by the system to transmit a packet  - we queue the packet in
 * EMAC hardware transmit queue
 *
 * Returns success(NETDEV_TX_OK) or error code (typically out of desc's)
 */
EMAC Transmit function
@skb: SKB pointer
@ndev: The DaVinci EMAC network adapter

Called by the system to transmit a packet  - we queue the packet in
EMAC hardware transmit queue

Returns success(NETDEV_TX_OK) or error code (typically out of desc's)
EMAC Transmit function @skb : SKB pointer @ndev : The DaVinci EMAC network adapter Called by the system to transmit a packet - we queue the packet in EMAC hardware transmit queue Returns success ( NETDEV_TX_OK ) or error code ( typically out of desc ' s )
static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
{
	struct device *emac_dev = &ndev->dev;
	int ret_code;
	struct emac_priv *priv = netdev_priv(ndev);
	if (unlikely(!priv->link)) {
		if (netif_msg_tx_err(priv) && net_ratelimit())
			dev_err(emac_dev, "DaVinci EMAC: No link to transmit");
		goto fail_tx;
	}
	ret_code = skb_padto(skb, EMAC_DEF_MIN_ETHPKTSIZE);
	if (unlikely(ret_code < 0)) {
		if (netif_msg_tx_err(priv) && net_ratelimit())
			dev_err(emac_dev, "DaVinci EMAC: packet pad failed");
		goto fail_tx;
	}
	skb_tx_timestamp(skb);
	ret_code = cpdma_chan_submit(priv->txchan, skb, skb->data, skb->len,
				     0);
	if (unlikely(ret_code != 0)) {
		if (netif_msg_tx_err(priv) && net_ratelimit())
			dev_err(emac_dev, "DaVinci EMAC: desc submit failed");
		goto fail_tx;
	}
	if (unlikely(!cpdma_check_free_tx_desc(priv->txchan)))
		netif_stop_queue(ndev);
	return NETDEV_TX_OK;
fail_tx:
	ndev->stats.tx_dropped++;
	netif_stop_queue(ndev);
	return NETDEV_TX_BUSY;
}
static int emac_dev_xmit ( struct sk_buff * skb , struct net_device * ndev ) { struct device * emac_dev = & ndev -> dev ; int ret_code ; struct emac_priv * priv = netdev_priv ( ndev ) ; if ( unlikely ( ! priv -> link ) ) { if ( netif_msg_tx_err ( priv ) && net_ratelimit ( ) ) dev_err ( emac_dev , " " ) ; goto fail_tx ; } ret_code = skb_padto ( skb , EMAC_DEF_MIN_ETHPKTSIZE ) ; if ( unlikely ( ret_code < 0 ) ) { if ( netif_msg_tx_err ( priv ) && net_ratelimit ( ) ) dev_err ( emac_dev , " " ) ; goto fail_tx ; } skb_tx_timestamp ( skb ) ; ret_code = cpdma_chan_submit ( priv -> txchan , skb , skb -> data , skb -> len , 0 ) ; if ( unlikely ( ret_code != 0 ) ) { if ( netif_msg_tx_err ( priv ) && net_ratelimit ( ) ) dev_err ( emac_dev , " " ) ; goto fail_tx ; } if ( unlikely ( ! cpdma_check_free_tx_desc ( priv -> txchan ) ) ) netif_stop_queue ( ndev ) ; return NETDEV_TX_OK ; fail_tx : ndev -> stats . tx_dropped ++ ; netif_stop_queue ( ndev ) ; return NETDEV_TX_BUSY ; }
emac_dev_xmit - EMAC Transmit function
 @skb: SKB pointer
 @ndev: The DaVinci EMAC network adapter
emac_dev_xmit - EMAC Transmit function @skb : SKB pointer @ndev : The DaVinci EMAC network adapter
/* If no link, return */ /* If there is no more tx desc left free then we need to
	 * tell the kernel to stop sending us tx frames.
	 */