|
Lines 4019-4024
static void netdev_init_queue_locks(stru
Link Here
|
| 4019 |
__netdev_init_queue_locks_one(dev, &dev->rx_queue, NULL); |
4019 |
__netdev_init_queue_locks_one(dev, &dev->rx_queue, NULL); |
| 4020 |
} |
4020 |
} |
| 4021 |
|
4021 |
|
|
|
4022 |
unsigned long netdev_fix_features(unsigned long features, const char *name) |
| 4023 |
{ |
| 4024 |
/* Fix illegal SG+CSUM combinations. */ |
| 4025 |
if ((features & NETIF_F_SG) && |
| 4026 |
!(features & NETIF_F_ALL_CSUM)) { |
| 4027 |
if (name) |
| 4028 |
printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no " |
| 4029 |
"checksum feature.\n", name); |
| 4030 |
features &= ~NETIF_F_SG; |
| 4031 |
} |
| 4032 |
|
| 4033 |
/* TSO requires that SG is present as well. */ |
| 4034 |
if ((features & NETIF_F_TSO) && !(features & NETIF_F_SG)) { |
| 4035 |
if (name) |
| 4036 |
printk(KERN_NOTICE "%s: Dropping NETIF_F_TSO since no " |
| 4037 |
"SG feature.\n", name); |
| 4038 |
features &= ~NETIF_F_TSO; |
| 4039 |
} |
| 4040 |
|
| 4041 |
if (features & NETIF_F_UFO) { |
| 4042 |
if (!(features & NETIF_F_GEN_CSUM)) { |
| 4043 |
if (name) |
| 4044 |
printk(KERN_ERR "%s: Dropping NETIF_F_UFO " |
| 4045 |
"since no NETIF_F_HW_CSUM feature.\n", |
| 4046 |
name); |
| 4047 |
features &= ~NETIF_F_UFO; |
| 4048 |
} |
| 4049 |
|
| 4050 |
if (!(features & NETIF_F_SG)) { |
| 4051 |
if (name) |
| 4052 |
printk(KERN_ERR "%s: Dropping NETIF_F_UFO " |
| 4053 |
"since no NETIF_F_SG feature.\n", name); |
| 4054 |
features &= ~NETIF_F_UFO; |
| 4055 |
} |
| 4056 |
} |
| 4057 |
|
| 4058 |
return features; |
| 4059 |
} |
| 4060 |
EXPORT_SYMBOL(netdev_fix_features); |
| 4061 |
|
| 4022 |
/** |
4062 |
/** |
| 4023 |
* register_netdevice - register a network device |
4063 |
* register_netdevice - register a network device |
| 4024 |
* @dev: device to register |
4064 |
* @dev: device to register |
|
Lines 4104-4139
int register_netdevice(struct net_device
Link Here
|
| 4104 |
dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); |
4144 |
dev->features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); |
| 4105 |
} |
4145 |
} |
| 4106 |
|
4146 |
|
| 4107 |
|
4147 |
dev->features = netdev_fix_features(dev->features, dev->name); |
| 4108 |
/* Fix illegal SG+CSUM combinations. */ |
|
|
| 4109 |
if ((dev->features & NETIF_F_SG) && |
| 4110 |
!(dev->features & NETIF_F_ALL_CSUM)) { |
| 4111 |
printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no checksum feature.\n", |
| 4112 |
dev->name); |
| 4113 |
dev->features &= ~NETIF_F_SG; |
| 4114 |
} |
| 4115 |
|
| 4116 |
/* TSO requires that SG is present as well. */ |
| 4117 |
if ((dev->features & NETIF_F_TSO) && |
| 4118 |
!(dev->features & NETIF_F_SG)) { |
| 4119 |
printk(KERN_NOTICE "%s: Dropping NETIF_F_TSO since no SG feature.\n", |
| 4120 |
dev->name); |
| 4121 |
dev->features &= ~NETIF_F_TSO; |
| 4122 |
} |
| 4123 |
if (dev->features & NETIF_F_UFO) { |
| 4124 |
if (!(dev->features & NETIF_F_HW_CSUM)) { |
| 4125 |
printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no " |
| 4126 |
"NETIF_F_HW_CSUM feature.\n", |
| 4127 |
dev->name); |
| 4128 |
dev->features &= ~NETIF_F_UFO; |
| 4129 |
} |
| 4130 |
if (!(dev->features & NETIF_F_SG)) { |
| 4131 |
printk(KERN_ERR "%s: Dropping NETIF_F_UFO since no " |
| 4132 |
"NETIF_F_SG feature.\n", |
| 4133 |
dev->name); |
| 4134 |
dev->features &= ~NETIF_F_UFO; |
| 4135 |
} |
| 4136 |
} |
| 4137 |
|
4148 |
|
| 4138 |
/* Enable software GSO if SG is supported. */ |
4149 |
/* Enable software GSO if SG is supported. */ |
| 4139 |
if (dev->features & NETIF_F_SG) |
4150 |
if (dev->features & NETIF_F_SG) |
|
Lines 4767-4809
static int __init netdev_dma_register(vo
Link Here
|
| 4767 |
#endif /* CONFIG_NET_DMA */ |
4778 |
#endif /* CONFIG_NET_DMA */ |
| 4768 |
|
4779 |
|
| 4769 |
/** |
4780 |
/** |
| 4770 |
* netdev_compute_feature - compute conjunction of two feature sets |
4781 |
* netdev_increment_features - increment feature set by one |
| 4771 |
* @all: first feature set |
4782 |
* @all: current feature set |
| 4772 |
* @one: second feature set |
4783 |
* @one: new feature set |
|
|
4784 |
* @mask: mask feature set |
| 4773 |
* |
4785 |
* |
| 4774 |
* Computes a new feature set after adding a device with feature set |
4786 |
* Computes a new feature set after adding a device with feature set |
| 4775 |
* @one to the master device with current feature set @all. Returns |
4787 |
* @one to the master device with current feature set @all. Will not |
| 4776 |
* the new feature set. |
4788 |
* enable anything that is off in @mask. Returns the new feature set. |
| 4777 |
*/ |
4789 |
*/ |
| 4778 |
int netdev_compute_features(unsigned long all, unsigned long one) |
4790 |
unsigned long netdev_increment_features(unsigned long all, unsigned long one, |
| 4779 |
{ |
4791 |
unsigned long mask) |
| 4780 |
/* if device needs checksumming, downgrade to hw checksumming */ |
4792 |
{ |
| 4781 |
if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) |
4793 |
/* If device needs checksumming, downgrade to it. */ |
| 4782 |
all ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM; |
4794 |
if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) |
| 4783 |
|
4795 |
all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM); |
| 4784 |
/* if device can't do all checksum, downgrade to ipv4/ipv6 */ |
4796 |
else if (mask & NETIF_F_ALL_CSUM) { |
| 4785 |
if (all & NETIF_F_HW_CSUM && !(one & NETIF_F_HW_CSUM)) |
4797 |
/* If one device supports v4/v6 checksumming, set for all. */ |
| 4786 |
all ^= NETIF_F_HW_CSUM |
4798 |
if (one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM) && |
| 4787 |
| NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
4799 |
!(all & NETIF_F_GEN_CSUM)) { |
| 4788 |
|
4800 |
all &= ~NETIF_F_ALL_CSUM; |
| 4789 |
if (one & NETIF_F_GSO) |
4801 |
all |= one & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); |
| 4790 |
one |= NETIF_F_GSO_SOFTWARE; |
4802 |
} |
| 4791 |
one |= NETIF_F_GSO; |
|
|
| 4792 |
|
4803 |
|
| 4793 |
/* If even one device supports robust GSO, enable it for all. */ |
4804 |
/* If one device supports hw checksumming, set for all. */ |
| 4794 |
if (one & NETIF_F_GSO_ROBUST) |
4805 |
if (one & NETIF_F_GEN_CSUM && !(all & NETIF_F_GEN_CSUM)) { |
| 4795 |
all |= NETIF_F_GSO_ROBUST; |
4806 |
all &= ~NETIF_F_ALL_CSUM; |
|
|
4807 |
all |= NETIF_F_HW_CSUM; |
| 4808 |
} |
| 4809 |
} |
| 4796 |
|
4810 |
|
| 4797 |
all &= one | NETIF_F_LLTX; |
4811 |
one |= NETIF_F_ALL_CSUM; |
| 4798 |
|
4812 |
|
| 4799 |
if (!(all & NETIF_F_ALL_CSUM)) |
4813 |
one |= all & NETIF_F_ONE_FOR_ALL; |
| 4800 |
all &= ~NETIF_F_SG; |
4814 |
all &= one | NETIF_F_LLTX | NETIF_F_GSO; |
| 4801 |
if (!(all & NETIF_F_SG)) |
4815 |
all |= one & mask & NETIF_F_ONE_FOR_ALL; |
| 4802 |
all &= ~NETIF_F_GSO_MASK; |
|
|
| 4803 |
|
4816 |
|
| 4804 |
return all; |
4817 |
return all; |
| 4805 |
} |
4818 |
} |
| 4806 |
EXPORT_SYMBOL(netdev_compute_features); |
4819 |
EXPORT_SYMBOL(netdev_increment_features); |
| 4807 |
|
4820 |
|
| 4808 |
static struct hlist_head *netdev_create_hash(void) |
4821 |
static struct hlist_head *netdev_create_hash(void) |
| 4809 |
{ |
4822 |
{ |