diff options
author | David S. Miller <davem@davemloft.net> | 2009-05-03 17:07:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-03 17:07:43 -0400 |
commit | d252a5e7b73026b3ba3c49940724292099e634f0 (patch) | |
tree | c151797f0daecf457ef7a4bad027ecfdd8d79ad6 | |
parent | f0a3a1538d57dfb51c73d012cbb72f985cd419aa (diff) | |
parent | 1824a9897473fda5e5e42f991ddc674c175e3a09 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
-rw-r--r-- | drivers/net/bonding/bond_main.c | 36 | ||||
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 2 | ||||
-rw-r--r-- | drivers/net/netconsole.c | 11 | ||||
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 15 | ||||
-rw-r--r-- | drivers/net/usb/smsc95xx.h | 3 | ||||
-rw-r--r-- | drivers/net/virtio_net.c | 24 | ||||
-rw-r--r-- | include/linux/netfilter/x_tables.h | 4 | ||||
-rw-r--r-- | include/linux/virtio_net.h | 1 | ||||
-rw-r--r-- | net/core/dev.c | 9 | ||||
-rw-r--r-- | net/core/skbuff.c | 27 | ||||
-rw-r--r-- | net/netfilter/Kconfig | 1 |
11 files changed, 79 insertions, 54 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index fd738367d740..e3af662b0559 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2211,33 +2211,24 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in | |||
2211 | { | 2211 | { |
2212 | struct bonding *bond = netdev_priv(bond_dev); | 2212 | struct bonding *bond = netdev_priv(bond_dev); |
2213 | struct slave *slave; | 2213 | struct slave *slave; |
2214 | int i, found = 0; | 2214 | int i, res = -ENODEV; |
2215 | |||
2216 | if (info->slave_id < 0) { | ||
2217 | return -ENODEV; | ||
2218 | } | ||
2219 | 2215 | ||
2220 | read_lock(&bond->lock); | 2216 | read_lock(&bond->lock); |
2221 | 2217 | ||
2222 | bond_for_each_slave(bond, slave, i) { | 2218 | bond_for_each_slave(bond, slave, i) { |
2223 | if (i == (int)info->slave_id) { | 2219 | if (i == (int)info->slave_id) { |
2224 | found = 1; | 2220 | res = 0; |
2221 | strcpy(info->slave_name, slave->dev->name); | ||
2222 | info->link = slave->link; | ||
2223 | info->state = slave->state; | ||
2224 | info->link_failure_count = slave->link_failure_count; | ||
2225 | break; | 2225 | break; |
2226 | } | 2226 | } |
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | read_unlock(&bond->lock); | 2229 | read_unlock(&bond->lock); |
2230 | 2230 | ||
2231 | if (found) { | 2231 | return res; |
2232 | strcpy(info->slave_name, slave->dev->name); | ||
2233 | info->link = slave->link; | ||
2234 | info->state = slave->state; | ||
2235 | info->link_failure_count = slave->link_failure_count; | ||
2236 | } else { | ||
2237 | return -ENODEV; | ||
2238 | } | ||
2239 | |||
2240 | return 0; | ||
2241 | } | 2232 | } |
2242 | 2233 | ||
2243 | /*-------------------------------- Monitoring -------------------------------*/ | 2234 | /*-------------------------------- Monitoring -------------------------------*/ |
@@ -5173,16 +5164,15 @@ int bond_create(char *name, struct bond_params *params) | |||
5173 | up_write(&bonding_rwsem); | 5164 | up_write(&bonding_rwsem); |
5174 | rtnl_unlock(); /* allows sysfs registration of net device */ | 5165 | rtnl_unlock(); /* allows sysfs registration of net device */ |
5175 | res = bond_create_sysfs_entry(netdev_priv(bond_dev)); | 5166 | res = bond_create_sysfs_entry(netdev_priv(bond_dev)); |
5176 | if (res < 0) { | 5167 | if (res < 0) |
5177 | rtnl_lock(); | 5168 | goto out_unreg; |
5178 | down_write(&bonding_rwsem); | ||
5179 | bond_deinit(bond_dev); | ||
5180 | unregister_netdevice(bond_dev); | ||
5181 | goto out_rtnl; | ||
5182 | } | ||
5183 | 5169 | ||
5184 | return 0; | 5170 | return 0; |
5185 | 5171 | ||
5172 | out_unreg: | ||
5173 | rtnl_lock(); | ||
5174 | down_write(&bonding_rwsem); | ||
5175 | unregister_netdevice(bond_dev); | ||
5186 | out_bond: | 5176 | out_bond: |
5187 | bond_deinit(bond_dev); | 5177 | bond_deinit(bond_dev); |
5188 | out_netdev: | 5178 | out_netdev: |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 1dd1637663a3..c8a865a7e26c 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -3784,7 +3784,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, | |||
3784 | 3784 | ||
3785 | adapter->params.info = ai; | 3785 | adapter->params.info = ai; |
3786 | adapter->params.nports = ai->nports0 + ai->nports1; | 3786 | adapter->params.nports = ai->nports0 + ai->nports1; |
3787 | adapter->params.chan_map = !!ai->nports0 | (!!ai->nports1 << 1); | 3787 | adapter->params.chan_map = (!!ai->nports0) | (!!ai->nports1 << 1); |
3788 | adapter->params.rev = t3_read_reg(adapter, A_PL_REV); | 3788 | adapter->params.rev = t3_read_reg(adapter, A_PL_REV); |
3789 | /* | 3789 | /* |
3790 | * We used to only run the "adapter check task" once a second if | 3790 | * We used to only run the "adapter check task" once a second if |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index eceadf787a67..bf4af5248cb7 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
664 | struct netconsole_target *nt; | 664 | struct netconsole_target *nt; |
665 | struct net_device *dev = ptr; | 665 | struct net_device *dev = ptr; |
666 | 666 | ||
667 | if (!(event == NETDEV_CHANGENAME)) | 667 | if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER)) |
668 | goto done; | 668 | goto done; |
669 | 669 | ||
670 | spin_lock_irqsave(&target_list_lock, flags); | 670 | spin_lock_irqsave(&target_list_lock, flags); |
@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
675 | case NETDEV_CHANGENAME: | 675 | case NETDEV_CHANGENAME: |
676 | strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); | 676 | strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); |
677 | break; | 677 | break; |
678 | case NETDEV_UNREGISTER: | ||
679 | if (!nt->enabled) | ||
680 | break; | ||
681 | netpoll_cleanup(&nt->np); | ||
682 | nt->enabled = 0; | ||
683 | printk(KERN_INFO "netconsole: network logging stopped" | ||
684 | ", interface %s unregistered\n", | ||
685 | dev->name); | ||
686 | break; | ||
678 | } | 687 | } |
679 | } | 688 | } |
680 | netconsole_target_put(nt); | 689 | netconsole_target_put(nt); |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index dc1665326592..5a7283372b53 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -941,6 +941,16 @@ static int smsc95xx_reset(struct usbnet *dev) | |||
941 | if (netif_msg_ifup(dev)) | 941 | if (netif_msg_ifup(dev)) |
942 | devdbg(dev, "ID_REV = 0x%08x", read_buf); | 942 | devdbg(dev, "ID_REV = 0x%08x", read_buf); |
943 | 943 | ||
944 | /* Configure GPIO pins as LED outputs */ | ||
945 | write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | | ||
946 | LED_GPIO_CFG_FDX_LED; | ||
947 | ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf); | ||
948 | if (ret < 0) { | ||
949 | devwarn(dev, "Failed to write LED_GPIO_CFG register, ret=%d", | ||
950 | ret); | ||
951 | return ret; | ||
952 | } | ||
953 | |||
944 | /* Init Tx */ | 954 | /* Init Tx */ |
945 | write_buf = 0; | 955 | write_buf = 0; |
946 | ret = smsc95xx_write_reg(dev, FLOW, write_buf); | 956 | ret = smsc95xx_write_reg(dev, FLOW, write_buf); |
@@ -1231,6 +1241,11 @@ static const struct usb_device_id products[] = { | |||
1231 | USB_DEVICE(0x0424, 0x9500), | 1241 | USB_DEVICE(0x0424, 0x9500), |
1232 | .driver_info = (unsigned long) &smsc95xx_info, | 1242 | .driver_info = (unsigned long) &smsc95xx_info, |
1233 | }, | 1243 | }, |
1244 | { | ||
1245 | /* SMSC9512/9514 USB Hub & Ethernet Device */ | ||
1246 | USB_DEVICE(0x0424, 0xec00), | ||
1247 | .driver_info = (unsigned long) &smsc95xx_info, | ||
1248 | }, | ||
1234 | { }, /* END */ | 1249 | { }, /* END */ |
1235 | }; | 1250 | }; |
1236 | MODULE_DEVICE_TABLE(usb, products); | 1251 | MODULE_DEVICE_TABLE(usb, products); |
diff --git a/drivers/net/usb/smsc95xx.h b/drivers/net/usb/smsc95xx.h index 66b5c84f302e..86bc44977fbd 100644 --- a/drivers/net/usb/smsc95xx.h +++ b/drivers/net/usb/smsc95xx.h | |||
@@ -99,6 +99,9 @@ | |||
99 | #define PM_CTL_WUPS_MULTI_ (0x00000003) | 99 | #define PM_CTL_WUPS_MULTI_ (0x00000003) |
100 | 100 | ||
101 | #define LED_GPIO_CFG (0x24) | 101 | #define LED_GPIO_CFG (0x24) |
102 | #define LED_GPIO_CFG_SPD_LED (0x01000000) | ||
103 | #define LED_GPIO_CFG_LNK_LED (0x00100000) | ||
104 | #define LED_GPIO_CFG_FDX_LED (0x00010000) | ||
102 | 105 | ||
103 | #define GPIO_CFG (0x28) | 106 | #define GPIO_CFG (0x28) |
104 | 107 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 071855871524..6cc5bcd34fb0 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -616,10 +616,11 @@ static int virtnet_open(struct net_device *dev) | |||
616 | static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, | 616 | static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, |
617 | struct scatterlist *data, int out, int in) | 617 | struct scatterlist *data, int out, int in) |
618 | { | 618 | { |
619 | struct scatterlist sg[VIRTNET_SEND_COMMAND_SG_MAX + 2]; | 619 | struct scatterlist *s, sg[VIRTNET_SEND_COMMAND_SG_MAX + 2]; |
620 | struct virtio_net_ctrl_hdr ctrl; | 620 | struct virtio_net_ctrl_hdr ctrl; |
621 | virtio_net_ctrl_ack status = ~0; | 621 | virtio_net_ctrl_ack status = ~0; |
622 | unsigned int tmp; | 622 | unsigned int tmp; |
623 | int i; | ||
623 | 624 | ||
624 | /* Caller should know better */ | 625 | /* Caller should know better */ |
625 | BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) || | 626 | BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) || |
@@ -634,7 +635,8 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, | |||
634 | sg_init_table(sg, out + in); | 635 | sg_init_table(sg, out + in); |
635 | 636 | ||
636 | sg_set_buf(&sg[0], &ctrl, sizeof(ctrl)); | 637 | sg_set_buf(&sg[0], &ctrl, sizeof(ctrl)); |
637 | memcpy(&sg[1], data, sizeof(struct scatterlist) * (out + in - 2)); | 638 | for_each_sg(data, s, out + in - 2, i) |
639 | sg_set_buf(&sg[i + 1], sg_virt(s), s->length); | ||
638 | sg_set_buf(&sg[out + in - 1], &status, sizeof(status)); | 640 | sg_set_buf(&sg[out + in - 1], &status, sizeof(status)); |
639 | 641 | ||
640 | BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi)); | 642 | BUG_ON(vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi)); |
@@ -688,7 +690,7 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
688 | promisc = ((dev->flags & IFF_PROMISC) != 0); | 690 | promisc = ((dev->flags & IFF_PROMISC) != 0); |
689 | allmulti = ((dev->flags & IFF_ALLMULTI) != 0); | 691 | allmulti = ((dev->flags & IFF_ALLMULTI) != 0); |
690 | 692 | ||
691 | sg_set_buf(sg, &promisc, sizeof(promisc)); | 693 | sg_init_one(sg, &promisc, sizeof(promisc)); |
692 | 694 | ||
693 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, | 695 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, |
694 | VIRTIO_NET_CTRL_RX_PROMISC, | 696 | VIRTIO_NET_CTRL_RX_PROMISC, |
@@ -696,7 +698,7 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
696 | dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", | 698 | dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", |
697 | promisc ? "en" : "dis"); | 699 | promisc ? "en" : "dis"); |
698 | 700 | ||
699 | sg_set_buf(sg, &allmulti, sizeof(allmulti)); | 701 | sg_init_one(sg, &allmulti, sizeof(allmulti)); |
700 | 702 | ||
701 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, | 703 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, |
702 | VIRTIO_NET_CTRL_RX_ALLMULTI, | 704 | VIRTIO_NET_CTRL_RX_ALLMULTI, |
@@ -712,6 +714,8 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
712 | return; | 714 | return; |
713 | } | 715 | } |
714 | 716 | ||
717 | sg_init_table(sg, 2); | ||
718 | |||
715 | /* Store the unicast list and count in the front of the buffer */ | 719 | /* Store the unicast list and count in the front of the buffer */ |
716 | mac_data->entries = dev->uc_count; | 720 | mac_data->entries = dev->uc_count; |
717 | addr = dev->uc_list; | 721 | addr = dev->uc_list; |
@@ -740,24 +744,24 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
740 | kfree(buf); | 744 | kfree(buf); |
741 | } | 745 | } |
742 | 746 | ||
743 | static void virnet_vlan_rx_add_vid(struct net_device *dev, u16 vid) | 747 | static void virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid) |
744 | { | 748 | { |
745 | struct virtnet_info *vi = netdev_priv(dev); | 749 | struct virtnet_info *vi = netdev_priv(dev); |
746 | struct scatterlist sg; | 750 | struct scatterlist sg; |
747 | 751 | ||
748 | sg_set_buf(&sg, &vid, sizeof(vid)); | 752 | sg_init_one(&sg, &vid, sizeof(vid)); |
749 | 753 | ||
750 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | 754 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |
751 | VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0)) | 755 | VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0)) |
752 | dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid); | 756 | dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid); |
753 | } | 757 | } |
754 | 758 | ||
755 | static void virnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) | 759 | static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) |
756 | { | 760 | { |
757 | struct virtnet_info *vi = netdev_priv(dev); | 761 | struct virtnet_info *vi = netdev_priv(dev); |
758 | struct scatterlist sg; | 762 | struct scatterlist sg; |
759 | 763 | ||
760 | sg_set_buf(&sg, &vid, sizeof(vid)); | 764 | sg_init_one(&sg, &vid, sizeof(vid)); |
761 | 765 | ||
762 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | 766 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |
763 | VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0)) | 767 | VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0)) |
@@ -790,8 +794,8 @@ static const struct net_device_ops virtnet_netdev = { | |||
790 | .ndo_set_mac_address = virtnet_set_mac_address, | 794 | .ndo_set_mac_address = virtnet_set_mac_address, |
791 | .ndo_set_rx_mode = virtnet_set_rx_mode, | 795 | .ndo_set_rx_mode = virtnet_set_rx_mode, |
792 | .ndo_change_mtu = virtnet_change_mtu, | 796 | .ndo_change_mtu = virtnet_change_mtu, |
793 | .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid, | 797 | .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid, |
794 | .ndo_vlan_rx_kill_vid = virnet_vlan_rx_kill_vid, | 798 | .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid, |
795 | #ifdef CONFIG_NET_POLL_CONTROLLER | 799 | #ifdef CONFIG_NET_POLL_CONTROLLER |
796 | .ndo_poll_controller = virtnet_netpoll, | 800 | .ndo_poll_controller = virtnet_netpoll, |
797 | #endif | 801 | #endif |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 1b2e43502ef7..c9efe039dc57 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -472,7 +472,7 @@ static inline void xt_info_rdlock_bh(void) | |||
472 | 472 | ||
473 | local_bh_disable(); | 473 | local_bh_disable(); |
474 | lock = &__get_cpu_var(xt_info_locks); | 474 | lock = &__get_cpu_var(xt_info_locks); |
475 | if (!lock->readers++) | 475 | if (likely(!lock->readers++)) |
476 | spin_lock(&lock->lock); | 476 | spin_lock(&lock->lock); |
477 | } | 477 | } |
478 | 478 | ||
@@ -480,7 +480,7 @@ static inline void xt_info_rdunlock_bh(void) | |||
480 | { | 480 | { |
481 | struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks); | 481 | struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks); |
482 | 482 | ||
483 | if (!--lock->readers) | 483 | if (likely(!--lock->readers)) |
484 | spin_unlock(&lock->lock); | 484 | spin_unlock(&lock->lock); |
485 | local_bh_enable(); | 485 | local_bh_enable(); |
486 | } | 486 | } |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 242348bb3766..cec79adbe3ea 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
@@ -4,6 +4,7 @@ | |||
4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/virtio_config.h> | 6 | #include <linux/virtio_config.h> |
7 | #include <linux/if_ether.h> | ||
7 | 8 | ||
8 | /* The ID for virtio_net */ | 9 | /* The ID for virtio_net */ |
9 | #define VIRTIO_ID_NET 1 | 10 | #define VIRTIO_ID_NET 1 |
diff --git a/net/core/dev.c b/net/core/dev.c index 6785b067ad50..81442957c5c2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1735,11 +1735,12 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) | |||
1735 | { | 1735 | { |
1736 | u32 hash; | 1736 | u32 hash; |
1737 | 1737 | ||
1738 | if (skb_rx_queue_recorded(skb)) { | 1738 | if (skb_rx_queue_recorded(skb)) |
1739 | hash = skb_get_rx_queue(skb); | 1739 | return skb_get_rx_queue(skb) % dev->real_num_tx_queues; |
1740 | } else if (skb->sk && skb->sk->sk_hash) { | 1740 | |
1741 | if (skb->sk && skb->sk->sk_hash) | ||
1741 | hash = skb->sk->sk_hash; | 1742 | hash = skb->sk->sk_hash; |
1742 | } else | 1743 | else |
1743 | hash = skb->protocol; | 1744 | hash = skb->protocol; |
1744 | 1745 | ||
1745 | hash = jhash_1word(hash, skb_tx_hashrnd); | 1746 | hash = jhash_1word(hash, skb_tx_hashrnd); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ce6356cd9f71..f091a5a845c1 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1365,9 +1365,8 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i) | |||
1365 | 1365 | ||
1366 | static inline struct page *linear_to_page(struct page *page, unsigned int *len, | 1366 | static inline struct page *linear_to_page(struct page *page, unsigned int *len, |
1367 | unsigned int *offset, | 1367 | unsigned int *offset, |
1368 | struct sk_buff *skb) | 1368 | struct sk_buff *skb, struct sock *sk) |
1369 | { | 1369 | { |
1370 | struct sock *sk = skb->sk; | ||
1371 | struct page *p = sk->sk_sndmsg_page; | 1370 | struct page *p = sk->sk_sndmsg_page; |
1372 | unsigned int off; | 1371 | unsigned int off; |
1373 | 1372 | ||
@@ -1405,13 +1404,14 @@ new_page: | |||
1405 | */ | 1404 | */ |
1406 | static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page, | 1405 | static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page, |
1407 | unsigned int *len, unsigned int offset, | 1406 | unsigned int *len, unsigned int offset, |
1408 | struct sk_buff *skb, int linear) | 1407 | struct sk_buff *skb, int linear, |
1408 | struct sock *sk) | ||
1409 | { | 1409 | { |
1410 | if (unlikely(spd->nr_pages == PIPE_BUFFERS)) | 1410 | if (unlikely(spd->nr_pages == PIPE_BUFFERS)) |
1411 | return 1; | 1411 | return 1; |
1412 | 1412 | ||
1413 | if (linear) { | 1413 | if (linear) { |
1414 | page = linear_to_page(page, len, &offset, skb); | 1414 | page = linear_to_page(page, len, &offset, skb, sk); |
1415 | if (!page) | 1415 | if (!page) |
1416 | return 1; | 1416 | return 1; |
1417 | } else | 1417 | } else |
@@ -1442,7 +1442,8 @@ static inline void __segment_seek(struct page **page, unsigned int *poff, | |||
1442 | static inline int __splice_segment(struct page *page, unsigned int poff, | 1442 | static inline int __splice_segment(struct page *page, unsigned int poff, |
1443 | unsigned int plen, unsigned int *off, | 1443 | unsigned int plen, unsigned int *off, |
1444 | unsigned int *len, struct sk_buff *skb, | 1444 | unsigned int *len, struct sk_buff *skb, |
1445 | struct splice_pipe_desc *spd, int linear) | 1445 | struct splice_pipe_desc *spd, int linear, |
1446 | struct sock *sk) | ||
1446 | { | 1447 | { |
1447 | if (!*len) | 1448 | if (!*len) |
1448 | return 1; | 1449 | return 1; |
@@ -1465,7 +1466,7 @@ static inline int __splice_segment(struct page *page, unsigned int poff, | |||
1465 | /* the linear region may spread across several pages */ | 1466 | /* the linear region may spread across several pages */ |
1466 | flen = min_t(unsigned int, flen, PAGE_SIZE - poff); | 1467 | flen = min_t(unsigned int, flen, PAGE_SIZE - poff); |
1467 | 1468 | ||
1468 | if (spd_fill_page(spd, page, &flen, poff, skb, linear)) | 1469 | if (spd_fill_page(spd, page, &flen, poff, skb, linear, sk)) |
1469 | return 1; | 1470 | return 1; |
1470 | 1471 | ||
1471 | __segment_seek(&page, &poff, &plen, flen); | 1472 | __segment_seek(&page, &poff, &plen, flen); |
@@ -1481,8 +1482,8 @@ static inline int __splice_segment(struct page *page, unsigned int poff, | |||
1481 | * pipe is full or if we already spliced the requested length. | 1482 | * pipe is full or if we already spliced the requested length. |
1482 | */ | 1483 | */ |
1483 | static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | 1484 | static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, |
1484 | unsigned int *len, | 1485 | unsigned int *len, struct splice_pipe_desc *spd, |
1485 | struct splice_pipe_desc *spd) | 1486 | struct sock *sk) |
1486 | { | 1487 | { |
1487 | int seg; | 1488 | int seg; |
1488 | 1489 | ||
@@ -1492,7 +1493,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | |||
1492 | if (__splice_segment(virt_to_page(skb->data), | 1493 | if (__splice_segment(virt_to_page(skb->data), |
1493 | (unsigned long) skb->data & (PAGE_SIZE - 1), | 1494 | (unsigned long) skb->data & (PAGE_SIZE - 1), |
1494 | skb_headlen(skb), | 1495 | skb_headlen(skb), |
1495 | offset, len, skb, spd, 1)) | 1496 | offset, len, skb, spd, 1, sk)) |
1496 | return 1; | 1497 | return 1; |
1497 | 1498 | ||
1498 | /* | 1499 | /* |
@@ -1502,7 +1503,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | |||
1502 | const skb_frag_t *f = &skb_shinfo(skb)->frags[seg]; | 1503 | const skb_frag_t *f = &skb_shinfo(skb)->frags[seg]; |
1503 | 1504 | ||
1504 | if (__splice_segment(f->page, f->page_offset, f->size, | 1505 | if (__splice_segment(f->page, f->page_offset, f->size, |
1505 | offset, len, skb, spd, 0)) | 1506 | offset, len, skb, spd, 0, sk)) |
1506 | return 1; | 1507 | return 1; |
1507 | } | 1508 | } |
1508 | 1509 | ||
@@ -1528,12 +1529,13 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset, | |||
1528 | .ops = &sock_pipe_buf_ops, | 1529 | .ops = &sock_pipe_buf_ops, |
1529 | .spd_release = sock_spd_release, | 1530 | .spd_release = sock_spd_release, |
1530 | }; | 1531 | }; |
1532 | struct sock *sk = skb->sk; | ||
1531 | 1533 | ||
1532 | /* | 1534 | /* |
1533 | * __skb_splice_bits() only fails if the output has no room left, | 1535 | * __skb_splice_bits() only fails if the output has no room left, |
1534 | * so no point in going over the frag_list for the error case. | 1536 | * so no point in going over the frag_list for the error case. |
1535 | */ | 1537 | */ |
1536 | if (__skb_splice_bits(skb, &offset, &tlen, &spd)) | 1538 | if (__skb_splice_bits(skb, &offset, &tlen, &spd, sk)) |
1537 | goto done; | 1539 | goto done; |
1538 | else if (!tlen) | 1540 | else if (!tlen) |
1539 | goto done; | 1541 | goto done; |
@@ -1545,14 +1547,13 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset, | |||
1545 | struct sk_buff *list = skb_shinfo(skb)->frag_list; | 1547 | struct sk_buff *list = skb_shinfo(skb)->frag_list; |
1546 | 1548 | ||
1547 | for (; list && tlen; list = list->next) { | 1549 | for (; list && tlen; list = list->next) { |
1548 | if (__skb_splice_bits(list, &offset, &tlen, &spd)) | 1550 | if (__skb_splice_bits(list, &offset, &tlen, &spd, sk)) |
1549 | break; | 1551 | break; |
1550 | } | 1552 | } |
1551 | } | 1553 | } |
1552 | 1554 | ||
1553 | done: | 1555 | done: |
1554 | if (spd.nr_pages) { | 1556 | if (spd.nr_pages) { |
1555 | struct sock *sk = skb->sk; | ||
1556 | int ret; | 1557 | int ret; |
1557 | 1558 | ||
1558 | /* | 1559 | /* |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 881203c4a142..cb3ad741ebf8 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -837,6 +837,7 @@ config NETFILTER_XT_MATCH_SOCKET | |||
837 | depends on NETFILTER_TPROXY | 837 | depends on NETFILTER_TPROXY |
838 | depends on NETFILTER_XTABLES | 838 | depends on NETFILTER_XTABLES |
839 | depends on NETFILTER_ADVANCED | 839 | depends on NETFILTER_ADVANCED |
840 | depends on !NF_CONNTRACK || NF_CONNTRACK | ||
840 | select NF_DEFRAG_IPV4 | 841 | select NF_DEFRAG_IPV4 |
841 | help | 842 | help |
842 | This option adds a `socket' match, which can be used to match | 843 | This option adds a `socket' match, which can be used to match |