* [NETFILTER]: xt_hashlimit: remove unneeded struct member
@ 2008-01-29 18:03 Jan Engelhardt
2008-01-29 18:09 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2008-01-29 18:03 UTC (permalink / raw)
To: kaber; +Cc: Netfilter Developer Mailing List
commit 9cd6d44dfc02166640166a44c27c3dc0a98b4ac3
Author: Jan Engelhardt <jengelh@computergmbh.de>
Date: Tue Jan 29 16:30:58 2008 +0100
[NETFILTER]: xt_hashlimit: remove unneeded struct member
By allocating ->hinfo, we already have the needed indirection to cope
with the per-cpu xtables struct match_entry.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index 58b818e..51b18d8 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -61,7 +61,6 @@ struct xt_hashlimit_mtinfo1 {
/* Used internally by the kernel */
struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
- struct xt_hashlimit_mtinfo1 *master __attribute__((aligned(8)));
};
#endif /*_XT_HASHLIMIT_H*/
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 71572f9..d685ec4 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -772,9 +772,6 @@ hashlimit_mt_check(const char *tablename, const void *inf,
return false;
}
mutex_unlock(&hlimit_mutex);
-
- /* Ugly hack: For SMP, we only want to use one set */
- info->master = info;
return true;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [NETFILTER]: xt_hashlimit: remove unneeded struct member
2008-01-29 18:03 [NETFILTER]: xt_hashlimit: remove unneeded struct member Jan Engelhardt
@ 2008-01-29 18:09 ` Patrick McHardy
2008-01-29 18:20 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2008-01-29 18:09 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Netfilter Developer Mailing List
Jan Engelhardt wrote:
> commit 9cd6d44dfc02166640166a44c27c3dc0a98b4ac3
> Author: Jan Engelhardt <jengelh@computergmbh.de>
> Date: Tue Jan 29 16:30:58 2008 +0100
>
> [NETFILTER]: xt_hashlimit: remove unneeded struct member
>
> By allocating ->hinfo, we already have the needed indirection to cope
> with the per-cpu xtables struct match_entry.
You already sent this 30 minutes ago. This is not helping me
getting rid of my backlog ...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [NETFILTER]: xt_hashlimit: remove unneeded struct member
2008-01-29 18:09 ` Patrick McHardy
@ 2008-01-29 18:20 ` Jan Engelhardt
2008-01-29 18:30 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2008-01-29 18:20 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Netfilter Developer Mailing List
On Jan 29 2008 19:09, Patrick McHardy wrote:
> Jan Engelhardt wrote:
>> commit 9cd6d44dfc02166640166a44c27c3dc0a98b4ac3
>> Author: Jan Engelhardt <jengelh@computergmbh.de>
>> Date: Tue Jan 29 16:30:58 2008 +0100
>>
>> [NETFILTER]: xt_hashlimit: remove unneeded struct member
>>
>> By allocating ->hinfo, we already have the needed indirection to cope
>> with the per-cpu xtables struct match_entry.
>
>
> You already sent this 30 minutes ago. This is not helping me
> getting rid of my backlog ...
>
Oops, was just a glitch in the matrix here I guess :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: remove unneeded struct member
2008-01-29 18:20 ` Jan Engelhardt
@ 2008-01-29 18:30 ` Jan Engelhardt
0 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2008-01-29 18:30 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Netfilter Developer Mailing List
On Jan 29 2008 19:20, Jan Engelhardt wrote:
>On Jan 29 2008 19:09, Patrick McHardy wrote:
>> Jan Engelhardt wrote:
>>> commit 9cd6d44dfc02166640166a44c27c3dc0a98b4ac3
>>> Author: Jan Engelhardt <jengelh@computergmbh.de>
>>> Date: Tue Jan 29 16:30:58 2008 +0100
>>>
>>> [NETFILTER]: xt_hashlimit: remove unneeded struct member
>>>
>>> By allocating ->hinfo, we already have the needed indirection to cope
>>> with the per-cpu xtables struct match_entry.
>>
>>
>> You already sent this 30 minutes ago. This is not helping me
>> getting rid of my backlog ...
There was a bug in it (extra ";") - git diff just showed me
I had uncommited stuff (need to get used to it first)
@@ -75,7 +75,7 @@ __sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned
i
}
#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
- __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap));
+ __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
static inline bool
__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
{
===Full corrected patch===
commit 0000000000000000000000000000000000000000
Author: Jan Engelhardt <jengelh@computergmbh.de>
Date: Tue Jan 29 16:53:31 2008 +0100
[NETFILTER]: xt_sctp: simplify xt_sctp.h
The use of xt_sctp.h flagged up -Wshadow warnings in userspace, which
prompted me to look at it and clean it up. Basic operations have been
directly replaced by library calls (memcpy, memset is both available
in the kernel and userspace, and usually faster than a self-made
loop). The is_set and is_clear functions now use a processing time
shortcut, too.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index dd5a4fd..3d7e724 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -37,68 +37,54 @@ struct xt_sctp_info {
#define SCTP_CHUNKMAP_SET(chunkmap, type) \
do { \
- chunkmap[type / bytes(u_int32_t)] |= \
+ (chunkmap)[type / bytes(u_int32_t)] |= \
1 << (type % bytes(u_int32_t)); \
} while (0)
#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
do { \
- chunkmap[type / bytes(u_int32_t)] &= \
+ (chunkmap)[type / bytes(u_int32_t)] &= \
~(1 << (type % bytes(u_int32_t))); \
} while (0)
#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
({ \
- (chunkmap[type / bytes (u_int32_t)] & \
+ ((chunkmap)[type / bytes (u_int32_t)] & \
(1 << (type % bytes (u_int32_t)))) ? 1: 0; \
})
-#define SCTP_CHUNKMAP_RESET(chunkmap) \
- do { \
- int i; \
- for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
- chunkmap[i] = 0; \
- } while (0)
-
-#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
- do { \
- int i; \
- for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
- chunkmap[i] = ~0; \
- } while (0)
-
-#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
- do { \
- int i; \
- for (i = 0; i < ARRAY_SIZE(srcmap); i++) \
- destmap[i] = srcmap[i]; \
- } while (0)
-
-#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
-({ \
- int i; \
- int flag = 1; \
- for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
- if (chunkmap[i]) { \
- flag = 0; \
- break; \
- } \
- } \
- flag; \
-})
-
-#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
-({ \
- int i; \
- int flag = 1; \
- for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
- if (chunkmap[i] != ~0) { \
- flag = 0; \
- break; \
- } \
- } \
- flag; \
-})
+#define SCTP_CHUNKMAP_RESET(chunkmap) \
+ memset((chunkmap), 0, sizeof(chunkmap))
+
+#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
+ memset((chunkmap), ~0U, sizeof(chunkmap))
+
+#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
+ memcpy((destmap), (srcmap), sizeof(srcmap))
+
+#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
+ __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
+static inline bool
+__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
+{
+ unsigned int i;
+ for (i = 0; i < n; ++i)
+ if (chunkmap[i])
+ return false;
+ return true;
+}
+
+#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
+ __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
+static inline bool
+__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
+{
+ unsigned int i;
+ for (i = 0; i < n; ++i)
+ if (chunkmap[i] != ~0U)
+ return false;
+ return true;
+}
#endif /* _XT_SCTP_H_ */
>>
>Oops, was just a glitch in the matrix here I guess :)
>-
>To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [NETFILTER]: xt_hashlimit: remove unneeded struct member
@ 2008-01-29 17:26 Jan Engelhardt
0 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2008-01-29 17:26 UTC (permalink / raw)
To: kaber; +Cc: Netfilter Developer Mailing List
commit 9cd6d44dfc02166640166a44c27c3dc0a98b4ac3
Author: Jan Engelhardt <jengelh@computergmbh.de>
Date: Tue Jan 29 16:30:58 2008 +0100
[NETFILTER]: xt_hashlimit: remove unneeded struct member
By allocating ->hinfo, we already have the needed indirection to cope
with the per-cpu xtables struct match_entry.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index 58b818e..51b18d8 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -61,7 +61,6 @@ struct xt_hashlimit_mtinfo1 {
/* Used internally by the kernel */
struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
- struct xt_hashlimit_mtinfo1 *master __attribute__((aligned(8)));
};
#endif /*_XT_HASHLIMIT_H*/
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 71572f9..d685ec4 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -772,9 +772,6 @@ hashlimit_mt_check(const char *tablename, const void *inf,
return false;
}
mutex_unlock(&hlimit_mutex);
-
- /* Ugly hack: For SMP, we only want to use one set */
- info->master = info;
return true;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-29 18:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-29 18:03 [NETFILTER]: xt_hashlimit: remove unneeded struct member Jan Engelhardt
2008-01-29 18:09 ` Patrick McHardy
2008-01-29 18:20 ` Jan Engelhardt
2008-01-29 18:30 ` Jan Engelhardt
-- strict thread matches above, loose matches on Subject: below --
2008-01-29 17:26 [NETFILTER]: xt_hashlimit: " Jan Engelhardt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.