You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
net-tc: convert tc_verd to integer bitfields
Extract the remaining two fields from tc_verd and remove the __u16 completely. TC_AT and TC_FROM are converted to equivalent two-bit integer fields tc_at and tc_from. Where possible, use existing helper skb_at_tc_ingress when reading tc_at. Introduce helper skb_reset_tc to clear fields. Not documenting tc_from and tc_at, because they will be replaced with single bit fields in follow-on patches. Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e7246e122a
commit
a5135bcfba
+4
-6
@@ -3153,7 +3153,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
|
||||
if (!cl)
|
||||
return skb;
|
||||
|
||||
/* skb->tc_verd and qdisc_skb_cb(skb)->pkt_len were already set
|
||||
/* skb->tc_at and qdisc_skb_cb(skb)->pkt_len were already set
|
||||
* earlier by the caller.
|
||||
*/
|
||||
qdisc_bstats_cpu_update(cl->q, skb);
|
||||
@@ -3320,7 +3320,7 @@ static int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv)
|
||||
|
||||
qdisc_pkt_len_init(skb);
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS);
|
||||
skb->tc_at = AT_EGRESS;
|
||||
# ifdef CONFIG_NET_EGRESS
|
||||
if (static_key_false(&egress_needed)) {
|
||||
skb = sch_handle_egress(skb, &rc, dev);
|
||||
@@ -3920,7 +3920,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
|
||||
}
|
||||
|
||||
qdisc_skb_cb(skb)->pkt_len = skb->len;
|
||||
skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
|
||||
skb->tc_at = AT_INGRESS;
|
||||
qdisc_bstats_cpu_update(cl->q, skb);
|
||||
|
||||
switch (tc_classify(skb, cl, &cl_res, false)) {
|
||||
@@ -4122,9 +4122,7 @@ skip_taps:
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
skb->tc_verd = 0;
|
||||
#endif
|
||||
skb_reset_tc(skb);
|
||||
skip_classify:
|
||||
if (pfmemalloc && !skb_pfmemalloc_protocol(skb))
|
||||
goto drop;
|
||||
|
||||
+1
-3
@@ -3439,9 +3439,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
|
||||
/* skb was 'freed' by stack, so clean few
|
||||
* bits and reuse it
|
||||
*/
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
skb->tc_verd = 0; /* reset reclass/redir ttl */
|
||||
#endif
|
||||
skb_reset_tc(skb);
|
||||
} while (--burst > 0);
|
||||
goto out; /* Skips xmit_mode M_START_XMIT */
|
||||
} else if (pkt_dev->xmit_mode == M_QUEUE_XMIT) {
|
||||
|
||||
@@ -878,9 +878,6 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
|
||||
#endif
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
CHECK_SKB_FIELD(tc_index);
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
CHECK_SKB_FIELD(tc_verd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
+3
-4
@@ -736,12 +736,11 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
|
||||
u16 metalen = ife_get_sz(skb, ife);
|
||||
int hdrm = metalen + skb->dev->hard_header_len + IFE_METAHDRLEN;
|
||||
unsigned int skboff = skb->dev->hard_header_len;
|
||||
u32 at = G_TC_AT(skb->tc_verd);
|
||||
int new_len = skb->len + hdrm;
|
||||
bool exceed_mtu = false;
|
||||
int err;
|
||||
|
||||
if (at & AT_EGRESS) {
|
||||
if (!skb_at_tc_ingress(skb)) {
|
||||
if (new_len > skb->dev->mtu)
|
||||
exceed_mtu = true;
|
||||
}
|
||||
@@ -773,7 +772,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
|
||||
return TC_ACT_SHOT;
|
||||
}
|
||||
|
||||
if (!(at & AT_EGRESS))
|
||||
if (skb_at_tc_ingress(skb))
|
||||
skb_push(skb, skb->dev->hard_header_len);
|
||||
|
||||
iethh = (struct ethhdr *)skb->data;
|
||||
@@ -816,7 +815,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
|
||||
ether_addr_copy(oethh->h_dest, iethh->h_dest);
|
||||
oethh->h_proto = htons(ife->eth_type);
|
||||
|
||||
if (!(at & AT_EGRESS))
|
||||
if (skb_at_tc_ingress(skb))
|
||||
skb_pull(skb, skb->dev->hard_header_len);
|
||||
|
||||
spin_unlock(&ife->tcf_lock);
|
||||
|
||||
@@ -170,7 +170,6 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
|
||||
int retval, err = 0;
|
||||
int m_eaction;
|
||||
int mac_len;
|
||||
u32 at;
|
||||
|
||||
tcf_lastuse_update(&m->tcf_tm);
|
||||
bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb);
|
||||
@@ -191,7 +190,6 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
|
||||
goto out;
|
||||
}
|
||||
|
||||
at = G_TC_AT(skb->tc_verd);
|
||||
skb2 = skb_clone(skb, GFP_ATOMIC);
|
||||
if (!skb2)
|
||||
goto out;
|
||||
@@ -200,8 +198,9 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
|
||||
* and devices expect a mac header on xmit, then mac push/pull is
|
||||
* needed.
|
||||
*/
|
||||
if (at != tcf_mirred_act_direction(m_eaction) && m_mac_header_xmit) {
|
||||
if (at & AT_EGRESS) {
|
||||
if (skb->tc_at != tcf_mirred_act_direction(m_eaction) &&
|
||||
m_mac_header_xmit) {
|
||||
if (!skb_at_tc_ingress(skb)) {
|
||||
/* caught at egress, act ingress: pull mac */
|
||||
mac_len = skb_network_header(skb) - skb_mac_header(skb);
|
||||
skb_pull_rcsum(skb2, mac_len);
|
||||
@@ -213,7 +212,7 @@ static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
|
||||
|
||||
/* mirror is always swallowed */
|
||||
if (tcf_mirred_is_act_redirect(m_eaction))
|
||||
skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
|
||||
skb2->tc_from = skb2->tc_at;
|
||||
|
||||
skb2->skb_iif = skb->dev->ifindex;
|
||||
skb2->dev = dev;
|
||||
|
||||
@@ -626,7 +626,7 @@ deliver:
|
||||
* If it's at ingress let's pretend the delay is
|
||||
* from the network (tstamp will be updated).
|
||||
*/
|
||||
if (G_TC_FROM(skb->tc_verd) & AT_INGRESS)
|
||||
if (skb->tc_from & AT_INGRESS)
|
||||
skb->tstamp = 0;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user