[ewg] [PATCH] RDMA/nes: Fixes for OFED-3.5 RC3

Tatyana Nikolova Tatyana.E.Nikolova at intel.com
Thu Dec 13 09:49:44 PST 2012


RDMA/nes: Fixes for OFED-3.5 RC3

1. Backports for ethtool ops (which allow turning on/off tx, rx, sg, tso)
   are added for RHEL 6.2 and 6.3
2. Fix for crash caused by improper skb ip_summed field setting
   when tx checksum is disabled
3. Fix for crash when registering MR with zero length

Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova at intel.com>
---
 ...033-RDMA-nes-Fix-for-tx-checksum-disabled.patch |   39 ++++++
 ...34-RDMA-nes-Fix-for-memreg-cq-zero-length.patch |   26 ++++
 ...RDMA-nes-Backports-update-for-ethtool-ops.patch |  122 ++++++++++++++++++++
 3 files changed, 187 insertions(+), 0 deletions(-)
 create mode 100644 linux-next-pending/0033-RDMA-nes-Fix-for-tx-checksum-disabled.patch
 create mode 100644 linux-next-pending/0034-RDMA-nes-Fix-for-memreg-cq-zero-length.patch
 create mode 100644 patches/0029-RDMA-nes-Backports-update-for-ethtool-ops.patch

