diff mbox

[net-next,2/3] net: packet: use reciprocal_divide in fanout_demux_hash

Message ID 1377720791-15844-3-git-send-email-dborkman@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Daniel Borkmann Aug. 28, 2013, 8:13 p.m. UTC
Instead of hard-coding reciprocal_divide function, use the inline
function from reciprocal_div.h.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 net/packet/af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cong Wang Aug. 29, 2013, 1:47 a.m. UTC | #1
On Wed, 28 Aug 2013 at 20:13 GMT, Daniel Borkmann <dborkman@redhat.com> wrote:
> Instead of hard-coding reciprocal_divide function, use the inline
> function from reciprocal_div.h.
>

Then you should #include <linux/reciprocal_div.h> directly?

--
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 mbox

Patch

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 91596f5..130e2ea 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1135,7 +1135,7 @@  static unsigned int fanout_demux_hash(struct packet_fanout *f,
 				      struct sk_buff *skb,
 				      unsigned int num)
 {
-	return (((u64)skb->rxhash) * num) >> 32;
+	return reciprocal_divide(skb->rxhash, num);
 }
 
 static unsigned int fanout_demux_lb(struct packet_fanout *f,