@@ -140,6 +140,16 @@ int BaseCube::get_table_fd(const std::string &table_name, int index,
140140 }
141141}
142142
143+ const ebpf::TableDesc &BaseCube::get_table_desc (const std::string &table_name,
144+ int index, ProgramType type) {
145+ switch (type) {
146+ case ProgramType::INGRESS:
147+ return ingress_programs_[index]->get_table (table_name).getTableDescription ();
148+ case ProgramType::EGRESS:
149+ return egress_programs_[index]->get_table (table_name).getTableDescription ();
150+ }
151+ }
152+
143153void BaseCube::reload (const std::string &code, int index, ProgramType type) {
144154 std::lock_guard<std::mutex> cube_guard (cube_mutex_);
145155 return do_reload (code, index, type);
@@ -422,9 +432,10 @@ enum {
422432};
423433
424434struct pkt_metadata {
425- u16 cube_id; //__attribute__((deprecated)) // use CUBE_ID instead
426- u16 in_port; // The interface on which a packet was received.
427- u32 packet_len; //__attribute__((deprecated)) // Use ctx->len
435+ u16 cube_id; //__attribute__((deprecated)) // use CUBE_ID instead
436+ u16 in_port; // The interface on which a packet was received.
437+ u32 packet_len; //__attribute__((deprecated)) // Use ctx->len
438+ u32 traffic_class; // The traffic class the packet belongs to
428439
429440 // used to send data to controller
430441 u16 reason;
@@ -457,11 +468,19 @@ void call_ingress_program(struct CTXTYPE *skb, int index) {
457468 ingress_programs.call(skb, index);
458469}
459470
471+ static __always_inline
472+ void call_ingress_program_with_metadata(struct CTXTYPE *skb,
473+ struct pkt_metadata *md, int index);
474+
460475static __always_inline
461476void call_egress_program(struct CTXTYPE *skb, int index) {
462477 egress_programs.call(skb, index);
463478}
464479
480+ static __always_inline
481+ void call_egress_program_with_metadata(struct CTXTYPE *skb,
482+ struct pkt_metadata *md, int index);
483+
465484/* checksum related */
466485
467486// those functions have different implementations for XDP and TC
0 commit comments