Revision fd506b4f hw/net/spapr_llan.c
b/hw/net/spapr_llan.c | ||
---|---|---|
73 | 73 |
#define VLAN_RX_BDS_OFF 16 |
74 | 74 |
#define VLAN_MAX_BUFS ((SPAPR_TCE_PAGE_SIZE - VLAN_RX_BDS_OFF) / 8) |
75 | 75 |
|
76 |
#define TYPE_VIO_SPAPR_VLAN_DEVICE "spapr-vlan" |
|
77 |
#define VIO_SPAPR_VLAN_DEVICE(obj) \ |
|
78 |
OBJECT_CHECK(VIOsPAPRVLANDevice, (obj), TYPE_VIO_SPAPR_VLAN_DEVICE) |
|
79 |
|
|
76 | 80 |
typedef struct VIOsPAPRVLANDevice { |
77 | 81 |
VIOsPAPRDevice sdev; |
78 | 82 |
NICConf nicconf; |
... | ... | |
93 | 97 |
static ssize_t spapr_vlan_receive(NetClientState *nc, const uint8_t *buf, |
94 | 98 |
size_t size) |
95 | 99 |
{ |
96 |
VIOsPAPRDevice *sdev = qemu_get_nic_opaque(nc);
|
|
97 |
VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev;
|
|
100 |
VIOsPAPRVLANDevice *dev = qemu_get_nic_opaque(nc);
|
|
101 |
VIOsPAPRDevice *sdev = VIO_SPAPR_DEVICE(dev);
|
|
98 | 102 |
vlan_bd_t rxq_bd = vio_ldq(sdev, dev->buf_list + VLAN_RXQ_BD_OFF); |
99 | 103 |
vlan_bd_t bd; |
100 | 104 |
int buf_ptr = dev->use_buf_ptr; |
... | ... | |
192 | 196 |
|
193 | 197 |
static void spapr_vlan_reset(VIOsPAPRDevice *sdev) |
194 | 198 |
{ |
195 |
VIOsPAPRVLANDevice *dev = DO_UPCAST(VIOsPAPRVLANDevice, sdev, sdev);
|
|
199 |
VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
|
|
196 | 200 |
|
197 | 201 |
dev->buf_list = 0; |
198 | 202 |
dev->rx_bufs = 0; |
... | ... | |
201 | 205 |
|
202 | 206 |
static int spapr_vlan_init(VIOsPAPRDevice *sdev) |
203 | 207 |
{ |
204 |
VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev;
|
|
208 |
VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
|
|
205 | 209 |
|
206 | 210 |
qemu_macaddr_default_if_unset(&dev->nicconf.macaddr); |
207 | 211 |
|
... | ... | |
225 | 229 |
|
226 | 230 |
static int spapr_vlan_devnode(VIOsPAPRDevice *dev, void *fdt, int node_off) |
227 | 231 |
{ |
228 |
VIOsPAPRVLANDevice *vdev = (VIOsPAPRVLANDevice *)dev;
|
|
232 |
VIOsPAPRVLANDevice *vdev = VIO_SPAPR_VLAN_DEVICE(dev);
|
|
229 | 233 |
uint8_t padded_mac[8] = {0, 0}; |
230 | 234 |
int ret; |
231 | 235 |
|
... | ... | |
282 | 286 |
target_ulong rec_queue = args[2]; |
283 | 287 |
target_ulong filter_list = args[3]; |
284 | 288 |
VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); |
285 |
VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev;
|
|
289 |
VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
|
|
286 | 290 |
vlan_bd_t filter_list_bd; |
287 | 291 |
|
288 | 292 |
if (!dev) { |
... | ... | |
341 | 345 |
{ |
342 | 346 |
target_ulong reg = args[0]; |
343 | 347 |
VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); |
344 |
VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev;
|
|
348 |
VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
|
|
345 | 349 |
|
346 | 350 |
if (!dev) { |
347 | 351 |
return H_PARAMETER; |
... | ... | |
365 | 369 |
target_ulong reg = args[0]; |
366 | 370 |
target_ulong buf = args[1]; |
367 | 371 |
VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); |
368 |
VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev;
|
|
372 |
VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
|
|
369 | 373 |
vlan_bd_t bd; |
370 | 374 |
|
371 | 375 |
dprintf("H_ADD_LOGICAL_LAN_BUFFER(0x" TARGET_FMT_lx |
... | ... | |
413 | 417 |
target_ulong *bufs = args + 1; |
414 | 418 |
target_ulong continue_token = args[7]; |
415 | 419 |
VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); |
416 |
VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev;
|
|
420 |
VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
|
|
417 | 421 |
unsigned total_len; |
418 | 422 |
uint8_t *lbuf, *p; |
419 | 423 |
int i, nbufs; |
... | ... | |
511 | 515 |
} |
512 | 516 |
|
513 | 517 |
static const TypeInfo spapr_vlan_info = { |
514 |
.name = "spapr-vlan",
|
|
518 |
.name = TYPE_VIO_SPAPR_VLAN_DEVICE,
|
|
515 | 519 |
.parent = TYPE_VIO_SPAPR_DEVICE, |
516 | 520 |
.instance_size = sizeof(VIOsPAPRVLANDevice), |
517 | 521 |
.class_init = spapr_vlan_class_init, |
Also available in: Unified diff