Skip to content

Commit

Permalink
hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API
Browse files Browse the repository at this point in the history
Switch the fsl_etsec code away from bottom-half based ptimers to
the new transaction-based ptimer API.  This just requires adding
begin/commit calls around the various places that modify the ptimer
state, and using the new ptimer_init() function to create the timer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20191017132122.4402-2-peter.maydell@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Oct 24, 2019
1 parent e979972 commit 383a675
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions hw/net/fsl_etsec/etsec.c
Expand Up @@ -34,7 +34,6 @@
#include "etsec.h"
#include "registers.h"
#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"

/* #define HEX_DUMP */
Expand Down Expand Up @@ -195,9 +194,11 @@ static void write_dmactrl(eTSEC *etsec,

if (!(value & DMACTRL_WOP)) {
/* Start polling */
ptimer_transaction_begin(etsec->ptimer);
ptimer_stop(etsec->ptimer);
ptimer_set_count(etsec->ptimer, 1);
ptimer_run(etsec->ptimer, 1);
ptimer_transaction_commit(etsec->ptimer);
}
}

Expand Down Expand Up @@ -391,10 +392,10 @@ static void etsec_realize(DeviceState *dev, Error **errp)
object_get_typename(OBJECT(dev)), dev->id, etsec);
qemu_format_nic_info_str(qemu_get_queue(etsec->nic), etsec->conf.macaddr.a);


etsec->bh = qemu_bh_new(etsec_timer_hit, etsec);
etsec->ptimer = ptimer_init_with_bh(etsec->bh, PTIMER_POLICY_DEFAULT);
etsec->ptimer = ptimer_init(etsec_timer_hit, etsec, PTIMER_POLICY_DEFAULT);
ptimer_transaction_begin(etsec->ptimer);
ptimer_set_freq(etsec->ptimer, 100);
ptimer_transaction_commit(etsec->ptimer);
}

static void etsec_instance_init(Object *obj)
Expand Down
1 change: 0 additions & 1 deletion hw/net/fsl_etsec/etsec.h
Expand Up @@ -141,7 +141,6 @@ typedef struct eTSEC {
uint16_t phy_control;

/* Polling */
QEMUBH *bh;
struct ptimer_state *ptimer;

/* Whether we should flush the rx queue when buffer becomes available. */
Expand Down

0 comments on commit 383a675

Please sign in to comment.