diff --git a/linux-next-pending/0033-RDMA-nes-Fix-for-tx-checksum-disabled.patch b/linux-next-pending/0033-RDMA-nes-Fix-for-tx-checksum-disabled.patch
new file mode 100644
index 0000000..a1aa7e8
--- /dev/null
+++ b/linux-next-pending/0033-RDMA-nes-Fix-for-tx-checksum-disabled.patch
@@ -0,0 +1,39 @@
+Fix for sending mini cm packets with tx checksum offload disabled.
+
+Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova at intel.com>
+---
+ drivers/infiniband/hw/nes/nes_cm.c  |    2 ++
+ drivers/infiniband/hw/nes/nes_nic.c |    4 +++-
+ 2 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
+index 43d91b0..4084dd3 100644
+--- a/drivers/infiniband/hw/nes/nes_cm.c
++++ b/drivers/infiniband/hw/nes/nes_cm.c
+@@ -430,6 +430,8 @@ static void form_cm_frame(struct sk_buff *skb,
+ 	buf += sizeof(*tcph);
+ 
+ 	skb->ip_summed = CHECKSUM_PARTIAL;
++	if (!(cm_node->netdev->features & NETIF_F_IP_CSUM))
++		skb->ip_summed = CHECKSUM_UNNECESSARY;		
+ 	skb->protocol = htons(0x800);
+ 	skb->data_len = 0;
+ 	skb->mac_len = ETH_HLEN;
+diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
+index d113dac..300192f 100644
+--- a/drivers/infiniband/hw/nes/nes_nic.c
++++ b/drivers/infiniband/hw/nes/nes_nic.c
+@@ -400,7 +400,9 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
+ 			wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
+ 		}
+ 	} else {	/* CHECKSUM_HW */
+-		wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM | NES_NIC_SQ_WQE_COMPLETION;
++		wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
++		if (skb->ip_summed != CHECKSUM_UNNECESSARY)
++			 wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM;
+ 	}
+ 
+ 	set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX,
+-- 
+1.7.4.2
+
diff --git a/linux-next-pending/0034-RDMA-nes-Fix-for-memreg-cq-zero-length.patch b/linux-next-pending/0034-RDMA-nes-Fix-for-memreg-cq-zero-length.patch
new file mode 100644
index 0000000..8f423b9
--- /dev/null
+++ b/linux-next-pending/0034-RDMA-nes-Fix-for-memreg-cq-zero-length.patch
@@ -0,0 +1,26 @@
+Fix for crash when registering zero length MR for CQ.
+
+Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova at intel.com>
+---
+ drivers/infiniband/hw/nes/nes_verbs.c |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
+index c47ec25..07e4fba 100644
+--- a/drivers/infiniband/hw/nes/nes_verbs.c
++++ b/drivers/infiniband/hw/nes/nes_verbs.c
+@@ -2561,6 +2561,11 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
+ 			return ibmr;
+ 		case IWNES_MEMREG_TYPE_QP:
+ 		case IWNES_MEMREG_TYPE_CQ:
++			if (!region->length) {
++				nes_debug(NES_DBG_MR, "Unable to register zero length region for CQ\n");
++				ib_umem_release(region);
++				return ERR_PTR(-EINVAL);
++			}
+ 			nespbl = kzalloc(sizeof(*nespbl), GFP_KERNEL);
+ 			if (!nespbl) {
+ 				nes_debug(NES_DBG_MR, "Unable to allocate PBL\n");
+-- 
+1.7.4.2
+
diff --git a/patches/0029-RDMA-nes-Backports-update-for-ethtool-ops.patch b/patches/0029-RDMA-nes-Backports-update-for-ethtool-ops.patch
new file mode 100644
index 0000000..e380389
--- /dev/null
+++ b/patches/0029-RDMA-nes-Backports-update-for-ethtool-ops.patch
@@ -0,0 +1,122 @@
+Added backports for RHEL 6.2 and 6.3 ethtool ops.
+
+Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova at intel.com>
+---
+ drivers/infiniband/hw/nes/nes_hw.c  |   10 ++++++++
+ drivers/infiniband/hw/nes/nes_hw.h  |    3 ++
+ drivers/infiniband/hw/nes/nes_nic.c |   43 +++++++++++++++++++++++++++++++++++
+ 3 files changed, 56 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
+index eff10e1..61f9d8d 100644
+--- a/drivers/infiniband/hw/nes/nes_hw.c
++++ b/drivers/infiniband/hw/nes/nes_hw.c
+@@ -2911,8 +2911,13 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
+ 					if ((cqe_errv &
+ 							(NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_TCPUDP_CSUM_ERR |
+ 							NES_NIC_ERRV_BITS_IPH_ERR | NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
++						if (nesvnic->rx_checksum_disabled == 0)
++							rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
++#else
+ 						if (nesvnic->netdev->features & NETIF_F_RXCSUM)
+ 							rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
++#endif
+ 					} else
+ 						nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet."
+ 								" errv = 0x%X, pkt_type = 0x%X.\n",
+@@ -2922,11 +2927,16 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
+ 					if ((cqe_errv &
+ 							(NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_IPH_ERR |
+ 							NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
++						if (nesvnic->rx_checksum_disabled == 0)
++							rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
++#else
+ 						if (nesvnic->netdev->features & NETIF_F_RXCSUM) {
+ 							rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
+ 							/* nes_debug(NES_DBG_CQ, "%s: Reporting successfully checksummed IPv4 packet.\n",
+ 								  nesvnic->netdev->name); */
+ 						}
++#endif
+ 					} else
+ 						nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet."
+ 								" errv = 0x%X, pkt_type = 0x%X.\n",
+diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h
+index b4a31de..b31222a 100644
+--- a/drivers/infiniband/hw/nes/nes_hw.h
++++ b/drivers/infiniband/hw/nes/nes_hw.h
+@@ -1272,6 +1272,9 @@ struct nes_vnic {
+ 	u8  next_qp_nic_index;
+ 	u8  of_device_registered;
+ 	u8  rdma_enabled;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
++	u8  rx_checksum_disabled;
++#endif
+ 	u32 lro_max_aggr;
+ 	struct net_lro_mgr lro_mgr;
+ 	struct net_lro_desc lro_desc[NES_MAX_LRO_DESCRIPTORS];
+diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
+index f3d73d0..d113dac 100644
+--- a/drivers/infiniband/hw/nes/nes_nic.c
++++ b/drivers/infiniband/hw/nes/nes_nic.c
+@@ -1104,6 +1104,37 @@ static const char nes_ethtool_stringset[][ETH_GSTRING_LEN] = {
+ #define NES_ETHTOOL_STAT_COUNT  ARRAY_SIZE(nes_ethtool_stringset)
+ 
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
++/**
++ * nes_netdev_get_rx_csum
++ */
++static u32 nes_netdev_get_rx_csum (struct net_device *netdev)
++{
++	struct nes_vnic *nesvnic = netdev_priv(netdev);
++
++	if (nesvnic->rx_checksum_disabled)
++		return 0;
++	else
++		return 1;
++}
++
++
++/**
++ * nes_netdev_set_rc_csum
++ */
++static int nes_netdev_set_rx_csum(struct net_device *netdev, u32 enable)
++{
++	struct nes_vnic *nesvnic = netdev_priv(netdev);
++
++	if (enable)
++		nesvnic->rx_checksum_disabled = 0;
++	else
++		nesvnic->rx_checksum_disabled = 1;
++	return 0;
++}
++#endif
++
++
+ /**
+  * nes_netdev_get_sset_count
+  */
+@@ -1594,6 +1625,18 @@ static const struct ethtool_ops nes_ethtool_ops = {
+ 	.set_coalesce = nes_netdev_set_coalesce,
+ 	.get_pauseparam = nes_netdev_get_pauseparam,
+ 	.set_pauseparam = nes_netdev_set_pauseparam,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
++	.get_tx_csum = ethtool_op_get_tx_csum,
++	.set_tx_csum = ethtool_op_set_tx_csum,
++	.get_rx_csum = nes_netdev_get_rx_csum,
++	.set_rx_csum = nes_netdev_set_rx_csum,
++	.get_sg = ethtool_op_get_sg,
++	.set_sg = ethtool_op_set_sg,
++	.get_tso = ethtool_op_get_tso,
++	.set_tso = ethtool_op_set_tso,
++	.get_flags = ethtool_op_get_flags,
++	.set_flags = ethtool_op_set_flags,
++#endif
+ };
+ 
+ 
+-- 
+1.7.4.2
+
-- 
1.7.1




More information about the ewg mailing list