Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bebcda2 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[NET_SCHED]: turn PSCHED_GET_TIME into inline function

parent 03cc45c0
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -48,11 +48,13 @@ typedef long psched_tdiff_t;
#define PSCHED_NS2US(x)			((x) >> 10)

#define PSCHED_TICKS_PER_SEC		PSCHED_NS2US(NSEC_PER_SEC)
#define PSCHED_GET_TIME(stamp) \
	((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get())))

#define PSCHED_PASTPERFECT		0

static inline psched_time_t psched_get_time(void)
{
	return PSCHED_NS2US(ktime_to_ns(ktime_get()));
}

static inline psched_tdiff_t
psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
{
+2 −2
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ static inline int red_is_idling(struct red_parms *p)

static inline void red_start_of_idle_period(struct red_parms *p)
{
	PSCHED_GET_TIME(p->qidlestart);
	p->qidlestart = psched_get_time();
}

static inline void red_end_of_idle_period(struct red_parms *p)
@@ -177,7 +177,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
	long us_idle;
	int  shift;

	PSCHED_GET_TIME(now);
	now = psched_get_time();
	us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);

	/*
+4 −5
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
	if (ret != ACT_P_CREATED)
		return ret;

	PSCHED_GET_TIME(police->tcfp_t_c);
	police->tcfp_t_c = psched_get_time();
	police->tcf_index = parm->index ? parm->index :
		tcf_hash_new_index(&police_idx_gen, &police_hash_info);
	h = tcf_hash(police->tcf_index, POL_TAB_MASK);
@@ -296,8 +296,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
			return police->tcfp_result;
		}

		PSCHED_GET_TIME(now);

		now = psched_get_time();
		toks = psched_tdiff_bounded(now, police->tcfp_t_c,
					    police->tcfp_burst);
		if (police->tcfp_P_tab) {
@@ -495,7 +494,7 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est)
	}
	if (police->tcfp_P_tab)
		police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu);
	PSCHED_GET_TIME(police->tcfp_t_c);
	police->tcfp_t_c = psched_get_time();
	police->tcf_index = parm->index ? parm->index :
		tcf_police_new_index();
	police->tcf_action = parm->action;
@@ -543,7 +542,7 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *police)
			return police->tcfp_result;
		}

		PSCHED_GET_TIME(now);
		now = psched_get_time();
		toks = psched_tdiff_bounded(now, police->tcfp_t_c,
					    police->tcfp_burst);
		if (police->tcfp_P_tab) {
+5 −5
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl)
		psched_time_t now;
		psched_tdiff_t incr;

		PSCHED_GET_TIME(now);
		now = psched_get_time();
		incr = now - q->now_rt;
		now = q->now + incr;

@@ -654,7 +654,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
	psched_tdiff_t delay = 0;
	unsigned pmask;

	PSCHED_GET_TIME(now);
	now = psched_get_time();

	pmask = q->pmask;
	q->pmask = 0;
@@ -1003,7 +1003,7 @@ cbq_dequeue(struct Qdisc *sch)
	psched_time_t now;
	psched_tdiff_t incr;

	PSCHED_GET_TIME(now);
	now = psched_get_time();
	incr = now - q->now_rt;

	if (q->tx_class) {
@@ -1277,7 +1277,7 @@ cbq_reset(struct Qdisc* sch)
	qdisc_watchdog_cancel(&q->watchdog);
	hrtimer_cancel(&q->delay_timer);
	q->toplevel = TC_CBQ_MAXLEVEL;
	PSCHED_GET_TIME(q->now);
	q->now = psched_get_time();
	q->now_rt = q->now;

	for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++)
@@ -1448,7 +1448,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
	hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
	q->delay_timer.function = cbq_undelay;
	q->toplevel = TC_CBQ_MAXLEVEL;
	PSCHED_GET_TIME(q->now);
	q->now = psched_get_time();
	q->now_rt = q->now;

	cbq_link_class(&q->link);
+4 −6
Original line number Diff line number Diff line
@@ -629,9 +629,7 @@ rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y)
static void
init_ed(struct hfsc_class *cl, unsigned int next_len)
{
	u64 cur_time;

	PSCHED_GET_TIME(cur_time);
	u64 cur_time = psched_get_time();

	/* update the deadline curve */
	rtsc_min(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul);
@@ -754,7 +752,7 @@ init_vf(struct hfsc_class *cl, unsigned int len)
			if (cl->cl_flags & HFSC_USC) {
				/* class has upper limit curve */
				if (cur_time == 0)
					PSCHED_GET_TIME(cur_time);
					cur_time = psched_get_time();

				/* update the ulimit curve */
				rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time,
@@ -1038,7 +1036,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
			if (cl->cl_parent == NULL && parentid != TC_H_ROOT)
				return -EINVAL;
		}
		PSCHED_GET_TIME(cur_time);
		cur_time = psched_get_time();

		sch_tree_lock(sch);
		if (rsc != NULL)
@@ -1639,7 +1637,7 @@ hfsc_dequeue(struct Qdisc *sch)
	if ((skb = __skb_dequeue(&q->requeue)))
		goto out;

	PSCHED_GET_TIME(cur_time);
	cur_time = psched_get_time();

	/*
	 * if there are eligible classes, use real-time criteria.
Loading