From patchwork Sun Nov 14 09:05:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 71094 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2EA46B711B for ; Sun, 14 Nov 2010 20:06:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754544Ab0KNJGH (ORCPT ); Sun, 14 Nov 2010 04:06:07 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:43291 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754260Ab0KNJGB (ORCPT ); Sun, 14 Nov 2010 04:06:01 -0500 Received: by iwn10 with SMTP id 10so5393846iwn.19 for ; Sun, 14 Nov 2010 01:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=TN3Gre0u3myTlShTJMO9x9fVlwNTfKHxMA2kI3CT27Y=; b=SzsxGri49evVRkK6HR9AnbInBxdntBoTLg7OB0/HfWa4Tgu8V/+1rpd7faQdVM7fXH aDkYiP+E7pWv6VNqxgV4W1EV9TaNsvbrdFPKaHtHtGBxQ/Y66mKOJMxvL8FUBXvt38Zh dbiFz3ED4RMyQb6P5C5BYwD5yCNGN7sU6Ov4I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=nLsFLlF/FxiqdW92DFjlV8UV7fd6lrcOWf8/GuxYid0VAboP5nIcuz6hH0ASiNf4oi L08wy0k5NsY0nRs3CGLnPNSB+Lu+HOLPxatL489G2x00vsViXjnhdt63pmmhGcHP5uF5 4lrb2SiG0BKlZOTIw624KJy0Lk1dCQ/Tk6Org= Received: by 10.231.159.146 with SMTP id j18mr3481005ibx.77.1289725560473; Sun, 14 Nov 2010 01:06:00 -0800 (PST) Received: from localhost.localdomain ([221.239.34.230]) by mx.google.com with ESMTPS id 8sm5970945iba.22.2010.11.14.01.05.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 14 Nov 2010 01:05:59 -0800 (PST) From: Changli Gao To: Patrick McHardy Cc: "David S. Miller" , netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, Changli Gao Subject: [PATCH] netfilter: don't use atomic bit operation Date: Sun, 14 Nov 2010 17:05:34 +0800 Message-Id: <1289725534-8439-1-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org As we own ct, and the others can't see it until we confirm it, we don't need to use atomic bit operation on ct->status. Signed-off-by: Changli Gao --- include/net/netfilter/nf_nat_core.h | 4 ++-- net/ipv4/netfilter/nf_nat_core.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h index 33602ab..52ac1d8 100644 --- a/include/net/netfilter/nf_nat_core.h +++ b/include/net/netfilter/nf_nat_core.h @@ -21,9 +21,9 @@ static inline int nf_nat_initialized(struct nf_conn *ct, enum nf_nat_manip_type manip) { if (manip == IP_NAT_MANIP_SRC) - return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status); + return IPS_SRC_NAT_DONE_BIT & ct->status; else - return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status); + return IPS_DST_NAT_DONE_BIT & ct->status; } struct nlattr; diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index c04787c..ab877ac 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c @@ -323,9 +323,9 @@ nf_nat_setup_info(struct nf_conn *ct, /* It's done. */ if (maniptype == IP_NAT_MANIP_DST) - set_bit(IPS_DST_NAT_DONE_BIT, &ct->status); + ct->status |= IPS_DST_NAT_DONE_BIT; else - set_bit(IPS_SRC_NAT_DONE_BIT, &ct->status); + ct->status |= IPS_SRC_NAT_DONE_BIT; return NF_ACCEPT; }