Example #1
0
static void rmnet_late_resume(struct early_suspend *handler) {
	if (rmnet0) {
		struct rmnet_private *p = netdev_priv(to_net_dev(rmnet0));
		p->timeout_us = timeout_us;
	}
}
Example #2
0
static ssize_t wakeups_rcv_show(struct device *d, struct device_attribute *attr,
		char *buf)
{
	struct rmnet_private *p = netdev_priv(to_net_dev(d));
	return sprintf(buf, "%lu\n", p->wakeups_rcv);
}
Example #3
0
/**
 * lbs_mesh_get - Get function for sysfs attribute mesh
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t lbs_mesh_get(struct device *dev,
		struct device_attribute *attr, char * buf)
{
	struct lbs_private *priv = to_net_dev(dev)->ml_priv;
	return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev);
}
Example #4
0
static const void *macvtap_net_namespace(struct device *d)
{
	struct net_device *dev = to_net_dev(d->parent);
	return dev_net(dev);
}
Example #5
0
static struct net_device *batadv_kobj_to_netdev(struct kobject *obj)
{
	struct device *dev = container_of(obj->parent, struct device, kobj);
	return to_net_dev(dev);
}
Example #6
0
/* Show total radio awake time in ms */
static ssize_t awake_time_show(struct device *d, struct device_attribute *attr,
				char *buf)
{
	struct mxnet_private *p = netdev_priv(to_net_dev(d));
	return sprintf(buf, "%lu\n", p->awake_time_ms);
}
/*
 * empirically even if tallies are defined as 32 bits entities, only
 * high 16 bits are relevant; low half is always zero. It means tallies
 * are pretty much useless for traffic counting but at least give overview
 * about where error come from
 */
static ssize_t show_tallies(struct device *d, struct device_attribute *attr,
			    char *buf)
{
    struct net_device *dev = to_net_dev(d);
    struct wl_private *lp = wl_priv(dev);
    unsigned long flags;
    CFG_HERMES_TALLIES_STRCT tallies;
    ssize_t ret = -EINVAL;

    rcu_read_lock();
    if (dev_isalive(dev)) {
	wl_lock(lp, &flags);

	ret = wl_get_tallies(lp, &tallies);
	if (ret == 0) {
		wl_unlock(lp, &flags);
		ret = snprintf(buf, PAGE_SIZE,
		    "TxUnicastFrames:           %u\n"
		    "TxMulticastFrames:         %u\n"
		    "TxFragments:               %u\n"
		    "TxUnicastOctets:           %u\n"
		    "TxMulticastOctets:         %u\n"
		    "TxDeferredTransmissions:   %u\n"
		    "TxSingleRetryFrames:       %u\n"
		    "TxMultipleRetryFrames:     %u\n"
		    "TxRetryLimitExceeded:      %u\n"
		    "TxDiscards:                %u\n"
		    "RxUnicastFrames:           %u\n"
		    "RxMulticastFrames:         %u\n"
		    "RxFragments:               %u\n"
		    "RxUnicastOctets:           %u\n"
		    "RxMulticastOctets:         %u\n"
		    "RxFCSErrors:               %u\n"
		    "RxDiscardsNoBuffer:        %u\n"
		    "TxDiscardsWrongSA:         %u\n"
		    "RxWEPUndecryptable:        %u\n"
		    "RxMsgInMsgFragments:       %u\n"
		    "RxMsgInBadMsgFragments:    %u\n"
		    "RxDiscardsWEPICVError:     %u\n"
		    "RxDiscardsWEPExcluded:     %u\n"
		    ,
		    (unsigned int)tallies.TxUnicastFrames,
		    (unsigned int)tallies.TxMulticastFrames,
		    (unsigned int)tallies.TxFragments,
		    (unsigned int)tallies.TxUnicastOctets,
		    (unsigned int)tallies.TxMulticastOctets,
		    (unsigned int)tallies.TxDeferredTransmissions,
		    (unsigned int)tallies.TxSingleRetryFrames,
		    (unsigned int)tallies.TxMultipleRetryFrames,
		    (unsigned int)tallies.TxRetryLimitExceeded,
		    (unsigned int)tallies.TxDiscards,
		    (unsigned int)tallies.RxUnicastFrames,
		    (unsigned int)tallies.RxMulticastFrames,
		    (unsigned int)tallies.RxFragments,
		    (unsigned int)tallies.RxUnicastOctets,
		    (unsigned int)tallies.RxMulticastOctets,
		    (unsigned int)tallies.RxFCSErrors,
		    (unsigned int)tallies.RxDiscardsNoBuffer,
		    (unsigned int)tallies.TxDiscardsWrongSA,
		    (unsigned int)tallies.RxWEPUndecryptable,
		    (unsigned int)tallies.RxMsgInMsgFragments,
		    (unsigned int)tallies.RxMsgInBadMsgFragments,
		    (unsigned int)tallies.RxDiscardsWEPICVError,
		    (unsigned int)tallies.RxDiscardsWEPExcluded);
	    } else {
		wl_unlock( lp, &flags );
	    }
    }

    rcu_read_unlock();
    return ret;
}