@@ -60,6 +60,7 @@ static const char * const ethtool_op_strmap[] = {
6060 [43 ] = "mm-ntf" ,
6161 [44 ] = "module-fw-flash-ntf" ,
6262 [ETHTOOL_MSG_PHY_GET ] = "phy-get" ,
63+ [46 ] = "phy-ntf" ,
6364};
6465
6566const char * ethtool_op_str (int op )
@@ -341,6 +342,8 @@ const struct ynl_policy_attr ethtool_bitset_policy[ETHTOOL_A_BITSET_MAX + 1] = {
341342 [ETHTOOL_A_BITSET_NOMASK ] = { .name = "nomask" , .type = YNL_PT_FLAG , },
342343 [ETHTOOL_A_BITSET_SIZE ] = { .name = "size" , .type = YNL_PT_U32 , },
343344 [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 ,},
344347};
345348
346349const struct ynl_policy_nest ethtool_bitset_nest = {
@@ -1598,6 +1601,8 @@ int ethtool_strings_parse(struct ynl_parse_arg *yarg,
15981601void ethtool_bitset_free (struct ethtool_bitset * obj )
15991602{
16001603 ethtool_bitset_bits_free (& obj -> bits );
1604+ free (obj -> value );
1605+ free (obj -> mask );
16011606}
16021607
16031608int 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,
16121617 ynl_attr_put_u32 (nlh , ETHTOOL_A_BITSET_SIZE , obj -> size );
16131618 if (obj -> _present .bits )
16141619 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 );
16151624 ynl_attr_nest_end (nlh , nest );
16161625
16171626 return 0 ;
@@ -1647,6 +1656,26 @@ int ethtool_bitset_parse(struct ynl_parse_arg *yarg,
16471656 parg .data = & dst -> bits ;
16481657 if (ethtool_bitset_bits_parse (& parg , attr ))
16491658 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 );
16501679 }
16511680 }
16521681
@@ -7038,6 +7067,17 @@ ethtool_phy_get_dump(struct ynl_sock *ys, struct ethtool_phy_get_req_dump *req)
70387067 return NULL ;
70397068}
70407069
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+
70417081/* ETHTOOL_MSG_CABLE_TEST_NTF - event */
70427082int ethtool_cable_test_ntf_rsp_parse (const struct nlmsghdr * nlh ,
70437083 struct ynl_parse_arg * yarg )
@@ -7299,6 +7339,12 @@ static const struct ynl_ntf_info ethtool_ntf_info[] = {
72997339 .policy = & ethtool_module_fw_flash_nest ,
73007340 .free = (void * )ethtool_module_fw_flash_ntf_free ,
73017341 },
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+ },
73027348};
73037349
73047350const struct ynl_family ynl_ethtool_family = {
0 commit comments