milan-avb: mrp: set vector lva bit on outgoing LeaveAll frames

This commit is contained in:
hackerman-kl 2026-04-25 12:54:11 +02:00 committed by Wim Taymans
parent 5c9a06c03d
commit df62776308
4 changed files with 18 additions and 4 deletions

View file

@ -55,6 +55,10 @@ struct mrp {
uint64_t periodic_timeout;
struct fsm_leave_all_timer lva_timer;
uint64_t join_timeout;
/* IEEE 802.1Q-2014 Section 10.7.6.3 lva bit: true while the next outgoing
* vector header must carry lva=1 (local LeaveAll being transmitted). */
bool lva_tx_pending;
};
static void mrp_destroy(void *data)
@ -107,6 +111,7 @@ static void mrp_periodic(void *data, uint64_t now)
/* 802.1Q-2014 Table 10-5 */
mrp->lva_timer.state = FSM_LVA_ACTIVE;
if (mrp->lva_timer.leave_all_timeout > 0) {
mrp->lva_tx_pending = true;
global_event(mrp, now, AVB_MRP_EVENT_RX_LVA);
leave_all = true;
}
@ -118,6 +123,7 @@ static void mrp_periodic(void *data, uint64_t now)
global_event(mrp, now, event);
}
mrp->join_timeout = now + MRP_JOINTIMER_MS * SPA_NSEC_PER_MSEC;
mrp->lva_tx_pending = false;
}
spa_list_for_each(a, &mrp->attributes, link) {
@ -739,6 +745,11 @@ void avb_mrp_attribute_leave(struct avb_mrp_attribute *attr, uint64_t now)
a->joined = false;
}
bool avb_mrp_lva_tx_pending(const struct avb_mrp *m)
{
return ((const struct mrp *)m)->lva_tx_pending;
}
void avb_mrp_destroy(struct avb_mrp *mrp)
{
mrp_destroy(mrp);

View file

@ -137,6 +137,9 @@ void avb_mrp_attribute_add_listener(struct avb_mrp_attribute *attr, struct spa_h
uint8_t avb_mrp_attribute_get_applicant_state(const struct avb_mrp_attribute *attr);
uint8_t avb_mrp_attribute_get_registrar_state(const struct avb_mrp_attribute *attr);
/* IEEE 802.1Q-2014 Section 10.7.6.3: lva bit must be 1 while transmitting our LVA. */
bool avb_mrp_lva_tx_pending(const struct avb_mrp *m);
struct avb_mrp_parse_info {
#define AVB_VERSION_MRP_PARSE_INFO 0
uint32_t version;

View file

@ -124,7 +124,7 @@ static int encode_talker(struct msrp *msrp, struct attr *a, void *m)
msg->attribute_list_length = htons(attr_list_length);
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
v->lva = 0;
v->lva = avb_mrp_lva_tx_pending(msrp->server->mrp) ? 1 : 0;
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
t = (struct avb_packet_msrp_talker *)v->first_value;
@ -244,7 +244,7 @@ static int encode_listener(struct msrp *msrp, struct attr *a, void *m)
msg->attribute_list_length = htons(attr_list_length);
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
v->lva = 0;
v->lva = avb_mrp_lva_tx_pending(msrp->server->mrp) ? 1 : 0;
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
l = (struct avb_packet_msrp_listener *)v->first_value;
@ -325,7 +325,7 @@ static int encode_domain(struct msrp *msrp, struct attr *a, void *m)
msg->attribute_list_length = htons(attr_list_length);
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
v->lva = 0;
v->lva = avb_mrp_lva_tx_pending(msrp->server->mrp) ? 1 : 0;
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
d = (struct avb_packet_msrp_domain *)v->first_value;

View file

@ -77,7 +77,7 @@ static int encode_vid(struct mvrp *mvrp, struct attr *a, void *m)
msg->attribute_length = sizeof(*d);
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
v->lva = 0;
v->lva = avb_mrp_lva_tx_pending(mvrp->server->mrp) ? 1 : 0;
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
d = (struct avb_packet_mvrp_vid *)v->first_value;