Lines 194-203
Link Here
|
194 |
*---------------------------------------------------------------------- |
194 |
*---------------------------------------------------------------------- |
195 |
*/ |
195 |
*/ |
196 |
|
196 |
|
|
|
197 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) |
198 |
static const struct net_device_ops vnet_netdev_ops = { |
199 |
.ndo_init = VNetNetifProbe, |
200 |
.ndo_open = VNetNetifOpen, |
201 |
.ndo_start_xmit = VNetNetifStartXmit, |
202 |
.ndo_stop = VNetNetifClose, |
203 |
.ndo_get_stats = VNetNetifGetStats, |
204 |
.ndo_set_mac_address = VNetNetifSetMAC, |
205 |
.ndo_set_multicast_list = VNetNetifSetMulticast, |
206 |
}; |
207 |
#endif |
208 |
|
197 |
static void |
209 |
static void |
198 |
VNetNetIfSetup(struct net_device *dev) // IN: |
210 |
VNetNetIfSetup(struct net_device *dev) // IN: |
199 |
{ |
211 |
{ |
200 |
ether_setup(dev); // turns on IFF_BROADCAST, IFF_MULTICAST |
212 |
ether_setup(dev); // turns on IFF_BROADCAST, IFF_MULTICAST |
|
|
213 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) |
214 |
dev->netdev_ops = &vnet_netdev_ops; |
215 |
#else |
201 |
dev->init = VNetNetifProbe; |
216 |
dev->init = VNetNetifProbe; |
202 |
dev->open = VNetNetifOpen; |
217 |
dev->open = VNetNetifOpen; |
203 |
dev->hard_start_xmit = VNetNetifStartXmit; |
218 |
dev->hard_start_xmit = VNetNetifStartXmit; |
Lines 205-210
Link Here
|
205 |
dev->get_stats = VNetNetifGetStats; |
220 |
dev->get_stats = VNetNetifGetStats; |
206 |
dev->set_mac_address = VNetNetifSetMAC; |
221 |
dev->set_mac_address = VNetNetifSetMAC; |
207 |
dev->set_multicast_list = VNetNetifSetMulticast; |
222 |
dev->set_multicast_list = VNetNetifSetMulticast; |
|
|
223 |
#endif |
208 |
#ifdef KERNEL_2_3_43 |
224 |
#ifdef KERNEL_2_3_43 |
209 |
/* |
225 |
/* |
210 |
* We cannot stuck... If someone will report problems under |
226 |
* We cannot stuck... If someone will report problems under |
Lines 324-330
Link Here
|
324 |
goto out; |
340 |
goto out; |
325 |
} |
341 |
} |
326 |
|
342 |
|
|
|
343 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) |
327 |
dev->priv = netIf; |
344 |
dev->priv = netIf; |
|
|
345 |
#else |
346 |
dev->ml_priv = netIf; |
347 |
#endif |
328 |
netIf->dev = dev; |
348 |
netIf->dev = dev; |
329 |
|
349 |
|
330 |
memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr); |
350 |
memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr); |
Lines 566-572
Link Here
|
566 |
VNetNetifStartXmit(struct sk_buff *skb, // IN: |
586 |
VNetNetifStartXmit(struct sk_buff *skb, // IN: |
567 |
struct net_device *dev) // IN: |
587 |
struct net_device *dev) // IN: |
568 |
{ |
588 |
{ |
|
|
589 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) |
569 |
VNetNetIF *netIf = (VNetNetIF*)dev->priv; |
590 |
VNetNetIF *netIf = (VNetNetIF*)dev->priv; |
|
|
591 |
#else |
592 |
VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv; |
593 |
#endif |
570 |
|
594 |
|
571 |
if(skb == NULL) { |
595 |
if(skb == NULL) { |
572 |
return 0; |
596 |
return 0; |
Lines 618-624
Link Here
|
618 |
VNetNetifSetMAC(struct net_device *dev, // IN: |
642 |
VNetNetifSetMAC(struct net_device *dev, // IN: |
619 |
void *p) // IN: |
643 |
void *p) // IN: |
620 |
{ |
644 |
{ |
|
|
645 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) |
621 |
VNetNetIF *netIf = (VNetNetIF*)dev->priv; |
646 |
VNetNetIF *netIf = (VNetNetIF*)dev->priv; |
|
|
647 |
#else |
648 |
VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv; |
649 |
#endif |
622 |
struct sockaddr const *addr = p; |
650 |
struct sockaddr const *addr = p; |
623 |
if (!VMX86_IS_STATIC_MAC(addr->sa_data)) { |
651 |
if (!VMX86_IS_STATIC_MAC(addr->sa_data)) { |
624 |
return -EINVAL; |
652 |
return -EINVAL; |
Lines 675-681
Link Here
|
675 |
struct net_device_stats * |
703 |
struct net_device_stats * |
676 |
VNetNetifGetStats(struct net_device *dev) // IN: |
704 |
VNetNetifGetStats(struct net_device *dev) // IN: |
677 |
{ |
705 |
{ |
|
|
706 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) |
678 |
VNetNetIF *netIf = (VNetNetIF*)dev->priv; |
707 |
VNetNetIF *netIf = (VNetNetIF*)dev->priv; |
|
|
708 |
#else |
709 |
VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv; |
710 |
#endif |
679 |
return &(netIf->stats); |
711 |
return &(netIf->stats); |
680 |
} |
712 |
} |
681 |
|
713 |
|