* packet: use macro GET_PBDQC_FROM_RB to simplify the codes
@ 2013-11-28 9:53 Duan Jiong
2013-11-28 10:27 ` Daniel Borkmann
0 siblings, 1 reply; 4+ messages in thread
From: Duan Jiong @ 2013-11-28 9:53 UTC (permalink / raw)
To: David Miller, dborkman; +Cc: netdev
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
net/packet/af_packet.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 2e8286b..955611f 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -430,7 +430,8 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po,
{
struct tpacket_kbdq_core *pkc;
- pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
+ pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring)
+ : GET_PBDQC_FROM_RB(&po->rx_ring);
spin_lock(&rb_queue->lock);
pkc->delete_blk_timer = 1;
@@ -456,7 +457,8 @@ static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring)
if (tx_ring)
BUG();
- pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
+ pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring)
+ : GET_RBDQC_FROM_RB(&po->rx_ring);
prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
}
@@ -514,7 +516,7 @@ static void init_prb_bdqc(struct packet_sock *po,
struct pgv *pg_vec,
union tpacket_req_u *req_u, int tx_ring)
{
- struct tpacket_kbdq_core *p1 = &rb->prb_bdqc;
+ struct tpacket_kbdq_core *p1 = GET_PBDQC_FROM_RB(rb);
struct tpacket_block_desc *pbd;
memset(p1, 0x0, sizeof(*p1));
@@ -578,7 +580,7 @@ static void _prb_refresh_rx_retire_blk_timer(struct tpacket_kbdq_core *pkc)
static void prb_retire_rx_blk_timer_expired(unsigned long data)
{
struct packet_sock *po = (struct packet_sock *)data;
- struct tpacket_kbdq_core *pkc = &po->rx_ring.prb_bdqc;
+ struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(&po->rx_ring);
unsigned int frozen;
struct tpacket_block_desc *pbd;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: packet: use macro GET_PBDQC_FROM_RB to simplify the codes
2013-11-28 9:53 packet: use macro GET_PBDQC_FROM_RB to simplify the codes Duan Jiong
@ 2013-11-28 10:27 ` Daniel Borkmann
2013-12-02 1:19 ` Duan Jiong
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2013-11-28 10:27 UTC (permalink / raw)
To: Duan Jiong; +Cc: David Miller, netdev
On 11/28/2013 10:53 AM, Duan Jiong wrote:
>
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Please resubmit when net-next is open.
> ---
> net/packet/af_packet.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 2e8286b..955611f 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -430,7 +430,8 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po,
> {
> struct tpacket_kbdq_core *pkc;
>
> - pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
> + pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring)
> + : GET_PBDQC_FROM_RB(&po->rx_ring);
Nit: the colon should actually still be on the previous line.
It would be nice if at some point in time we could get rid of these TPACKET_V3 specific
macros and actually use some inline functions.
>
> spin_lock(&rb_queue->lock);
> pkc->delete_blk_timer = 1;
> @@ -456,7 +457,8 @@ static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring)
> if (tx_ring)
> BUG();
>
> - pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
> + pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring)
> + : GET_RBDQC_FROM_RB(&po->rx_ring);
> prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
> }
>
> @@ -514,7 +516,7 @@ static void init_prb_bdqc(struct packet_sock *po,
> struct pgv *pg_vec,
> union tpacket_req_u *req_u, int tx_ring)
> {
> - struct tpacket_kbdq_core *p1 = &rb->prb_bdqc;
> + struct tpacket_kbdq_core *p1 = GET_PBDQC_FROM_RB(rb);
> struct tpacket_block_desc *pbd;
>
> memset(p1, 0x0, sizeof(*p1));
> @@ -578,7 +580,7 @@ static void _prb_refresh_rx_retire_blk_timer(struct tpacket_kbdq_core *pkc)
> static void prb_retire_rx_blk_timer_expired(unsigned long data)
> {
> struct packet_sock *po = (struct packet_sock *)data;
> - struct tpacket_kbdq_core *pkc = &po->rx_ring.prb_bdqc;
> + struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(&po->rx_ring);
> unsigned int frozen;
> struct tpacket_block_desc *pbd;
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: packet: use macro GET_PBDQC_FROM_RB to simplify the codes
2013-11-28 10:27 ` Daniel Borkmann
@ 2013-12-02 1:19 ` Duan Jiong
2013-12-02 1:32 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Duan Jiong @ 2013-12-02 1:19 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: David Miller, netdev
于 2013年11月28日 18:27, Daniel Borkmann 写道:
> On 11/28/2013 10:53 AM, Duan Jiong wrote:
>>
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>
> Please resubmit when net-next is open.
How can i know when the net-next will be open?
>
>> ---
>> net/packet/af_packet.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>> index 2e8286b..955611f 100644
>> --- a/net/packet/af_packet.c
>> +++ b/net/packet/af_packet.c
>> @@ -430,7 +430,8 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po,
>> {
>> struct tpacket_kbdq_core *pkc;
>>
>> - pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
>> + pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring)
>> + : GET_PBDQC_FROM_RB(&po->rx_ring);
>
> Nit: the colon should actually still be on the previous line.
>
> It would be nice if at some point in time we could get rid of these TPACKET_V3 specific
> macros and actually use some inline functions.
>
>>
>> spin_lock(&rb_queue->lock);
>> pkc->delete_blk_timer = 1;
>> @@ -456,7 +457,8 @@ static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring)
>> if (tx_ring)
>> BUG();
>>
>> - pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc;
>> + pkc = tx_ring ? GET_PBDQC_FROM_RB(&po->tx_ring)
>> + : GET_RBDQC_FROM_RB(&po->rx_ring);
>> prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
>> }
>>
>> @@ -514,7 +516,7 @@ static void init_prb_bdqc(struct packet_sock *po,
>> struct pgv *pg_vec,
>> union tpacket_req_u *req_u, int tx_ring)
>> {
>> - struct tpacket_kbdq_core *p1 = &rb->prb_bdqc;
>> + struct tpacket_kbdq_core *p1 = GET_PBDQC_FROM_RB(rb);
>> struct tpacket_block_desc *pbd;
>>
>> memset(p1, 0x0, sizeof(*p1));
>> @@ -578,7 +580,7 @@ static void _prb_refresh_rx_retire_blk_timer(struct tpacket_kbdq_core *pkc)
>> static void prb_retire_rx_blk_timer_expired(unsigned long data)
>> {
>> struct packet_sock *po = (struct packet_sock *)data;
>> - struct tpacket_kbdq_core *pkc = &po->rx_ring.prb_bdqc;
>> + struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(&po->rx_ring);
>> unsigned int frozen;
>> struct tpacket_block_desc *pbd;
>>
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: packet: use macro GET_PBDQC_FROM_RB to simplify the codes
2013-12-02 1:19 ` Duan Jiong
@ 2013-12-02 1:32 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-12-02 1:32 UTC (permalink / raw)
To: duanj.fnst; +Cc: dborkman, netdev
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Mon, 02 Dec 2013 09:19:51 +0800
> 于 2013年11月28日 18:27, Daniel Borkmann 写道:
>> On 11/28/2013 10:53 AM, Duan Jiong wrote:
>>>
>>>
>>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>>
>> Please resubmit when net-next is open.
>
> How can i know when the net-next will be open?
I announce it explicitly on the netdev list.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-02 1:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-28 9:53 packet: use macro GET_PBDQC_FROM_RB to simplify the codes Duan Jiong
2013-11-28 10:27 ` Daniel Borkmann
2013-12-02 1:19 ` Duan Jiong
2013-12-02 1:32 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).