19 #include <linux/kernel.h>
20 #include <linux/errno.h>
21 #include <linux/types.h>
22 #include <linux/pci.h>
24 #include <linux/if_ether.h>
25 #include <linux/slab.h>
53 #define VNIC_MAX_RES_HDR_SIZE \
54 (sizeof(struct vnic_resource_header) + \
55 sizeof(struct vnic_resource) * RES_TYPE_MAX)
56 #define VNIC_RES_STRIDE 128
63 static int vnic_dev_discover_res(
struct vnic_dev *vdev,
84 "exp (%lx/%lx) curr (%x/%x)\n",
111 if (len + bar_offset > bar->
len) {
113 "out-of-bounds, offset 0x%x + "
114 "size 0x%x > bar len 0x%lx\n",
145 if (!vdev->
res[type].vaddr)
162 unsigned int desc_size)
170 unsigned int count_align = 32;
171 unsigned int desc_align = 16;
194 unsigned int desc_count,
unsigned int desc_size)
204 "Failed to allocate ring (size=%d), aborting\n",
238 int dev_cmd_err[] = {
265 for (delay = 0; delay <
wait; delay++) {
270 if (!(status & STAT_BUSY)) {
370 *stats = vdev->
stats;
467 mac_addr[i] = ((
u8 *)&a0)[
i];
473 int broadcast,
int promisc,
int allmulti)
498 ((
u8 *)&a0)[
i] = addr[
i];
503 "Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
504 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
516 ((
u8 *)&a0)[
i] = addr[
i];
521 "Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
522 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
540 a1 = ((
u64)intr << 32) & 0x0000ffff00000000ULL;
552 a1 = 0x0000ffff00000000ULL;
558 static int vnic_dev_notify_ready(
struct vnic_dev *vdev)
573 for (i = 1; i < nwords; i++)
575 }
while (csum != words[0]);
592 if (!vnic_dev_notify_ready(vdev))
600 if (!vnic_dev_notify_ready(vdev))
608 if (!vnic_dev_notify_ready(vdev))
616 if (!vnic_dev_notify_ready(vdev))
624 if (!vnic_dev_notify_ready(vdev))
679 if (vnic_dev_discover_res(vdev, bar))