@@ -60,6 +60,7 @@ static const char * const ethtool_op_strmap[] = {
60
60
[43 ] = "mm-ntf" ,
61
61
[44 ] = "module-fw-flash-ntf" ,
62
62
[ETHTOOL_MSG_PHY_GET ] = "phy-get" ,
63
+ [46 ] = "phy-ntf" ,
63
64
};
64
65
65
66
const char * ethtool_op_str (int op )
@@ -341,6 +342,8 @@ const struct ynl_policy_attr ethtool_bitset_policy[ETHTOOL_A_BITSET_MAX + 1] = {
341
342
[ETHTOOL_A_BITSET_NOMASK ] = { .name = "nomask" , .type = YNL_PT_FLAG , },
342
343
[ETHTOOL_A_BITSET_SIZE ] = { .name = "size" , .type = YNL_PT_U32 , },
343
344
[ETHTOOL_A_BITSET_BITS ] = { .name = "bits" , .type = YNL_PT_NEST , .nest = & ethtool_bitset_bits_nest , },
345
+ [ETHTOOL_A_BITSET_VALUE ] = { .name = "value" , .type = YNL_PT_BINARY ,},
346
+ [ETHTOOL_A_BITSET_MASK ] = { .name = "mask" , .type = YNL_PT_BINARY ,},
344
347
};
345
348
346
349
const struct ynl_policy_nest ethtool_bitset_nest = {
@@ -1598,6 +1601,8 @@ int ethtool_strings_parse(struct ynl_parse_arg *yarg,
1598
1601
void ethtool_bitset_free (struct ethtool_bitset * obj )
1599
1602
{
1600
1603
ethtool_bitset_bits_free (& obj -> bits );
1604
+ free (obj -> value );
1605
+ free (obj -> mask );
1601
1606
}
1602
1607
1603
1608
int ethtool_bitset_put (struct nlmsghdr * nlh , unsigned int attr_type ,
@@ -1612,6 +1617,10 @@ int ethtool_bitset_put(struct nlmsghdr *nlh, unsigned int attr_type,
1612
1617
ynl_attr_put_u32 (nlh , ETHTOOL_A_BITSET_SIZE , obj -> size );
1613
1618
if (obj -> _present .bits )
1614
1619
ethtool_bitset_bits_put (nlh , ETHTOOL_A_BITSET_BITS , & obj -> bits );
1620
+ if (obj -> _present .value_len )
1621
+ ynl_attr_put (nlh , ETHTOOL_A_BITSET_VALUE , obj -> value , obj -> _present .value_len );
1622
+ if (obj -> _present .mask_len )
1623
+ ynl_attr_put (nlh , ETHTOOL_A_BITSET_MASK , obj -> mask , obj -> _present .mask_len );
1615
1624
ynl_attr_nest_end (nlh , nest );
1616
1625
1617
1626
return 0 ;
@@ -1647,6 +1656,26 @@ int ethtool_bitset_parse(struct ynl_parse_arg *yarg,
1647
1656
parg .data = & dst -> bits ;
1648
1657
if (ethtool_bitset_bits_parse (& parg , attr ))
1649
1658
return YNL_PARSE_CB_ERROR ;
1659
+ } else if (type == ETHTOOL_A_BITSET_VALUE ) {
1660
+ unsigned int len ;
1661
+
1662
+ if (ynl_attr_validate (yarg , attr ))
1663
+ return YNL_PARSE_CB_ERROR ;
1664
+
1665
+ len = ynl_attr_data_len (attr );
1666
+ dst -> _present .value_len = len ;
1667
+ dst -> value = malloc (len );
1668
+ memcpy (dst -> value , ynl_attr_data (attr ), len );
1669
+ } else if (type == ETHTOOL_A_BITSET_MASK ) {
1670
+ unsigned int len ;
1671
+
1672
+ if (ynl_attr_validate (yarg , attr ))
1673
+ return YNL_PARSE_CB_ERROR ;
1674
+
1675
+ len = ynl_attr_data_len (attr );
1676
+ dst -> _present .mask_len = len ;
1677
+ dst -> mask = malloc (len );
1678
+ memcpy (dst -> mask , ynl_attr_data (attr ), len );
1650
1679
}
1651
1680
}
1652
1681
@@ -7038,6 +7067,17 @@ ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req)
7038
7067
return NULL ;
7039
7068
}
7040
7069
7070
+ /* ETHTOOL_MSG_PHY_GET - notify */
7071
+ void ethtool_phy_get_ntf_free (struct ethtool_phy_get_ntf * rsp )
7072
+ {
7073
+ ethtool_header_free (& rsp -> obj .header );
7074
+ free (rsp -> obj .drvname );
7075
+ free (rsp -> obj .name );
7076
+ free (rsp -> obj .upstream_sfp_name );
7077
+ free (rsp -> obj .downstream_sfp_name );
7078
+ free (rsp );
7079
+ }
7080
+
7041
7081
/* ETHTOOL_MSG_CABLE_TEST_NTF - event */
7042
7082
int ethtool_cable_test_ntf_rsp_parse (const struct nlmsghdr * nlh ,
7043
7083
struct ynl_parse_arg * yarg )
@@ -7299,6 +7339,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = {
7299
7339
.policy = & ethtool_module_fw_flash_nest ,
7300
7340
.free = (void * )ethtool_module_fw_flash_ntf_free ,
7301
7341
},
7342
+ [ETHTOOL_MSG_PHY_NTF ] = {
7343
+ .alloc_sz = sizeof (struct ethtool_phy_get_ntf ),
7344
+ .cb = ethtool_phy_get_rsp_parse ,
7345
+ .policy = & ethtool_phy_nest ,
7346
+ .free = (void * )ethtool_phy_get_ntf_free ,
7347
+ },
7302
7348
};
7303
7349
7304
7350
const struct ynl_family ynl_ethtool_family = {
0 commit comments