@@ -40,7 +40,7 @@ static const char ixgbevf_driver_string[] =
40
40
#define DRV_VERSION "4.1.0-k"
41
41
const char ixgbevf_driver_version [] = DRV_VERSION ;
42
42
static char ixgbevf_copyright [] =
43
- "Copyright (c) 2009 - 2015 Intel Corporation." ;
43
+ "Copyright (c) 2009 - 2018 Intel Corporation." ;
44
44
45
45
static const struct ixgbevf_info * ixgbevf_info_tbl [] = {
46
46
[board_82599_vf ] = & ixgbevf_82599_vf_info ,
@@ -268,7 +268,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector,
268
268
struct ixgbevf_adapter * adapter = q_vector -> adapter ;
269
269
struct ixgbevf_tx_buffer * tx_buffer ;
270
270
union ixgbe_adv_tx_desc * tx_desc ;
271
- unsigned int total_bytes = 0 , total_packets = 0 ;
271
+ unsigned int total_bytes = 0 , total_packets = 0 , total_ipsec = 0 ;
272
272
unsigned int budget = tx_ring -> count / 2 ;
273
273
unsigned int i = tx_ring -> next_to_clean ;
274
274
@@ -299,6 +299,8 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector,
299
299
/* update the statistics for this packet */
300
300
total_bytes += tx_buffer -> bytecount ;
301
301
total_packets += tx_buffer -> gso_segs ;
302
+ if (tx_buffer -> tx_flags & IXGBE_TX_FLAGS_IPSEC )
303
+ total_ipsec ++ ;
302
304
303
305
/* free the skb */
304
306
if (ring_is_xdp (tx_ring ))
@@ -361,6 +363,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_q_vector *q_vector,
361
363
u64_stats_update_end (& tx_ring -> syncp );
362
364
q_vector -> tx .total_bytes += total_bytes ;
363
365
q_vector -> tx .total_packets += total_packets ;
366
+ adapter -> tx_ipsec += total_ipsec ;
364
367
365
368
if (check_for_tx_hang (tx_ring ) && ixgbevf_check_tx_hang (tx_ring )) {
366
369
struct ixgbe_hw * hw = & adapter -> hw ;
@@ -516,6 +519,9 @@ static void ixgbevf_process_skb_fields(struct ixgbevf_ring *rx_ring,
516
519
__vlan_hwaccel_put_tag (skb , htons (ETH_P_8021Q ), vid );
517
520
}
518
521
522
+ if (ixgbevf_test_staterr (rx_desc , IXGBE_RXDADV_STAT_SECP ))
523
+ ixgbevf_ipsec_rx (rx_ring , rx_desc , skb );
524
+
519
525
skb -> protocol = eth_type_trans (skb , rx_ring -> netdev );
520
526
}
521
527
@@ -1012,7 +1018,7 @@ static int ixgbevf_xmit_xdp_ring(struct ixgbevf_ring *ring,
1012
1018
context_desc = IXGBEVF_TX_CTXTDESC (ring , 0 );
1013
1019
context_desc -> vlan_macip_lens =
1014
1020
cpu_to_le32 (ETH_HLEN << IXGBE_ADVTXD_MACLEN_SHIFT );
1015
- context_desc -> seqnum_seed = 0 ;
1021
+ context_desc -> fceof_saidx = 0 ;
1016
1022
context_desc -> type_tucmd_mlhl =
1017
1023
cpu_to_le32 (IXGBE_TXD_CMD_DEXT |
1018
1024
IXGBE_ADVTXD_DTYP_CTXT );
@@ -2200,6 +2206,7 @@ static void ixgbevf_configure(struct ixgbevf_adapter *adapter)
2200
2206
ixgbevf_set_rx_mode (adapter -> netdev );
2201
2207
2202
2208
ixgbevf_restore_vlan (adapter );
2209
+ ixgbevf_ipsec_restore (adapter );
2203
2210
2204
2211
ixgbevf_configure_tx (adapter );
2205
2212
ixgbevf_configure_rx (adapter );
@@ -2246,7 +2253,8 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
2246
2253
static void ixgbevf_negotiate_api (struct ixgbevf_adapter * adapter )
2247
2254
{
2248
2255
struct ixgbe_hw * hw = & adapter -> hw ;
2249
- int api [] = { ixgbe_mbox_api_13 ,
2256
+ int api [] = { ixgbe_mbox_api_14 ,
2257
+ ixgbe_mbox_api_13 ,
2250
2258
ixgbe_mbox_api_12 ,
2251
2259
ixgbe_mbox_api_11 ,
2252
2260
ixgbe_mbox_api_10 ,
@@ -2605,6 +2613,7 @@ static void ixgbevf_set_num_queues(struct ixgbevf_adapter *adapter)
2605
2613
case ixgbe_mbox_api_11 :
2606
2614
case ixgbe_mbox_api_12 :
2607
2615
case ixgbe_mbox_api_13 :
2616
+ case ixgbe_mbox_api_14 :
2608
2617
if (adapter -> xdp_prog &&
2609
2618
hw -> mac .max_tx_queues == rss )
2610
2619
rss = rss > 3 ? 2 : 1 ;
@@ -3700,8 +3709,8 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter)
3700
3709
}
3701
3710
3702
3711
static void ixgbevf_tx_ctxtdesc (struct ixgbevf_ring * tx_ring ,
3703
- u32 vlan_macip_lens , u32 type_tucmd ,
3704
- u32 mss_l4len_idx )
3712
+ u32 vlan_macip_lens , u32 fceof_saidx ,
3713
+ u32 type_tucmd , u32 mss_l4len_idx )
3705
3714
{
3706
3715
struct ixgbe_adv_tx_context_desc * context_desc ;
3707
3716
u16 i = tx_ring -> next_to_use ;
@@ -3715,14 +3724,15 @@ static void ixgbevf_tx_ctxtdesc(struct ixgbevf_ring *tx_ring,
3715
3724
type_tucmd |= IXGBE_TXD_CMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT ;
3716
3725
3717
3726
context_desc -> vlan_macip_lens = cpu_to_le32 (vlan_macip_lens );
3718
- context_desc -> seqnum_seed = 0 ;
3727
+ context_desc -> fceof_saidx = cpu_to_le32 ( fceof_saidx ) ;
3719
3728
context_desc -> type_tucmd_mlhl = cpu_to_le32 (type_tucmd );
3720
3729
context_desc -> mss_l4len_idx = cpu_to_le32 (mss_l4len_idx );
3721
3730
}
3722
3731
3723
3732
static int ixgbevf_tso (struct ixgbevf_ring * tx_ring ,
3724
3733
struct ixgbevf_tx_buffer * first ,
3725
- u8 * hdr_len )
3734
+ u8 * hdr_len ,
3735
+ struct ixgbevf_ipsec_tx_data * itd )
3726
3736
{
3727
3737
u32 vlan_macip_lens , type_tucmd , mss_l4len_idx ;
3728
3738
struct sk_buff * skb = first -> skb ;
@@ -3736,6 +3746,7 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring,
3736
3746
unsigned char * hdr ;
3737
3747
} l4 ;
3738
3748
u32 paylen , l4_offset ;
3749
+ u32 fceof_saidx = 0 ;
3739
3750
int err ;
3740
3751
3741
3752
if (skb -> ip_summed != CHECKSUM_PARTIAL )
@@ -3761,13 +3772,15 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring,
3761
3772
if (ip .v4 -> version == 4 ) {
3762
3773
unsigned char * csum_start = skb_checksum_start (skb );
3763
3774
unsigned char * trans_start = ip .hdr + (ip .v4 -> ihl * 4 );
3775
+ int len = csum_start - trans_start ;
3764
3776
3765
3777
/* IP header will have to cancel out any data that
3766
- * is not a part of the outer IP header
3778
+ * is not a part of the outer IP header, so set to
3779
+ * a reverse csum if needed, else init check to 0.
3767
3780
*/
3768
- ip .v4 -> check = csum_fold ( csum_partial ( trans_start ,
3769
- csum_start - trans_start ,
3770
- 0 ));
3781
+ ip .v4 -> check = ( skb_shinfo ( skb ) -> gso_type & SKB_GSO_PARTIAL ) ?
3782
+ csum_fold ( csum_partial ( trans_start ,
3783
+ len , 0 )) : 0 ;
3771
3784
type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4 ;
3772
3785
3773
3786
ip .v4 -> tot_len = 0 ;
@@ -3799,13 +3812,16 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring,
3799
3812
mss_l4len_idx |= skb_shinfo (skb )-> gso_size << IXGBE_ADVTXD_MSS_SHIFT ;
3800
3813
mss_l4len_idx |= (1u << IXGBE_ADVTXD_IDX_SHIFT );
3801
3814
3815
+ fceof_saidx |= itd -> pfsa ;
3816
+ type_tucmd |= itd -> flags | itd -> trailer_len ;
3817
+
3802
3818
/* vlan_macip_lens: HEADLEN, MACLEN, VLAN tag */
3803
3819
vlan_macip_lens = l4 .hdr - ip .hdr ;
3804
3820
vlan_macip_lens |= (ip .hdr - skb -> data ) << IXGBE_ADVTXD_MACLEN_SHIFT ;
3805
3821
vlan_macip_lens |= first -> tx_flags & IXGBE_TX_FLAGS_VLAN_MASK ;
3806
3822
3807
- ixgbevf_tx_ctxtdesc (tx_ring , vlan_macip_lens ,
3808
- type_tucmd , mss_l4len_idx );
3823
+ ixgbevf_tx_ctxtdesc (tx_ring , vlan_macip_lens , fceof_saidx , type_tucmd ,
3824
+ mss_l4len_idx );
3809
3825
3810
3826
return 1 ;
3811
3827
}
@@ -3820,10 +3836,12 @@ static inline bool ixgbevf_ipv6_csum_is_sctp(struct sk_buff *skb)
3820
3836
}
3821
3837
3822
3838
static void ixgbevf_tx_csum (struct ixgbevf_ring * tx_ring ,
3823
- struct ixgbevf_tx_buffer * first )
3839
+ struct ixgbevf_tx_buffer * first ,
3840
+ struct ixgbevf_ipsec_tx_data * itd )
3824
3841
{
3825
3842
struct sk_buff * skb = first -> skb ;
3826
3843
u32 vlan_macip_lens = 0 ;
3844
+ u32 fceof_saidx = 0 ;
3827
3845
u32 type_tucmd = 0 ;
3828
3846
3829
3847
if (skb -> ip_summed != CHECKSUM_PARTIAL )
@@ -3862,7 +3880,11 @@ static void ixgbevf_tx_csum(struct ixgbevf_ring *tx_ring,
3862
3880
vlan_macip_lens |= skb_network_offset (skb ) << IXGBE_ADVTXD_MACLEN_SHIFT ;
3863
3881
vlan_macip_lens |= first -> tx_flags & IXGBE_TX_FLAGS_VLAN_MASK ;
3864
3882
3865
- ixgbevf_tx_ctxtdesc (tx_ring , vlan_macip_lens , type_tucmd , 0 );
3883
+ fceof_saidx |= itd -> pfsa ;
3884
+ type_tucmd |= itd -> flags | itd -> trailer_len ;
3885
+
3886
+ ixgbevf_tx_ctxtdesc (tx_ring , vlan_macip_lens ,
3887
+ fceof_saidx , type_tucmd , 0 );
3866
3888
}
3867
3889
3868
3890
static __le32 ixgbevf_tx_cmd_type (u32 tx_flags )
@@ -3896,8 +3918,12 @@ static void ixgbevf_tx_olinfo_status(union ixgbe_adv_tx_desc *tx_desc,
3896
3918
if (tx_flags & IXGBE_TX_FLAGS_IPV4 )
3897
3919
olinfo_status |= cpu_to_le32 (IXGBE_ADVTXD_POPTS_IXSM );
3898
3920
3899
- /* use index 1 context for TSO/FSO/FCOE */
3900
- if (tx_flags & IXGBE_TX_FLAGS_TSO )
3921
+ /* enable IPsec */
3922
+ if (tx_flags & IXGBE_TX_FLAGS_IPSEC )
3923
+ olinfo_status |= cpu_to_le32 (IXGBE_ADVTXD_POPTS_IPSEC );
3924
+
3925
+ /* use index 1 context for TSO/FSO/FCOE/IPSEC */
3926
+ if (tx_flags & (IXGBE_TX_FLAGS_TSO | IXGBE_TX_FLAGS_IPSEC ))
3901
3927
olinfo_status |= cpu_to_le32 (1u << IXGBE_ADVTXD_IDX_SHIFT );
3902
3928
3903
3929
/* Check Context must be set if Tx switch is enabled, which it
@@ -4079,6 +4105,7 @@ static int ixgbevf_xmit_frame_ring(struct sk_buff *skb,
4079
4105
int tso ;
4080
4106
u32 tx_flags = 0 ;
4081
4107
u16 count = TXD_USE_COUNT (skb_headlen (skb ));
4108
+ struct ixgbevf_ipsec_tx_data ipsec_tx = { 0 };
4082
4109
#if PAGE_SIZE > IXGBE_MAX_DATA_PER_TXD
4083
4110
unsigned short f ;
4084
4111
#endif
@@ -4123,11 +4150,15 @@ static int ixgbevf_xmit_frame_ring(struct sk_buff *skb,
4123
4150
first -> tx_flags = tx_flags ;
4124
4151
first -> protocol = vlan_get_protocol (skb );
4125
4152
4126
- tso = ixgbevf_tso (tx_ring , first , & hdr_len );
4153
+ #ifdef CONFIG_XFRM_OFFLOAD
4154
+ if (skb -> sp && !ixgbevf_ipsec_tx (tx_ring , first , & ipsec_tx ))
4155
+ goto out_drop ;
4156
+ #endif
4157
+ tso = ixgbevf_tso (tx_ring , first , & hdr_len , & ipsec_tx );
4127
4158
if (tso < 0 )
4128
4159
goto out_drop ;
4129
4160
else if (!tso )
4130
- ixgbevf_tx_csum (tx_ring , first );
4161
+ ixgbevf_tx_csum (tx_ring , first , & ipsec_tx );
4131
4162
4132
4163
ixgbevf_tx_map (tx_ring , first , hdr_len );
4133
4164
@@ -4638,6 +4669,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4638
4669
case ixgbe_mbox_api_11 :
4639
4670
case ixgbe_mbox_api_12 :
4640
4671
case ixgbe_mbox_api_13 :
4672
+ case ixgbe_mbox_api_14 :
4641
4673
netdev -> max_mtu = IXGBE_MAX_JUMBO_FRAME_SIZE -
4642
4674
(ETH_HLEN + ETH_FCS_LEN );
4643
4675
break ;
@@ -4673,6 +4705,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4673
4705
4674
4706
pci_set_drvdata (pdev , netdev );
4675
4707
netif_carrier_off (netdev );
4708
+ ixgbevf_init_ipsec_offload (adapter );
4676
4709
4677
4710
ixgbevf_init_last_counter_stats (adapter );
4678
4711
@@ -4739,6 +4772,7 @@ static void ixgbevf_remove(struct pci_dev *pdev)
4739
4772
if (netdev -> reg_state == NETREG_REGISTERED )
4740
4773
unregister_netdev (netdev );
4741
4774
4775
+ ixgbevf_stop_ipsec_offload (adapter );
4742
4776
ixgbevf_clear_interrupt_scheme (adapter );
4743
4777
ixgbevf_reset_interrupt_capability (adapter );
4744
4778
0 commit comments