Skip to contentSkip to conversation

ipvs: use pkts for SCTP too

PATCH In review Julian Anastasov 3 participants 6 messages Sep 1, 2010 – Sep 2, 2010

Subsystems (4)
lore
Share & tools
lore

Julian Anastasov

author maintainer
#0 lore raw

PATCH 1/1 ipvs: use pkts for SCTP too

Use correctly the in_pkts packet counter also for SCTP

---

This patch is for net-next

net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +1 -2
@@ -1380,8 +1380,7 @@ ip_vs_in(unsigned int hooknum, struct sk
 	if (af == AF_INET && (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    cp->protocol == IPPROTO_SCTP) {
 		if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
-			(atomic_read(&cp->in_pkts) %
-			 sysctl_ip_vs_sync_threshold[1]
+			(pkts % sysctl_ip_vs_sync_threshold[1]
 			 == sysctl_ip_vs_sync_threshold[0])) ||
 				(cp->old_state != cp->state &&
 				 ((cp->state == IP_VS_SCTP_S_CLOSED) ||
@@ -1391,7 +1390,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 			goto out;
 		}
 	}
maintainer
#1 lore raw
Quoted 7 lines · Julian Anastasov

Use correctly the in_pkts packet counter also for SCTP

---

This patch is for net-next

Thanks,

apart from the minor nit below, this looks good to me. Should I submit it to net-next ?

Quoted 14 lines
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +1 -2
@@ -1380,8 +1380,7 @@ ip_vs_in(unsigned int hooknum, struct sk
 	if (af == AF_INET && (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    cp->protocol == IPPROTO_SCTP) {
 		if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
-			(atomic_read(&cp->in_pkts) %
-			 sysctl_ip_vs_sync_threshold[1]
+			(pkts % sysctl_ip_vs_sync_threshold[1]
 			 == sysctl_ip_vs_sync_threshold[0])) ||
 				(cp->old_state != cp->state &&
 				 ((cp->state == IP_VS_SCTP_S_CLOSED) ||

net/netfilter/ipvs/ip_vs_core.c ip_vs_in(unsigned int hooknum, struct sk · line 1397

Quoted 9 lines
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +2 -1
@@ -1391,7 +1390,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 			goto out;
 		}
 	}
-
+	else
+	/* Keep this block last: TCP and others with pp->num_states <= 1 */
 	if (af == AF_INET &&
 	    (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    (((cp->protocol != IPPROTO_TCP ||

The else and the if really ought to be on the same line:

@@ -1395,7 +1394,8 @@ ip_vs_in(unsigned int hooknum, struct sk
}
}

- if (af == AF_INET &&
+ /* Keep this block last: TCP and others with pp->num_states <= 1 */
+ else if (af == AF_INET &&
(ip_vs_sync_state & IP_VS_STATE_MASTER) && (((cp->protocol != IPPROTO_TCP ||
cp->state == IP_VS_TCP_S_ESTABLISHED) &&

author maintainer
#2 lore raw

Hello,

Quoted 7 lines · Simon Horman
Quoted 6 lines · Julian Anastasov

Use correctly the in_pkts packet counter also for SCTP

---

Quoted 6 lines
Quoted 1 line

This patch is for net-next

Thanks,

apart from the minor nit below, this looks good to me. Should I submit it to net-next ?

Yes, please submit the fixed version. Sometimes
I forget that my style for 'else' does not match the kernel's one.

Quoted 16 lines
Quoted 16 lines
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +1 -2
@@ -1380,8 +1380,7 @@ ip_vs_in(unsigned int hooknum, struct sk
 	if (af == AF_INET && (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    cp->protocol == IPPROTO_SCTP) {
 		if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
-			(atomic_read(&cp->in_pkts) %
-			 sysctl_ip_vs_sync_threshold[1]
+			(pkts % sysctl_ip_vs_sync_threshold[1]
 			 == sysctl_ip_vs_sync_threshold[0])) ||
 				(cp->old_state != cp->state &&
 				 ((cp->state == IP_VS_SCTP_S_CLOSED) ||
@@ -1391,7 +1390,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 			goto out;
 		}
 	}
Quoted 8 lines

net/netfilter/ipvs/ip_vs_core.c ip_vs_in(unsigned int hooknum, struct sk · line 1397

Quoted 6 lines
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +2 -1
-
+	else
+	/* Keep this block last: TCP and others with pp->num_states <= 1 */
 	if (af == AF_INET &&
 	    (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    (((cp->protocol != IPPROTO_TCP ||

The else and the if really ought to be on the same line:

Yes, thanks!

Review ip_vs_in(unsigned int hooknum, struct sk · line 1401

Quoted 12 lines
(quoted diff) +2 -1
@@ -1395,7 +1394,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 		}
 	}
 
-	if (af == AF_INET &&
+	/* Keep this block last: TCP and others with pp->num_states <= 1 */
+	else if (af == AF_INET &&
 	    (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    (((cp->protocol != IPPROTO_TCP ||
 	       cp->state == IP_VS_TCP_S_ESTABLISHED) &&

Regards

--
Julian Anastasov <[email protected]>

maintainer
#3 lore raw
Quoted 14 lines · Julian Anastasov

Hello,

Quoted 9 lines · Simon Horman
Quoted 7 lines · Julian Anastasov

Use correctly the in_pkts packet counter also for SCTP

---

This patch is for net-next

Quoted 8 lines
Quoted 4 lines

Thanks,

apart from the minor nit below, this looks good to me. Should I submit it to net-next ?

Yes, please submit the fixed version. Sometimes
I forget that my style for 'else' does not match the kernel's one.

No problem, will do.

Quoted 44 lines
Quoted 16 lines
Quoted 16 lines
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +1 -2
@@ -1380,8 +1380,7 @@ ip_vs_in(unsigned int hooknum, struct sk
 	if (af == AF_INET && (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    cp->protocol == IPPROTO_SCTP) {
 		if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
-			(atomic_read(&cp->in_pkts) %
-			 sysctl_ip_vs_sync_threshold[1]
+			(pkts % sysctl_ip_vs_sync_threshold[1]
 			 == sysctl_ip_vs_sync_threshold[0])) ||
 				(cp->old_state != cp->state &&
 				 ((cp->state == IP_VS_SCTP_S_CLOSED) ||
@@ -1391,7 +1390,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 			goto out;
 		}
 	}
Quoted 8 lines

net/netfilter/ipvs/ip_vs_core.c ip_vs_in(unsigned int hooknum, struct sk · line 1397

Quoted 6 lines
net/netfilter/ipvs/ip_vs_core.c renamed from linux/net/netfilter/ipvs/ip_vs_core.c +2 -1
-
+	else
+	/* Keep this block last: TCP and others with pp->num_states <= 1 */
 	if (af == AF_INET &&
 	    (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    (((cp->protocol != IPPROTO_TCP ||

The else and the if really ought to be on the same line:

Yes, thanks!

Review ip_vs_in(unsigned int hooknum, struct sk · line 1401

Quoted 12 lines
(quoted diff) +2 -1
@@ -1395,7 +1394,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 		}
 	}
 
-	if (af == AF_INET &&
+	/* Keep this block last: TCP and others with pp->num_states <= 1 */
+	else if (af == AF_INET &&
 	    (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    (((cp->protocol != IPPROTO_TCP ||
 	       cp->state == IP_VS_TCP_S_ESTABLISHED) &&

Regards

--
Julian Anastasov <[email protected]>

maintainer
#4 lore raw

PATCH 1/1 ipvs: use pkts for SCTP too

In reply to Simon Horman

From: Julian Anastasov <[email protected]>

Use correctly the in_pkts packet counter also for SCTP

---

Dave, can you take this into net-next?

net/netfilter/ipvs/ip_vs_core.c +3 -3
Index: net-next-2.6/net/netfilter/ipvs/ip_vs_core.c
===================================================================
@@ -1383,8 +1383,7 @@ ip_vs_in(unsigned int hooknum, struct sk
 	if (af == AF_INET && (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    cp->protocol == IPPROTO_SCTP) {
 		if ((cp->state == IP_VS_SCTP_S_ESTABLISHED &&
-			(atomic_read(&cp->in_pkts) %
-			 sysctl_ip_vs_sync_threshold[1]
+			(pkts % sysctl_ip_vs_sync_threshold[1]
 			 == sysctl_ip_vs_sync_threshold[0])) ||
 				(cp->old_state != cp->state &&
 				 ((cp->state == IP_VS_SCTP_S_CLOSED) ||
@@ -1395,7 +1394,8 @@ ip_vs_in(unsigned int hooknum, struct sk
 		}
 	}
 
-	if (af == AF_INET &&
+	/* Keep this block last: TCP and others with pp->num_states <= 1 */
+	else if (af == AF_INET &&
 	    (ip_vs_sync_state & IP_VS_STATE_MASTER) &&
 	    (((cp->protocol != IPPROTO_TCP ||
 	       cp->state == IP_VS_TCP_S_ESTABLISHED) &&