Project

General

Profile

Bug #3373 » uts-xen-__CONST_RING_SIZE.patch

Igor Pashev, 2012-11-23 08:33 PM

View differences:

uts/usr/src/uts/common/xen/io/xnf.h 2012-11-23 17:48:26.512852906 +0000
31 31
extern "C" {
32 32
#endif
33 33

  
34
#define	NET_TX_RING_SIZE  __RING_SIZE((netif_tx_sring_t *)0, PAGESIZE)
35
#define	NET_RX_RING_SIZE  __RING_SIZE((netif_rx_sring_t *)0, PAGESIZE)
34
#define	NET_TX_RING_SIZE  __CONST_RING_SIZE(netif_tx, PAGESIZE)
35
#define	NET_RX_RING_SIZE  __CONST_RING_SIZE(netif_rx, PAGESIZE)
36 36

  
37 37
#define	XNF_MAXPKT	1500		/* MTU size */
38 38
#define	XNF_FRAMESIZE	1514		/* frame size including MAC header */
uts/usr/src/uts/common/xen/public/io/ring.h 2012-11-23 17:46:20.232682059 +0000
50 50
 * A ring contains as many entries as will fit, rounded down to the nearest 
51 51
 * power of two (so we can mask with (size-1) to loop around).
52 52
 */
53
#define __CONST_RING_SIZE(_s, _sz) \
54
    (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \
55
       sizeof(((struct _s##_sring *)0)->ring[0])))
56
/*
57
 * The same for passing in an actual pointer instead of a name tag.
58
 */
53 59
#define __RING_SIZE(_s, _sz) \
54 60
    (__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
55 61

  
uts/usr/src/uts/common/xen/io/xnb.h 2012-11-23 20:02:21.521874834 +0000
30 30
#define	_SYS_XNB_H
31 31

  
32 32
#include <sys/types.h>
33
#include <sys/sysmacros.h>
33 34
#include <sys/kstat.h>
34 35
#include <sys/stream.h>
35 36
#include <sys/ethernet.h>
......
40 41
extern "C" {
41 42
#endif
42 43

  
43
#define	NET_TX_RING_SIZE  __RING_SIZE((netif_tx_sring_t *)0, PAGESIZE)
44
#define	NET_RX_RING_SIZE  __RING_SIZE((netif_rx_sring_t *)0, PAGESIZE)
44
#define	NET_TX_RING_SIZE  __CONST_RING_SIZE(netif_tx, PAGESIZE)
45
#define	NET_RX_RING_SIZE  __CONST_RING_SIZE(netif_rx, PAGESIZE)
45 46

  
46 47
#define	XNBMAXPKT	1500		/* MTU size */
47 48

  
(2-2/2)