Commit 45a5ead0 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by David S. Miller

ixgbe: enable hardware offload for sctp

Inspired by: Vlad Yasevich <vladislav.yasevich@hp.com>

This is the code to enable ixgbe for hardware offload support
of CRC32c on both transmit and receive of SCTP traffic.

only 82599 supports this offload, not 82598.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9473560
...@@ -311,10 +311,17 @@ static u32 ixgbe_get_tx_csum(struct net_device *netdev) ...@@ -311,10 +311,17 @@ static u32 ixgbe_get_tx_csum(struct net_device *netdev)
static int ixgbe_set_tx_csum(struct net_device *netdev, u32 data) static int ixgbe_set_tx_csum(struct net_device *netdev, u32 data)
{ {
if (data) struct ixgbe_adapter *adapter = netdev_priv(netdev);
if (data) {
netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
else if (adapter->hw.mac.type == ixgbe_mac_82599EB)
netdev->features |= NETIF_F_SCTP_CSUM;
} else {
netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
if (adapter->hw.mac.type == ixgbe_mac_82599EB)
netdev->features &= ~NETIF_F_SCTP_CSUM;
}
return 0; return 0;
} }
......
...@@ -4189,12 +4189,18 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter, ...@@ -4189,12 +4189,18 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
if (ip_hdr(skb)->protocol == IPPROTO_TCP) if (ip_hdr(skb)->protocol == IPPROTO_TCP)
type_tucmd_mlhl |= type_tucmd_mlhl |=
IXGBE_ADVTXD_TUCMD_L4T_TCP; IXGBE_ADVTXD_TUCMD_L4T_TCP;
else if (ip_hdr(skb)->protocol == IPPROTO_SCTP)
type_tucmd_mlhl |=
IXGBE_ADVTXD_TUCMD_L4T_SCTP;
break; break;
case cpu_to_be16(ETH_P_IPV6): case cpu_to_be16(ETH_P_IPV6):
/* XXX what about other V6 headers?? */ /* XXX what about other V6 headers?? */
if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
type_tucmd_mlhl |= type_tucmd_mlhl |=
IXGBE_ADVTXD_TUCMD_L4T_TCP; IXGBE_ADVTXD_TUCMD_L4T_TCP;
else if (ipv6_hdr(skb)->nexthdr == IPPROTO_SCTP)
type_tucmd_mlhl |=
IXGBE_ADVTXD_TUCMD_L4T_SCTP;
break; break;
default: default:
if (unlikely(net_ratelimit())) { if (unlikely(net_ratelimit())) {
...@@ -4718,6 +4724,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, ...@@ -4718,6 +4724,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
netdev->features |= NETIF_F_TSO6; netdev->features |= NETIF_F_TSO6;
netdev->features |= NETIF_F_GRO; netdev->features |= NETIF_F_GRO;
if (adapter->hw.mac.type == ixgbe_mac_82599EB)
netdev->features |= NETIF_F_SCTP_CSUM;
netdev->vlan_features |= NETIF_F_TSO; netdev->vlan_features |= NETIF_F_TSO;
netdev->vlan_features |= NETIF_F_TSO6; netdev->vlan_features |= NETIF_F_TSO6;
netdev->vlan_features |= NETIF_F_IP_CSUM; netdev->vlan_features |= NETIF_F_IP_CSUM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment