|
@@ -1354,17 +1354,28 @@ static int nfp_net_rx_csum_has_errors(u16 flags)
|
|
* @dp: NFP Net data path struct
|
|
* @dp: NFP Net data path struct
|
|
* @r_vec: per-ring structure
|
|
* @r_vec: per-ring structure
|
|
* @rxd: Pointer to RX descriptor
|
|
* @rxd: Pointer to RX descriptor
|
|
|
|
+ * @meta: Parsed metadata prepend
|
|
* @skb: Pointer to SKB
|
|
* @skb: Pointer to SKB
|
|
*/
|
|
*/
|
|
static void nfp_net_rx_csum(struct nfp_net_dp *dp,
|
|
static void nfp_net_rx_csum(struct nfp_net_dp *dp,
|
|
struct nfp_net_r_vector *r_vec,
|
|
struct nfp_net_r_vector *r_vec,
|
|
- struct nfp_net_rx_desc *rxd, struct sk_buff *skb)
|
|
|
|
|
|
+ struct nfp_net_rx_desc *rxd,
|
|
|
|
+ struct nfp_meta_parsed *meta, struct sk_buff *skb)
|
|
{
|
|
{
|
|
skb_checksum_none_assert(skb);
|
|
skb_checksum_none_assert(skb);
|
|
|
|
|
|
if (!(dp->netdev->features & NETIF_F_RXCSUM))
|
|
if (!(dp->netdev->features & NETIF_F_RXCSUM))
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ if (meta->csum_type) {
|
|
|
|
+ skb->ip_summed = meta->csum_type;
|
|
|
|
+ skb->csum = meta->csum;
|
|
|
|
+ u64_stats_update_begin(&r_vec->rx_sync);
|
|
|
|
+ r_vec->hw_csum_rx_ok++;
|
|
|
|
+ u64_stats_update_end(&r_vec->rx_sync);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (nfp_net_rx_csum_has_errors(le16_to_cpu(rxd->rxd.flags))) {
|
|
if (nfp_net_rx_csum_has_errors(le16_to_cpu(rxd->rxd.flags))) {
|
|
u64_stats_update_begin(&r_vec->rx_sync);
|
|
u64_stats_update_begin(&r_vec->rx_sync);
|
|
r_vec->hw_csum_rx_error++;
|
|
r_vec->hw_csum_rx_error++;
|
|
@@ -1449,6 +1460,12 @@ nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta,
|
|
meta->mark = get_unaligned_be32(data);
|
|
meta->mark = get_unaligned_be32(data);
|
|
data += 4;
|
|
data += 4;
|
|
break;
|
|
break;
|
|
|
|
+ case NFP_NET_META_CSUM:
|
|
|
|
+ meta->csum_type = CHECKSUM_COMPLETE;
|
|
|
|
+ meta->csum =
|
|
|
|
+ (__force __wsum)__get_unaligned_cpu32(data);
|
|
|
|
+ data += 4;
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -1712,7 +1729,7 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
|
|
skb_record_rx_queue(skb, rx_ring->idx);
|
|
skb_record_rx_queue(skb, rx_ring->idx);
|
|
skb->protocol = eth_type_trans(skb, dp->netdev);
|
|
skb->protocol = eth_type_trans(skb, dp->netdev);
|
|
|
|
|
|
- nfp_net_rx_csum(dp, r_vec, rxd, skb);
|
|
|
|
|
|
+ nfp_net_rx_csum(dp, r_vec, rxd, &meta, skb);
|
|
|
|
|
|
if (rxd->rxd.flags & PCIE_DESC_RX_VLAN)
|
|
if (rxd->rxd.flags & PCIE_DESC_RX_VLAN)
|
|
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
|
|
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
|
|
@@ -2712,9 +2729,9 @@ static int nfp_net_set_features(struct net_device *netdev,
|
|
|
|
|
|
if (changed & NETIF_F_RXCSUM) {
|
|
if (changed & NETIF_F_RXCSUM) {
|
|
if (features & NETIF_F_RXCSUM)
|
|
if (features & NETIF_F_RXCSUM)
|
|
- new_ctrl |= NFP_NET_CFG_CTRL_RXCSUM;
|
|
|
|
|
|
+ new_ctrl |= nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY;
|
|
else
|
|
else
|
|
- new_ctrl &= ~NFP_NET_CFG_CTRL_RXCSUM;
|
|
|
|
|
|
+ new_ctrl &= ~NFP_NET_CFG_CTRL_RXCSUM_ANY;
|
|
}
|
|
}
|
|
|
|
|
|
if (changed & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) {
|
|
if (changed & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) {
|
|
@@ -3035,7 +3052,7 @@ void nfp_net_info(struct nfp_net *nn)
|
|
nn->fw_ver.resv, nn->fw_ver.class,
|
|
nn->fw_ver.resv, nn->fw_ver.class,
|
|
nn->fw_ver.major, nn->fw_ver.minor,
|
|
nn->fw_ver.major, nn->fw_ver.minor,
|
|
nn->max_mtu);
|
|
nn->max_mtu);
|
|
- nn_info(nn, "CAP: %#x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
|
|
|
|
|
+ nn_info(nn, "CAP: %#x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
|
nn->cap,
|
|
nn->cap,
|
|
nn->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_L2BC ? "L2BCFILT " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_L2BC ? "L2BCFILT " : "",
|
|
@@ -3055,7 +3072,9 @@ void nfp_net_info(struct nfp_net *nn)
|
|
nn->cap & NFP_NET_CFG_CTRL_IRQMOD ? "IRQMOD " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_IRQMOD ? "IRQMOD " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_VXLAN ? "VXLAN " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_VXLAN ? "VXLAN " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_NVGRE ? "NVGRE " : "",
|
|
nn->cap & NFP_NET_CFG_CTRL_NVGRE ? "NVGRE " : "",
|
|
- nfp_net_ebpf_capable(nn) ? "BPF " : "");
|
|
|
|
|
|
+ nfp_net_ebpf_capable(nn) ? "BPF " : "",
|
|
|
|
+ nn->cap & NFP_NET_CFG_CTRL_CSUM_COMPLETE ?
|
|
|
|
+ "RXCSUM_COMPLETE " : "");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -3246,9 +3265,9 @@ int nfp_net_netdev_init(struct net_device *netdev)
|
|
* supported. By default we enable most features.
|
|
* supported. By default we enable most features.
|
|
*/
|
|
*/
|
|
netdev->hw_features = NETIF_F_HIGHDMA;
|
|
netdev->hw_features = NETIF_F_HIGHDMA;
|
|
- if (nn->cap & NFP_NET_CFG_CTRL_RXCSUM) {
|
|
|
|
|
|
+ if (nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY) {
|
|
netdev->hw_features |= NETIF_F_RXCSUM;
|
|
netdev->hw_features |= NETIF_F_RXCSUM;
|
|
- nn->dp.ctrl |= NFP_NET_CFG_CTRL_RXCSUM;
|
|
|
|
|
|
+ nn->dp.ctrl |= nn->cap & NFP_NET_CFG_CTRL_RXCSUM_ANY;
|
|
}
|
|
}
|
|
if (nn->cap & NFP_NET_CFG_CTRL_TXCSUM) {
|
|
if (nn->cap & NFP_NET_CFG_CTRL_TXCSUM) {
|
|
netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
|
|
netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
|