drivers: remove direct access to interrupt handle
[dpdk.git] / drivers / net / netvsc / hn_rxtx.c
index 0f4ef01..028f176 100644 (file)
@@ -356,9 +356,9 @@ static void hn_txd_put(struct hn_tx_queue *txq, struct hn_txdesc *txd)
 }
 
 void
-hn_dev_tx_queue_release(void *arg)
+hn_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
-       struct hn_tx_queue *txq = arg;
+       struct hn_tx_queue *txq = dev->data->tx_queues[qid];
 
        PMD_INIT_FUNC_TRACE();
 
@@ -615,7 +615,7 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
 
        if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) {
                m->vlan_tci = info->vlan_info;
-               m->ol_flags |= PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN;
+               m->ol_flags |= RTE_MBUF_F_RX_VLAN_STRIPPED | RTE_MBUF_F_RX_VLAN;
 
                /* NDIS always strips tag, put it back if necessary */
                if (!hv->vlan_strip && rte_vlan_insert(&m)) {
@@ -630,18 +630,18 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
 
        if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) {
                if (info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK)
-                       m->ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+                       m->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
 
                if (info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK
                                       | NDIS_RXCSUM_INFO_TCPCS_OK))
-                       m->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
+                       m->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
                else if (info->csum_info & (NDIS_RXCSUM_INFO_TCPCS_FAILED
                                            | NDIS_RXCSUM_INFO_UDPCS_FAILED))
-                       m->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+                       m->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
        }
 
        if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) {
-               m->ol_flags |= PKT_RX_RSS_HASH;
+               m->ol_flags |= RTE_MBUF_F_RX_RSS_HASH;
                m->hash.rss = info->hash_value;
        }
 
@@ -1004,9 +1004,9 @@ hn_rx_queue_free(struct hn_rx_queue *rxq, bool keep_primary)
 }
 
 void
-hn_dev_rx_queue_release(void *arg)
+hn_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
-       struct hn_rx_queue *rxq = arg;
+       struct hn_rx_queue *rxq = dev->data->rx_queues[qid];
 
        PMD_INIT_FUNC_TRACE();
 
@@ -1018,9 +1018,9 @@ hn_dev_rx_queue_release(void *arg)
  * For this device that means how many packets are pending in the ring.
  */
 uint32_t
-hn_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id)
+hn_dev_rx_queue_count(void *rx_queue)
 {
-       struct hn_rx_queue *rxq = dev->data->rx_queues[queue_id];
+       struct hn_rx_queue *rxq = rx_queue;
 
        return rte_ring_count(rxq->rx_ring);
 }
@@ -1331,17 +1331,17 @@ static void hn_encap(struct rndis_packet_msg *pkt,
                                          NDIS_PKTINFO_TYPE_HASHVAL);
        *pi_data = queue_id;
 
-       if (m->ol_flags & PKT_TX_VLAN_PKT) {
+       if (m->ol_flags & RTE_MBUF_F_TX_VLAN) {
                pi_data = hn_rndis_pktinfo_append(pkt, NDIS_VLAN_INFO_SIZE,
                                                  NDIS_PKTINFO_TYPE_VLAN);
                *pi_data = m->vlan_tci;
        }
 
-       if (m->ol_flags & PKT_TX_TCP_SEG) {
+       if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
                pi_data = hn_rndis_pktinfo_append(pkt, NDIS_LSO2_INFO_SIZE,
                                                  NDIS_PKTINFO_TYPE_LSO);
 
-               if (m->ol_flags & PKT_TX_IPV6) {
+               if (m->ol_flags & RTE_MBUF_F_TX_IPV6) {
                        *pi_data = NDIS_LSO2_INFO_MAKEIPV6(hlen,
                                                           m->tso_segsz);
                } else {
@@ -1349,23 +1349,23 @@ static void hn_encap(struct rndis_packet_msg *pkt,
                                                           m->tso_segsz);
                }
        } else if (m->ol_flags &
-                  (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM)) {
+                  (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) {
                pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE,
                                                  NDIS_PKTINFO_TYPE_CSUM);
                *pi_data = 0;
 
-               if (m->ol_flags & PKT_TX_IPV6)
+               if (m->ol_flags & RTE_MBUF_F_TX_IPV6)
                        *pi_data |= NDIS_TXCSUM_INFO_IPV6;
-               if (m->ol_flags & PKT_TX_IPV4) {
+               if (m->ol_flags & RTE_MBUF_F_TX_IPV4) {
                        *pi_data |= NDIS_TXCSUM_INFO_IPV4;
 
-                       if (m->ol_flags & PKT_TX_IP_CKSUM)
+                       if (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
                                *pi_data |= NDIS_TXCSUM_INFO_IPCS;
                }
 
-               if (m->ol_flags & PKT_TX_TCP_CKSUM)
+               if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM)
                        *pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen);
-               else if (m->ol_flags & PKT_TX_UDP_CKSUM)
+               else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM)
                        *pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen);
        }
 
@@ -1387,7 +1387,8 @@ static unsigned int hn_get_slots(const struct rte_mbuf *m)
                unsigned int size = rte_pktmbuf_data_len(m);
                unsigned int offs = rte_mbuf_data_iova(m) & PAGE_MASK;
 
-               slots += (offs + size + PAGE_SIZE - 1) / PAGE_SIZE;
+               slots += (offs + size + rte_mem_page_size() - 1) /
+                               rte_mem_page_size();
                m = m->next;
        }
 
@@ -1402,12 +1403,13 @@ static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
 
        while (m) {
                rte_iova_t addr = rte_mbuf_data_iova(m);
-               unsigned int page = addr / PAGE_SIZE;
+               unsigned int page = addr / rte_mem_page_size();
                unsigned int offset = addr & PAGE_MASK;
                unsigned int len = rte_pktmbuf_data_len(m);
 
                while (len > 0) {
-                       unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);
+                       unsigned int bytes = RTE_MIN(len,
+                                       rte_mem_page_size() - offset);
 
                        sg[segs].page = page;
                        sg[segs].ofs = offset;
@@ -1450,7 +1452,7 @@ static int hn_xmit_sg(struct hn_tx_queue *txq,
        addr = txq->tx_rndis_iova +
                ((char *)txd->rndis_pkt - (char *)txq->tx_rndis);
 
-       sg[0].page = addr / PAGE_SIZE;
+       sg[0].page = addr / rte_mem_page_size();
        sg[0].ofs = addr & PAGE_MASK;
        sg[0].len = RNDIS_PACKET_MSG_OFFSET_ABS(hn_rndis_pktlen(txd->rndis_pkt));
        segs = 1;
@@ -1646,7 +1648,7 @@ hn_dev_free_queues(struct rte_eth_dev *dev)
        dev->data->nb_rx_queues = 0;
 
        for (i = 0; i < dev->data->nb_tx_queues; i++) {
-               hn_dev_tx_queue_release(dev->data->tx_queues[i]);
+               hn_dev_tx_queue_release(dev, i);
                dev->data->tx_queues[i] = NULL;
        }
        dev->data->nb_tx_queues = 0;