packet: use macro GET_PBDQC_FROM_RB to simplify the codes
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
92d4ea6e41
commit
22781a5b9c
|
@ -437,7 +437,8 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po,
|
||||||
{
|
{
|
||||||
struct tpacket_kbdq_core *pkc;
|
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_bh(&rb_queue->lock);
|
spin_lock_bh(&rb_queue->lock);
|
||||||
pkc->delete_blk_timer = 1;
|
pkc->delete_blk_timer = 1;
|
||||||
|
@ -463,7 +464,8 @@ static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring)
|
||||||
if (tx_ring)
|
if (tx_ring)
|
||||||
BUG();
|
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_PBDQC_FROM_RB(&po->rx_ring);
|
||||||
prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
|
prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +523,7 @@ static void init_prb_bdqc(struct packet_sock *po,
|
||||||
struct pgv *pg_vec,
|
struct pgv *pg_vec,
|
||||||
union tpacket_req_u *req_u, int tx_ring)
|
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;
|
struct tpacket_block_desc *pbd;
|
||||||
|
|
||||||
memset(p1, 0x0, sizeof(*p1));
|
memset(p1, 0x0, sizeof(*p1));
|
||||||
|
@ -585,7 +587,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)
|
static void prb_retire_rx_blk_timer_expired(unsigned long data)
|
||||||
{
|
{
|
||||||
struct packet_sock *po = (struct packet_sock *)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;
|
unsigned int frozen;
|
||||||
struct tpacket_block_desc *pbd;
|
struct tpacket_block_desc *pbd;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue