diff options
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 6a6141482979..c938114a34ab 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3866,9 +3866,8 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3866 | * of reassembly being done in the stack */ | 3866 | * of reassembly being done in the stack */ |
3867 | if (length < copybreak) { | 3867 | if (length < copybreak) { |
3868 | struct sk_buff *new_skb = | 3868 | struct sk_buff *new_skb = |
3869 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); | 3869 | netdev_alloc_skb_ip_align(netdev, length); |
3870 | if (new_skb) { | 3870 | if (new_skb) { |
3871 | skb_reserve(new_skb, NET_IP_ALIGN); | ||
3872 | skb_copy_to_linear_data_offset(new_skb, | 3871 | skb_copy_to_linear_data_offset(new_skb, |
3873 | -NET_IP_ALIGN, | 3872 | -NET_IP_ALIGN, |
3874 | (skb->data - | 3873 | (skb->data - |
@@ -3937,9 +3936,7 @@ e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | |||
3937 | struct e1000_buffer *buffer_info; | 3936 | struct e1000_buffer *buffer_info; |
3938 | struct sk_buff *skb; | 3937 | struct sk_buff *skb; |
3939 | unsigned int i; | 3938 | unsigned int i; |
3940 | unsigned int bufsz = 256 - | 3939 | unsigned int bufsz = 256 - 16 /*for skb_reserve */ ; |
3941 | 16 /*for skb_reserve */ - | ||
3942 | NET_IP_ALIGN; | ||
3943 | 3940 | ||
3944 | i = rx_ring->next_to_use; | 3941 | i = rx_ring->next_to_use; |
3945 | buffer_info = &rx_ring->buffer_info[i]; | 3942 | buffer_info = &rx_ring->buffer_info[i]; |
@@ -3951,7 +3948,7 @@ e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | |||
3951 | goto check_page; | 3948 | goto check_page; |
3952 | } | 3949 | } |
3953 | 3950 | ||
3954 | skb = netdev_alloc_skb(netdev, bufsz); | 3951 | skb = netdev_alloc_skb_ip_align(netdev, bufsz); |
3955 | if (unlikely(!skb)) { | 3952 | if (unlikely(!skb)) { |
3956 | /* Better luck next round */ | 3953 | /* Better luck next round */ |
3957 | adapter->alloc_rx_buff_failed++; | 3954 | adapter->alloc_rx_buff_failed++; |
@@ -3964,7 +3961,7 @@ e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | |||
3964 | DPRINTK(PROBE, ERR, "skb align check failed: %u bytes " | 3961 | DPRINTK(PROBE, ERR, "skb align check failed: %u bytes " |
3965 | "at %p\n", bufsz, skb->data); | 3962 | "at %p\n", bufsz, skb->data); |
3966 | /* Try again, without freeing the previous */ | 3963 | /* Try again, without freeing the previous */ |
3967 | skb = netdev_alloc_skb(netdev, bufsz); | 3964 | skb = netdev_alloc_skb_ip_align(netdev, bufsz); |
3968 | /* Failed allocation, critical failure */ | 3965 | /* Failed allocation, critical failure */ |
3969 | if (!skb) { | 3966 | if (!skb) { |
3970 | dev_kfree_skb(oldskb); | 3967 | dev_kfree_skb(oldskb); |
@@ -3982,12 +3979,6 @@ e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | |||
3982 | /* Use new allocation */ | 3979 | /* Use new allocation */ |
3983 | dev_kfree_skb(oldskb); | 3980 | dev_kfree_skb(oldskb); |
3984 | } | 3981 | } |
3985 | /* Make buffer alignment 2 beyond a 16 byte boundary | ||
3986 | * this will result in a 16 byte aligned IP header after | ||
3987 | * the 14 byte MAC header is removed | ||
3988 | */ | ||
3989 | skb_reserve(skb, NET_IP_ALIGN); | ||
3990 | |||
3991 | buffer_info->skb = skb; | 3982 | buffer_info->skb = skb; |
3992 | buffer_info->length = adapter->rx_buffer_len; | 3983 | buffer_info->length = adapter->rx_buffer_len; |
3993 | check_page: | 3984 | check_page: |
@@ -4044,7 +4035,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
4044 | struct e1000_buffer *buffer_info; | 4035 | struct e1000_buffer *buffer_info; |
4045 | struct sk_buff *skb; | 4036 | struct sk_buff *skb; |
4046 | unsigned int i; | 4037 | unsigned int i; |
4047 | unsigned int bufsz = adapter->rx_buffer_len + NET_IP_ALIGN; | 4038 | unsigned int bufsz = adapter->rx_buffer_len; |
4048 | 4039 | ||
4049 | i = rx_ring->next_to_use; | 4040 | i = rx_ring->next_to_use; |
4050 | buffer_info = &rx_ring->buffer_info[i]; | 4041 | buffer_info = &rx_ring->buffer_info[i]; |
@@ -4056,7 +4047,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
4056 | goto map_skb; | 4047 | goto map_skb; |
4057 | } | 4048 | } |
4058 | 4049 | ||
4059 | skb = netdev_alloc_skb(netdev, bufsz); | 4050 | skb = netdev_alloc_skb_ip_align(netdev, bufsz); |
4060 | if (unlikely(!skb)) { | 4051 | if (unlikely(!skb)) { |
4061 | /* Better luck next round */ | 4052 | /* Better luck next round */ |
4062 | adapter->alloc_rx_buff_failed++; | 4053 | adapter->alloc_rx_buff_failed++; |
@@ -4069,7 +4060,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
4069 | DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " | 4060 | DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " |
4070 | "at %p\n", bufsz, skb->data); | 4061 | "at %p\n", bufsz, skb->data); |
4071 | /* Try again, without freeing the previous */ | 4062 | /* Try again, without freeing the previous */ |
4072 | skb = netdev_alloc_skb(netdev, bufsz); | 4063 | skb = netdev_alloc_skb_ip_align(netdev, bufsz); |
4073 | /* Failed allocation, critical failure */ | 4064 | /* Failed allocation, critical failure */ |
4074 | if (!skb) { | 4065 | if (!skb) { |
4075 | dev_kfree_skb(oldskb); | 4066 | dev_kfree_skb(oldskb); |
@@ -4088,12 +4079,6 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
4088 | /* Use new allocation */ | 4079 | /* Use new allocation */ |
4089 | dev_kfree_skb(oldskb); | 4080 | dev_kfree_skb(oldskb); |
4090 | } | 4081 | } |
4091 | /* Make buffer alignment 2 beyond a 16 byte boundary | ||
4092 | * this will result in a 16 byte aligned IP header after | ||
4093 | * the 14 byte MAC header is removed | ||
4094 | */ | ||
4095 | skb_reserve(skb, NET_IP_ALIGN); | ||
4096 | |||
4097 | buffer_info->skb = skb; | 4082 | buffer_info->skb = skb; |
4098 | buffer_info->length = adapter->rx_buffer_len; | 4083 | buffer_info->length = adapter->rx_buffer_len; |
4099 | map_skb: | 4084 | map_skb: |