コード例 #1
0
ファイル: eib_main.c プロジェクト: apprisi/illumos-gate
/*ARGSUSED*/
static void
eib_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
    mac_prop_info_handle_t prh)
{
	switch (pr_num) {
	case MAC_PROP_DUPLEX:
	case MAC_PROP_SPEED:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		break;

	case MAC_PROP_MTU:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_range_uint32(prh, ETHERMTU, ETHERMTU);
		break;

	case MAC_PROP_PRIVATE:
		if (strcmp(pr_name, EIB_DLPROP_GW_EPORT_STATE) == 0) {
			mac_prop_info_set_default_str(prh, "up ");
			mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		} else if (strcmp(pr_name, EIB_DLPROP_HCA_GUID) == 0) {
			mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		} else if (strcmp(pr_name, EIB_DLPROP_PORT_GUID) == 0) {
			mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		}
		break;
	}
}
コード例 #2
0
ファイル: oce_gld.c プロジェクト: apprisi/illumos-gate
void
oce_m_propinfo(void *arg, const char *name, mac_prop_id_t pr_num,
    mac_prop_info_handle_t prh)
{
	_NOTE(ARGUNUSED(arg));

	switch (pr_num) {
	case MAC_PROP_AUTONEG:
	case MAC_PROP_EN_AUTONEG:
	case MAC_PROP_ADV_1000FDX_CAP:
	case MAC_PROP_EN_1000FDX_CAP:
	case MAC_PROP_ADV_1000HDX_CAP:
	case MAC_PROP_EN_1000HDX_CAP:
	case MAC_PROP_ADV_100FDX_CAP:
	case MAC_PROP_EN_100FDX_CAP:
	case MAC_PROP_ADV_100HDX_CAP:
	case MAC_PROP_EN_100HDX_CAP:
	case MAC_PROP_ADV_10FDX_CAP:
	case MAC_PROP_EN_10FDX_CAP:
	case MAC_PROP_ADV_10HDX_CAP:
	case MAC_PROP_EN_10HDX_CAP:
	case MAC_PROP_ADV_100T4_CAP:
	case MAC_PROP_EN_100T4_CAP:
	case MAC_PROP_ADV_10GFDX_CAP:
	case MAC_PROP_EN_10GFDX_CAP:
	case MAC_PROP_SPEED:
	case MAC_PROP_DUPLEX:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		break;

	case MAC_PROP_MTU:
		mac_prop_info_set_range_uint32(prh, OCE_MIN_MTU, OCE_MAX_MTU);
		break;

	case MAC_PROP_PRIVATE: {
		char valstr[64];
		int value;

		if (strcmp(name, "_tx_ring_size") == 0) {
			value = OCE_DEFAULT_TX_RING_SIZE;
		} else if (strcmp(name, "_rx_ring_size") == 0) {
			value = OCE_DEFAULT_RX_RING_SIZE;
		} else {
			return;
		}

		(void) snprintf(valstr, sizeof (valstr), "%d", value);
		mac_prop_info_set_default_str(prh, valstr);
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		break;
	}
	}
} /* oce_m_propinfo */
コード例 #3
0
ファイル: i40e_gld.c プロジェクト: bahamas10/openzfs
/* ARGSUSED */
static void
i40e_m_propinfo_private(i40e_t *i40e, const char *pr_name,
    mac_prop_info_handle_t prh)
{
	char buf[64];
	uint32_t def;

	if (strcmp(pr_name, I40E_PROP_RX_DMA_THRESH) == 0) {
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_RW);
		def = I40E_DEF_RX_DMA_THRESH;
		mac_prop_info_set_range_uint32(prh,
		    I40E_MIN_RX_DMA_THRESH,
		    I40E_MAX_RX_DMA_THRESH);
	} else if (strcmp(pr_name, I40E_PROP_TX_DMA_THRESH) == 0) {
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_RW);
		def = I40E_DEF_TX_DMA_THRESH;
		mac_prop_info_set_range_uint32(prh,
		    I40E_MIN_TX_DMA_THRESH,
		    I40E_MAX_TX_DMA_THRESH);
	} else if (strcmp(pr_name, I40E_PROP_RX_ITR) == 0) {
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_RW);
		def = I40E_DEF_RX_ITR;
		mac_prop_info_set_range_uint32(prh, I40E_MIN_ITR, I40E_MAX_ITR);
	} else if (strcmp(pr_name, I40E_PROP_TX_ITR) == 0) {
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_RW);
		def = I40E_DEF_TX_ITR;
		mac_prop_info_set_range_uint32(prh, I40E_MIN_ITR, I40E_MAX_ITR);
	} else if (strcmp(pr_name, I40E_PROP_OTHER_ITR) == 0) {
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_RW);
		def = I40E_DEF_OTHER_ITR;
		mac_prop_info_set_range_uint32(prh, I40E_MIN_ITR, I40E_MAX_ITR);
	} else {
		return;
	}

	(void) snprintf(buf, sizeof (buf), "%d", def);
	mac_prop_info_set_default_str(prh, buf);
}
コード例 #4
0
static void
virtionet_priv_propinfo(virtionet_state_t *sp, const char *pname,
	mac_prop_info_handle_t ph)
{
	mac_prop_info_set_perm(ph, MAC_PROP_PERM_READ);
	if ((strcmp(pname, VIRTIONET_PROP_FEATURES) == 0) ||
	    (strcmp(pname, VIRTIONET_PROP_RECVQSIZE) == 0) ||
	    (strcmp(pname, VIRTIONET_PROP_XMITQSIZE) == 0) ||
	    (strcmp(pname, VIRTIONET_PROP_CTRLQSIZE) == 0)) {
		mac_prop_info_set_default_str(ph, "0x0");
	} else {
		cmn_err(CE_NOTE, "Unexpected private property %s",
		    pname);
	}
}
コード例 #5
0
static void
virtionet_propinfo(void *arg, const char *pname, mac_prop_id_t pid,
	mac_prop_info_handle_t ph)
{
	virtionet_state_t	*sp = arg;

	switch (pid) {
	case MAC_PROP_DUPLEX:
	case MAC_PROP_SPEED:
	case MAC_PROP_STATUS:
		mac_prop_info_set_perm(ph, MAC_PROP_PERM_READ);
		break;
	case MAC_PROP_PRIVATE:
		virtionet_priv_propinfo(sp, pname, ph);
		break;
	default:
		/* Do we need to do anything in this case ? */
		;
	}
}
コード例 #6
0
ファイル: i40e_gld.c プロジェクト: bahamas10/openzfs
static void
i40e_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
    mac_prop_info_handle_t prh)
{
	i40e_t *i40e = arg;

	mutex_enter(&i40e->i40e_general_lock);

	switch (pr_num) {
	case MAC_PROP_DUPLEX:
	case MAC_PROP_SPEED:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		break;
	case MAC_PROP_FLOWCTRL:
		/*
		 * At the moment, the driver doesn't support flow control, hence
		 * why this is set to read-only and none.
		 */
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_link_flowctrl(prh,
		    LINK_FLOWCTRL_NONE);
		break;
	case MAC_PROP_MTU:
		mac_prop_info_set_range_uint32(prh, I40E_MIN_MTU, I40E_MAX_MTU);
		break;

	/*
	 * We set the defaults for these based upon the phy's ability to
	 * support the speeds. Note, auto-negotiation is required for fiber,
	 * hence it is read-only and always enabled. When we have access to
	 * copper phys we can revisit this.
	 */
	case MAC_PROP_AUTONEG:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh, 1);
		break;
	case MAC_PROP_ADV_100FDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_100MB) != 0);
		break;
	case MAC_PROP_EN_100FDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_100MB) != 0);
		break;
	case MAC_PROP_ADV_1000FDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_1GB) != 0);
		break;
	case MAC_PROP_EN_1000FDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_1GB) != 0);
		break;
	case MAC_PROP_ADV_10GFDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_10GB) != 0);
		break;
	case MAC_PROP_EN_10GFDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_10GB) != 0);
		break;
	case MAC_PROP_ADV_40GFDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_40GB) != 0);
		break;
	case MAC_PROP_EN_40GFDX_CAP:
		mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
		mac_prop_info_set_default_uint8(prh,
		    (i40e->i40e_phy.link_speed & I40E_LINK_SPEED_40GB) != 0);
		break;
	case MAC_PROP_PRIVATE:
		i40e_m_propinfo_private(i40e, pr_name, prh);
		break;
	default:
		break;
	}

	mutex_exit(&i40e->i40e_general_lock);
}