View | Details | Raw Unified | Return to bug 438610
Collapse All | Expand All

(-)linux-2.6.27.5-2.bak/drivers/net/bonding/bond_main.c (-5 / +11 lines)
Lines 1341-1358 static int bond_compute_features(struct Link Here
1341
	int i;
1341
	int i;
1342
1342
1343
	features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
1343
	features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
1344
	features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
1344
	features |=  NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
1345
		    NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
1345
1346
	if (!bond->first_slave)
1347
		goto done;
1348
1349
	features &= ~NETIF_F_ONE_FOR_ALL;
1346
1350
1347
	bond_for_each_slave(bond, slave, i) {
1351
	bond_for_each_slave(bond, slave, i) {
1348
		features = netdev_compute_features(features,
1352
		features = netdev_increment_features(features,
1349
						   slave->dev->features);
1353
						     slave->dev->features,
1354
						     NETIF_F_ONE_FOR_ALL);
1350
		if (slave->dev->hard_header_len > max_hard_header_len)
1355
		if (slave->dev->hard_header_len > max_hard_header_len)
1351
			max_hard_header_len = slave->dev->hard_header_len;
1356
			max_hard_header_len = slave->dev->hard_header_len;
1352
	}
1357
	}
1353
1358
1359
done:
1354
	features |= (bond_dev->features & BOND_VLAN_FEATURES);
1360
	features |= (bond_dev->features & BOND_VLAN_FEATURES);
1355
	bond_dev->features = features;
1361
	bond_dev->features = netdev_fix_features(features, NULL);
1356
	bond_dev->hard_header_len = max_hard_header_len;
1362
	bond_dev->hard_header_len = max_hard_header_len;
1357
1363
1358
	return 0;
1364
	return 0;
(-)linux-2.6.27.5-2.bak/include/linux/netdevice.h (-1 / +11 lines)
Lines 541-546 struct net_device Link Here
541
#define NETIF_F_V6_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
541
#define NETIF_F_V6_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
542
#define NETIF_F_ALL_CSUM	(NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
542
#define NETIF_F_ALL_CSUM	(NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
543
543
544
	/*
545
	 * If one device supports one of these features, then enable them
546
	 * for all in netdev_increment_features.
547
	 */
548
#define NETIF_F_ONE_FOR_ALL	(NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
549
				 NETIF_F_SG | NETIF_F_HIGHDMA | \
550
				 NETIF_F_FRAGLIST)
551
544
	/* Interface index. Unique device identifier	*/
552
	/* Interface index. Unique device identifier	*/
545
	int			ifindex;
553
	int			ifindex;
546
	int			iflink;
554
	int			iflink;
Lines 1679-1685 extern char *netdev_drivername(struct ne Link Here
1679
1687
1680
extern void linkwatch_run_queue(void);
1688
extern void linkwatch_run_queue(void);
1681
1689
1682
extern int netdev_compute_features(unsigned long all, unsigned long one);
1690
unsigned long netdev_increment_features(unsigned long all, unsigned long one,
1691
					unsigned long mask);
1692
unsigned long netdev_fix_features(unsigned long features, const char *name);
1683
1693
1684
static inline int net_gso_ok(int features, int gso_type)
1694
static inline int net_gso_ok(int features, int gso_type)
1685
{
1695
{
(-)linux-2.6.27.5-2.bak/net/bridge/br_device.c (-1 / +2 lines)
Lines 178-182 void br_dev_setup(struct net_device *dev Link Here
178
	dev->priv_flags = IFF_EBRIDGE;
178
	dev->priv_flags = IFF_EBRIDGE;
179
179
180
	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
180
	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
181
			NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX;
181
			NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
182
			NETIF_F_NETNS_LOCAL | NETIF_F_GSO;
182
}
183
}
(-)linux-2.6.27.5-2.bak/net/bridge/br_if.c (-4 / +10 lines)
Lines 355-369 int br_min_mtu(const struct net_bridge * Link Here
355
void br_features_recompute(struct net_bridge *br)
355
void br_features_recompute(struct net_bridge *br)
356
{
356
{
357
	struct net_bridge_port *p;
357
	struct net_bridge_port *p;
358
	unsigned long features;
358
	unsigned long features, mask;
359
359
360
	features = br->feature_mask;
360
	features = mask = br->feature_mask;
361
	if (list_empty(&br->port_list))
362
		goto done;
363
364
	features &= ~NETIF_F_ONE_FOR_ALL;
361
365
362
	list_for_each_entry(p, &br->port_list, list) {
366
	list_for_each_entry(p, &br->port_list, list) {
363
		features = netdev_compute_features(features, p->dev->features);
367
		features = netdev_increment_features(features,
368
						     p->dev->features, mask);
364
	}
369
	}
365
370
366
	br->dev->features = features;
371
done:
372
	br->dev->features = netdev_fix_features(features, NULL);
367
}
373
}
368
374
369
/* called with RTNL */
375
/* called with RTNL */
(-)linux-2.6.27.5-2.bak/net/core/dev.c (-58 / +71 lines)
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
{

Return to bug 438610