|
@@ -516,7 +516,8 @@ static int nicvf_init_resources(struct nicvf *nic)
|
|
static void nicvf_snd_pkt_handler(struct net_device *netdev,
|
|
static void nicvf_snd_pkt_handler(struct net_device *netdev,
|
|
struct cmp_queue *cq,
|
|
struct cmp_queue *cq,
|
|
struct cqe_send_t *cqe_tx,
|
|
struct cqe_send_t *cqe_tx,
|
|
- int cqe_type, int budget)
|
|
|
|
|
|
+ int cqe_type, int budget,
|
|
|
|
+ unsigned int *tx_pkts, unsigned int *tx_bytes)
|
|
{
|
|
{
|
|
struct sk_buff *skb = NULL;
|
|
struct sk_buff *skb = NULL;
|
|
struct nicvf *nic = netdev_priv(netdev);
|
|
struct nicvf *nic = netdev_priv(netdev);
|
|
@@ -547,6 +548,8 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev,
|
|
}
|
|
}
|
|
nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1);
|
|
nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1);
|
|
prefetch(skb);
|
|
prefetch(skb);
|
|
|
|
+ (*tx_pkts)++;
|
|
|
|
+ *tx_bytes += skb->len;
|
|
napi_consume_skb(skb, budget);
|
|
napi_consume_skb(skb, budget);
|
|
sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL;
|
|
sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL;
|
|
} else {
|
|
} else {
|
|
@@ -662,6 +665,7 @@ static int nicvf_cq_intr_handler(struct net_device *netdev, u8 cq_idx,
|
|
struct cmp_queue *cq = &qs->cq[cq_idx];
|
|
struct cmp_queue *cq = &qs->cq[cq_idx];
|
|
struct cqe_rx_t *cq_desc;
|
|
struct cqe_rx_t *cq_desc;
|
|
struct netdev_queue *txq;
|
|
struct netdev_queue *txq;
|
|
|
|
+ unsigned int tx_pkts = 0, tx_bytes = 0;
|
|
|
|
|
|
spin_lock_bh(&cq->lock);
|
|
spin_lock_bh(&cq->lock);
|
|
loop:
|
|
loop:
|
|
@@ -701,7 +705,7 @@ loop:
|
|
case CQE_TYPE_SEND:
|
|
case CQE_TYPE_SEND:
|
|
nicvf_snd_pkt_handler(netdev, cq,
|
|
nicvf_snd_pkt_handler(netdev, cq,
|
|
(void *)cq_desc, CQE_TYPE_SEND,
|
|
(void *)cq_desc, CQE_TYPE_SEND,
|
|
- budget);
|
|
|
|
|
|
+ budget, &tx_pkts, &tx_bytes);
|
|
tx_done++;
|
|
tx_done++;
|
|
break;
|
|
break;
|
|
case CQE_TYPE_INVALID:
|
|
case CQE_TYPE_INVALID:
|
|
@@ -730,6 +734,9 @@ done:
|
|
netdev = nic->pnicvf->netdev;
|
|
netdev = nic->pnicvf->netdev;
|
|
txq = netdev_get_tx_queue(netdev,
|
|
txq = netdev_get_tx_queue(netdev,
|
|
nicvf_netdev_qidx(nic, cq_idx));
|
|
nicvf_netdev_qidx(nic, cq_idx));
|
|
|
|
+ if (tx_pkts)
|
|
|
|
+ netdev_tx_completed_queue(txq, tx_pkts, tx_bytes);
|
|
|
|
+
|
|
nic = nic->pnicvf;
|
|
nic = nic->pnicvf;
|
|
if (netif_tx_queue_stopped(txq) && netif_carrier_ok(netdev)) {
|
|
if (netif_tx_queue_stopped(txq) && netif_carrier_ok(netdev)) {
|
|
netif_tx_start_queue(txq);
|
|
netif_tx_start_queue(txq);
|
|
@@ -1160,6 +1167,9 @@ int nicvf_stop(struct net_device *netdev)
|
|
|
|
|
|
netif_tx_disable(netdev);
|
|
netif_tx_disable(netdev);
|
|
|
|
|
|
|
|
+ for (qidx = 0; qidx < netdev->num_tx_queues; qidx++)
|
|
|
|
+ netdev_tx_reset_queue(netdev_get_tx_queue(netdev, qidx));
|
|
|
|
+
|
|
/* Free resources */
|
|
/* Free resources */
|
|
nicvf_config_data_transfer(nic, false);
|
|
nicvf_config_data_transfer(nic, false);
|
|
|
|
|