Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cxgb4: Rename sched_class to avoid type clash

drivers/net/ethernet/chelsio/cxgb4/sched.h declares a sched_class
struct which has a type name clash with struct sched_class
in kernel/sched/sched.h (a type used in a field in task_struct).

When cxgb4 is a builtin we end up with both sched_class types,
and as a result of this we wind up with DWARF (and derived from
that BTF) with a duplicate incorrect task_struct representation.
When cxgb4 is built-in this type clash can cause kernel builds to
fail as resolve_btfids will fail when confused which task_struct
to use. See [1] for more details.

As such, renaming sched_class to ch_sched_class (in line with
other structs like ch_sched_flowc) makes sense.

[1] https://lore.kernel.org/bpf/2412725b-916c-47bd-91c3-c2d57e3e6c7b@acm.org/

Reported-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Potnuri Bharat Teja <bharat@chelsio.com>
Link: https://patch.msgid.link/20251121181231.64337-1-alan.maguire@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alan Maguire and committed by
Jakub Kicinski
380d19db d6eea004

+32 -32
+1 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
··· 3485 3485 struct adapter *adap = pi->adapter; 3486 3486 struct ch_sched_queue qe = { 0 }; 3487 3487 struct ch_sched_params p = { 0 }; 3488 - struct sched_class *e; 3488 + struct ch_sched_class *e; 3489 3489 u32 req_rate; 3490 3490 int err = 0; 3491 3491
+2 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c
··· 56 56 struct port_info *pi = netdev2pinfo(dev); 57 57 struct flow_action_entry *entry; 58 58 struct ch_sched_queue qe; 59 - struct sched_class *e; 59 + struct ch_sched_class *e; 60 60 u64 max_link_rate; 61 61 u32 i, speed; 62 62 int ret; ··· 180 180 struct port_info *pi = netdev2pinfo(dev); 181 181 struct adapter *adap = netdev2adap(dev); 182 182 struct flow_action_entry *entry; 183 - struct sched_class *e; 183 + struct ch_sched_class *e; 184 184 int ret; 185 185 u32 i; 186 186
+1 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c
··· 330 330 struct cxgb4_tc_port_mqprio *tc_port_mqprio; 331 331 struct port_info *pi = netdev2pinfo(dev); 332 332 struct adapter *adap = netdev2adap(dev); 333 - struct sched_class *e; 333 + struct ch_sched_class *e; 334 334 int ret; 335 335 u8 i; 336 336
+22 -22
drivers/net/ethernet/chelsio/cxgb4/sched.c
··· 44 44 { 45 45 struct adapter *adap = pi->adapter; 46 46 struct sched_table *s = pi->sched_tbl; 47 - struct sched_class *e; 47 + struct ch_sched_class *e; 48 48 int err = 0; 49 49 50 50 e = &s->tab[p->u.params.class]; ··· 122 122 const u32 val) 123 123 { 124 124 struct sched_table *s = pi->sched_tbl; 125 - struct sched_class *e, *end; 125 + struct ch_sched_class *e, *end; 126 126 void *found = NULL; 127 127 128 128 /* Look for an entry with matching @val */ ··· 166 166 return found; 167 167 } 168 168 169 - struct sched_class *cxgb4_sched_queue_lookup(struct net_device *dev, 170 - struct ch_sched_queue *p) 169 + struct ch_sched_class *cxgb4_sched_queue_lookup(struct net_device *dev, 170 + struct ch_sched_queue *p) 171 171 { 172 172 struct port_info *pi = netdev2pinfo(dev); 173 173 struct sched_queue_entry *qe = NULL; ··· 187 187 struct sched_queue_entry *qe = NULL; 188 188 struct adapter *adap = pi->adapter; 189 189 struct sge_eth_txq *txq; 190 - struct sched_class *e; 190 + struct ch_sched_class *e; 191 191 int err = 0; 192 192 193 193 if (p->queue < 0 || p->queue >= pi->nqsets) ··· 218 218 struct sched_queue_entry *qe = NULL; 219 219 struct adapter *adap = pi->adapter; 220 220 struct sge_eth_txq *txq; 221 - struct sched_class *e; 221 + struct ch_sched_class *e; 222 222 unsigned int qid; 223 223 int err = 0; 224 224 ··· 260 260 { 261 261 struct sched_flowc_entry *fe = NULL; 262 262 struct adapter *adap = pi->adapter; 263 - struct sched_class *e; 263 + struct ch_sched_class *e; 264 264 int err = 0; 265 265 266 266 if (p->tid < 0 || p->tid >= adap->tids.neotids) ··· 288 288 struct sched_table *s = pi->sched_tbl; 289 289 struct sched_flowc_entry *fe = NULL; 290 290 struct adapter *adap = pi->adapter; 291 - struct sched_class *e; 291 + struct ch_sched_class *e; 292 292 int err = 0; 293 293 294 294 if (p->tid < 0 || p->tid >= adap->tids.neotids) ··· 322 322 } 323 323 324 324 static void t4_sched_class_unbind_all(struct port_info *pi, 325 - struct sched_class *e, 325 + struct ch_sched_class *e, 326 326 enum sched_bind_type type) 327 327 { 328 328 if (!e) ··· 476 476 } 477 477 478 478 /* If @p is NULL, fetch any available unused class */ 479 - static struct sched_class *t4_sched_class_lookup(struct port_info *pi, 480 - const struct ch_sched_params *p) 479 + static struct ch_sched_class *t4_sched_class_lookup(struct port_info *pi, 480 + const struct ch_sched_params *p) 481 481 { 482 482 struct sched_table *s = pi->sched_tbl; 483 - struct sched_class *found = NULL; 484 - struct sched_class *e, *end; 483 + struct ch_sched_class *found = NULL; 484 + struct ch_sched_class *e, *end; 485 485 486 486 if (!p) { 487 487 /* Get any available unused class */ ··· 522 522 return found; 523 523 } 524 524 525 - static struct sched_class *t4_sched_class_alloc(struct port_info *pi, 526 - struct ch_sched_params *p) 525 + static struct ch_sched_class *t4_sched_class_alloc(struct port_info *pi, 526 + struct ch_sched_params *p) 527 527 { 528 - struct sched_class *e = NULL; 528 + struct ch_sched_class *e = NULL; 529 529 u8 class_id; 530 530 int err; 531 531 ··· 579 579 * scheduling class with matching @p is found, then the matching class is 580 580 * returned. 581 581 */ 582 - struct sched_class *cxgb4_sched_class_alloc(struct net_device *dev, 583 - struct ch_sched_params *p) 582 + struct ch_sched_class *cxgb4_sched_class_alloc(struct net_device *dev, 583 + struct ch_sched_params *p) 584 584 { 585 585 struct port_info *pi = netdev2pinfo(dev); 586 586 u8 class_id; ··· 607 607 struct port_info *pi = netdev2pinfo(dev); 608 608 struct sched_table *s = pi->sched_tbl; 609 609 struct ch_sched_params p; 610 - struct sched_class *e; 610 + struct ch_sched_class *e; 611 611 u32 speed; 612 612 int ret; 613 613 ··· 640 640 } 641 641 } 642 642 643 - static void t4_sched_class_free(struct net_device *dev, struct sched_class *e) 643 + static void t4_sched_class_free(struct net_device *dev, struct ch_sched_class *e) 644 644 { 645 645 struct port_info *pi = netdev2pinfo(dev); 646 646 ··· 660 660 s->sched_size = sched_size; 661 661 662 662 for (i = 0; i < s->sched_size; i++) { 663 - memset(&s->tab[i], 0, sizeof(struct sched_class)); 663 + memset(&s->tab[i], 0, sizeof(struct ch_sched_class)); 664 664 s->tab[i].idx = i; 665 665 s->tab[i].state = SCHED_STATE_UNUSED; 666 666 INIT_LIST_HEAD(&s->tab[i].entry_list); ··· 682 682 continue; 683 683 684 684 for (i = 0; i < s->sched_size; i++) { 685 - struct sched_class *e; 685 + struct ch_sched_class *e; 686 686 687 687 e = &s->tab[i]; 688 688 if (e->state == SCHED_STATE_ACTIVE)
+6 -6
drivers/net/ethernet/chelsio/cxgb4/sched.h
··· 71 71 struct ch_sched_flowc param; 72 72 }; 73 73 74 - struct sched_class { 74 + struct ch_sched_class { 75 75 u8 state; 76 76 u8 idx; 77 77 struct ch_sched_params info; ··· 82 82 83 83 struct sched_table { /* per port scheduling table */ 84 84 u8 sched_size; 85 - struct sched_class tab[] __counted_by(sched_size); 85 + struct ch_sched_class tab[] __counted_by(sched_size); 86 86 }; 87 87 88 88 static inline bool can_sched(struct net_device *dev) ··· 103 103 return true; 104 104 } 105 105 106 - struct sched_class *cxgb4_sched_queue_lookup(struct net_device *dev, 107 - struct ch_sched_queue *p); 106 + struct ch_sched_class *cxgb4_sched_queue_lookup(struct net_device *dev, 107 + struct ch_sched_queue *p); 108 108 int cxgb4_sched_class_bind(struct net_device *dev, void *arg, 109 109 enum sched_bind_type type); 110 110 int cxgb4_sched_class_unbind(struct net_device *dev, void *arg, 111 111 enum sched_bind_type type); 112 112 113 - struct sched_class *cxgb4_sched_class_alloc(struct net_device *dev, 114 - struct ch_sched_params *p); 113 + struct ch_sched_class *cxgb4_sched_class_alloc(struct net_device *dev, 114 + struct ch_sched_params *p); 115 115 void cxgb4_sched_class_free(struct net_device *dev, u8 classid); 116 116 117 117 struct sched_table *t4_init_sched(unsigned int size);