|
@@ -23,12 +23,7 @@
|
|
|
|
|
|
#include <linux/virtio_ring.h>
|
|
|
|
|
|
-#ifndef __KERNEL__
|
|
|
-#define ALIGN(a, x) (((a) + (x) - 1) & ~((x) - 1))
|
|
|
-#define __aligned(x) __attribute__ ((aligned(x)))
|
|
|
-#endif
|
|
|
-
|
|
|
-#define mic_aligned_size(x) ALIGN(sizeof(x), 8)
|
|
|
+#define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1))
|
|
|
|
|
|
/**
|
|
|
* struct mic_device_desc: Virtio device information shared between the
|
|
@@ -49,7 +44,7 @@ struct mic_device_desc {
|
|
|
__u8 config_len;
|
|
|
__u8 status;
|
|
|
__u64 config[0];
|
|
|
-} __aligned(8);
|
|
|
+} __attribute__ ((aligned(8)));
|
|
|
|
|
|
/**
|
|
|
* struct mic_device_ctrl: Per virtio device information in the device page
|
|
@@ -74,7 +69,7 @@ struct mic_device_ctrl {
|
|
|
__u8 used_address_updated;
|
|
|
__s8 c2h_vdev_db;
|
|
|
__s8 h2c_vdev_db;
|
|
|
-} __aligned(8);
|
|
|
+} __attribute__ ((aligned(8)));
|
|
|
|
|
|
/**
|
|
|
* struct mic_bootparam: Virtio device independent information in device page
|
|
@@ -93,7 +88,7 @@ struct mic_bootparam {
|
|
|
__s8 h2c_config_db;
|
|
|
__u8 shutdown_status;
|
|
|
__u8 shutdown_card;
|
|
|
-} __aligned(8);
|
|
|
+} __attribute__ ((aligned(8)));
|
|
|
|
|
|
/**
|
|
|
* struct mic_device_page: High level representation of the device page
|
|
@@ -119,7 +114,7 @@ struct mic_vqconfig {
|
|
|
__u64 address;
|
|
|
__u64 used_address;
|
|
|
__u16 num;
|
|
|
-} __aligned(8);
|
|
|
+} __attribute__ ((aligned(8)));
|
|
|
|
|
|
/*
|
|
|
* The alignment to use between consumer and producer parts of vring.
|
|
@@ -173,15 +168,13 @@ struct mic_vring {
|
|
|
int len;
|
|
|
};
|
|
|
|
|
|
-#define mic_aligned_desc_size(d) ALIGN(mic_desc_size(d), 8)
|
|
|
+#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
|
|
|
|
|
|
#ifndef INTEL_MIC_CARD
|
|
|
static inline unsigned mic_desc_size(const struct mic_device_desc *desc)
|
|
|
{
|
|
|
- return mic_aligned_size(*desc)
|
|
|
- + desc->num_vq * mic_aligned_size(struct mic_vqconfig)
|
|
|
- + desc->feature_len * 2
|
|
|
- + desc->config_len;
|
|
|
+ return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig)
|
|
|
+ + desc->feature_len * 2 + desc->config_len;
|
|
|
}
|
|
|
|
|
|
static inline struct mic_vqconfig *
|
|
@@ -201,8 +194,7 @@ static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc)
|
|
|
}
|
|
|
static inline unsigned mic_total_desc_size(struct mic_device_desc *desc)
|
|
|
{
|
|
|
- return mic_aligned_desc_size(desc) +
|
|
|
- mic_aligned_size(struct mic_device_ctrl);
|
|
|
+ return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
|
|
|
}
|
|
|
#endif
|
|
|
|