4 [ -n "$TARGET_CC_NOCACHE" ] && CC
="$TARGET_CC_NOCACHE"
7 #include <linux/ethtool.h>
9 #define ETHTOOL_MODE_FULL(_speed, _mode) { \\
12 .bit_full = ETHTOOL_LINK_MODE_ ## _speed ## base ## _mode ## _Full_BIT, \\
13 .name = #_speed "base" #_mode, \\
16 #define ETHTOOL_MODE_HALF(_speed, _mode) { \\
18 .bit_half = ETHTOOL_LINK_MODE_ ## _speed ## base ## _mode ## _Half_BIT, \\
20 .name = #_speed "base" #_mode, \\
23 #define ETHTOOL_MODE_BOTH(_speed, _mode) { \\
25 .bit_half = ETHTOOL_LINK_MODE_ ## _speed ## base ## _mode ## _Half_BIT, \\
26 .bit_full = ETHTOOL_LINK_MODE_ ## _speed ## base ## _mode ## _Full_BIT, \\
27 .name = #_speed "base" #_mode, \\
38 echo "#include <linux/ethtool.h>" |
"$CC" -E - | \
39 grep "ETHTOOL_LINK_MODE_[0-9]*base[A-Za-z0-9]*_...._BIT.*" | \
40 sed -r 's/.*ETHTOOL_LINK_MODE_([0-9]*)base([A-Za-z0-9]*)_(....)_BIT.*/\1 \2 \3/' | \
41 sort -u | LC_ALL
=C
sort -r -g |
( gothalf
=0 ; while read -r speed mode duplex
; do
42 if [ "$duplex" = "Half" ]; then
43 if [ "$gothalf" = "1" ]; then
44 printf "%s" "$speed \tETHTOOL_MODE_HALF($p_speed, $p_mode),\n"
47 elif [ "$duplex" = "Full" ]; then
48 if [ "$gothalf" = "1" ]; then
49 if [ "$p_speed" = "$speed" ] && [ "$p_mode" = "$mode" ]; then
50 printf "%d \t%s\n" "$speed" "ETHTOOL_MODE_BOTH($speed, $mode),"
52 printf "%d \t%s\n" "$p_speed" "ETHTOOL_MODE_HALF($p_speed, $p_mode),"
53 printf "%d \t%s\n" "$speed" "ETHTOOL_MODE_FULL($speed, $mode),"
57 printf "%d \t%s\n" "$speed" "ETHTOOL_MODE_FULL($speed, $mode),"
64 done ; [ "$gothalf" = "1" ] && printf "%d \t%s\n" "$p_speed" "ETHTOOL_MODE_HALF($p_speed, $p_mode)," ) | \
65 LC_ALL
=C
sort -g |
sed -r 's/[0-9]* (.*)/\1/'