@@ -78,8 +78,6 @@ struct netfront_cb {
7878
7979#define RX_COPY_THRESHOLD 256
8080
81- #define GRANT_INVALID_REF 0
82-
8381#define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, XEN_PAGE_SIZE)
8482#define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, XEN_PAGE_SIZE)
8583
@@ -224,7 +222,7 @@ static grant_ref_t xennet_get_rx_ref(struct netfront_queue *queue,
224222{
225223 int i = xennet_rxidx (ri );
226224 grant_ref_t ref = queue -> grant_rx_ref [i ];
227- queue -> grant_rx_ref [i ] = GRANT_INVALID_REF ;
225+ queue -> grant_rx_ref [i ] = INVALID_GRANT_REF ;
228226 return ref ;
229227}
230228
@@ -432,7 +430,7 @@ static bool xennet_tx_buf_gc(struct netfront_queue *queue)
432430 }
433431 gnttab_release_grant_reference (
434432 & queue -> gref_tx_head , queue -> grant_tx_ref [id ]);
435- queue -> grant_tx_ref [id ] = GRANT_INVALID_REF ;
433+ queue -> grant_tx_ref [id ] = INVALID_GRANT_REF ;
436434 queue -> grant_tx_page [id ] = NULL ;
437435 add_id_to_list (& queue -> tx_skb_freelist , queue -> tx_link , id );
438436 dev_kfree_skb_irq (skb );
@@ -1021,7 +1019,7 @@ static int xennet_get_responses(struct netfront_queue *queue,
10211019 * the backend driver. In future this should flag the bad
10221020 * situation to the system controller to reboot the backend.
10231021 */
1024- if (ref == GRANT_INVALID_REF ) {
1022+ if (ref == INVALID_GRANT_REF ) {
10251023 if (net_ratelimit ())
10261024 dev_warn (dev , "Bad rx response id %d.\n" ,
10271025 rx -> id );
@@ -1390,7 +1388,7 @@ static void xennet_release_tx_bufs(struct netfront_queue *queue)
13901388 gnttab_end_foreign_access (queue -> grant_tx_ref [i ],
13911389 (unsigned long )page_address (queue -> grant_tx_page [i ]));
13921390 queue -> grant_tx_page [i ] = NULL ;
1393- queue -> grant_tx_ref [i ] = GRANT_INVALID_REF ;
1391+ queue -> grant_tx_ref [i ] = INVALID_GRANT_REF ;
13941392 add_id_to_list (& queue -> tx_skb_freelist , queue -> tx_link , i );
13951393 dev_kfree_skb_irq (skb );
13961394 }
@@ -1411,7 +1409,7 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue)
14111409 continue ;
14121410
14131411 ref = queue -> grant_rx_ref [id ];
1414- if (ref == GRANT_INVALID_REF )
1412+ if (ref == INVALID_GRANT_REF )
14151413 continue ;
14161414
14171415 page = skb_frag_page (& skb_shinfo (skb )-> frags [0 ]);
@@ -1422,7 +1420,7 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue)
14221420 get_page (page );
14231421 gnttab_end_foreign_access (ref ,
14241422 (unsigned long )page_address (page ));
1425- queue -> grant_rx_ref [id ] = GRANT_INVALID_REF ;
1423+ queue -> grant_rx_ref [id ] = INVALID_GRANT_REF ;
14261424
14271425 kfree_skb (skb );
14281426 }
@@ -1761,7 +1759,7 @@ static int netfront_probe(struct xenbus_device *dev,
17611759static void xennet_end_access (int ref , void * page )
17621760{
17631761 /* This frees the page as a side-effect */
1764- if (ref != GRANT_INVALID_REF )
1762+ if (ref != INVALID_GRANT_REF )
17651763 gnttab_end_foreign_access (ref , (unsigned long )page );
17661764}
17671765
@@ -1798,8 +1796,8 @@ static void xennet_disconnect_backend(struct netfront_info *info)
17981796 xennet_end_access (queue -> tx_ring_ref , queue -> tx .sring );
17991797 xennet_end_access (queue -> rx_ring_ref , queue -> rx .sring );
18001798
1801- queue -> tx_ring_ref = GRANT_INVALID_REF ;
1802- queue -> rx_ring_ref = GRANT_INVALID_REF ;
1799+ queue -> tx_ring_ref = INVALID_GRANT_REF ;
1800+ queue -> rx_ring_ref = INVALID_GRANT_REF ;
18031801 queue -> tx .sring = NULL ;
18041802 queue -> rx .sring = NULL ;
18051803
@@ -1927,8 +1925,8 @@ static int setup_netfront(struct xenbus_device *dev,
19271925 grant_ref_t gref ;
19281926 int err ;
19291927
1930- queue -> tx_ring_ref = GRANT_INVALID_REF ;
1931- queue -> rx_ring_ref = GRANT_INVALID_REF ;
1928+ queue -> tx_ring_ref = INVALID_GRANT_REF ;
1929+ queue -> rx_ring_ref = INVALID_GRANT_REF ;
19321930 queue -> rx .sring = NULL ;
19331931 queue -> tx .sring = NULL ;
19341932
@@ -1978,17 +1976,17 @@ static int setup_netfront(struct xenbus_device *dev,
19781976 * granted pages because backend is not accessing it at this point.
19791977 */
19801978 fail :
1981- if (queue -> rx_ring_ref != GRANT_INVALID_REF ) {
1979+ if (queue -> rx_ring_ref != INVALID_GRANT_REF ) {
19821980 gnttab_end_foreign_access (queue -> rx_ring_ref ,
19831981 (unsigned long )rxs );
1984- queue -> rx_ring_ref = GRANT_INVALID_REF ;
1982+ queue -> rx_ring_ref = INVALID_GRANT_REF ;
19851983 } else {
19861984 free_page ((unsigned long )rxs );
19871985 }
1988- if (queue -> tx_ring_ref != GRANT_INVALID_REF ) {
1986+ if (queue -> tx_ring_ref != INVALID_GRANT_REF ) {
19891987 gnttab_end_foreign_access (queue -> tx_ring_ref ,
19901988 (unsigned long )txs );
1991- queue -> tx_ring_ref = GRANT_INVALID_REF ;
1989+ queue -> tx_ring_ref = INVALID_GRANT_REF ;
19921990 } else {
19931991 free_page ((unsigned long )txs );
19941992 }
@@ -2020,15 +2018,15 @@ static int xennet_init_queue(struct netfront_queue *queue)
20202018 queue -> tx_pend_queue = TX_LINK_NONE ;
20212019 for (i = 0 ; i < NET_TX_RING_SIZE ; i ++ ) {
20222020 queue -> tx_link [i ] = i + 1 ;
2023- queue -> grant_tx_ref [i ] = GRANT_INVALID_REF ;
2021+ queue -> grant_tx_ref [i ] = INVALID_GRANT_REF ;
20242022 queue -> grant_tx_page [i ] = NULL ;
20252023 }
20262024 queue -> tx_link [NET_TX_RING_SIZE - 1 ] = TX_LINK_NONE ;
20272025
20282026 /* Clear out rx_skbs */
20292027 for (i = 0 ; i < NET_RX_RING_SIZE ; i ++ ) {
20302028 queue -> rx_skbs [i ] = NULL ;
2031- queue -> grant_rx_ref [i ] = GRANT_INVALID_REF ;
2029+ queue -> grant_rx_ref [i ] = INVALID_GRANT_REF ;
20322030 }
20332031
20342032 /* A grant for every tx ring slot */
0 commit comments