Skip to content

Commit b8cec4a

Browse files
committed
Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-merge
2 parents 5e2b61f + e44d8fe commit b8cec4a

24 files changed

Lines changed: 1634 additions & 1232 deletions

‎net/batman-adv/aggregation.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
3535
int packet_len,
3636
unsigned long send_time,
3737
bool directlink,
38-
struct batman_if *if_incoming,
38+
struct hard_iface *if_incoming,
3939
struct forw_packet *forw_packet)
4040
{
4141
struct batman_packet *batman_packet =
@@ -99,7 +99,7 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
9999
/* create a new aggregated packet and add this packet to it */
100100
static void new_aggregated_packet(unsigned char *packet_buff, int packet_len,
101101
unsigned long send_time, bool direct_link,
102-
struct batman_if *if_incoming,
102+
struct hard_iface *if_incoming,
103103
int own_packet)
104104
{
105105
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -188,7 +188,7 @@ static void aggregate(struct forw_packet *forw_packet_aggr,
188188

189189
void add_bat_packet_to_list(struct bat_priv *bat_priv,
190190
unsigned char *packet_buff, int packet_len,
191-
struct batman_if *if_incoming, char own_packet,
191+
struct hard_iface *if_incoming, char own_packet,
192192
unsigned long send_time)
193193
{
194194
/**
@@ -247,7 +247,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
247247

248248
/* unpack the aggregated packets and process them one by one */
249249
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
250-
int packet_len, struct batman_if *if_incoming)
250+
int packet_len, struct hard_iface *if_incoming)
251251
{
252252
struct batman_packet *batman_packet;
253253
int buff_pos = 0;

‎net/batman-adv/aggregation.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna)
3535

3636
void add_bat_packet_to_list(struct bat_priv *bat_priv,
3737
unsigned char *packet_buff, int packet_len,
38-
struct batman_if *if_incoming, char own_packet,
38+
struct hard_iface *if_incoming, char own_packet,
3939
unsigned long send_time);
4040
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
41-
int packet_len, struct batman_if *if_incoming);
41+
int packet_len, struct hard_iface *if_incoming);
4242

4343
#endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */

‎net/batman-adv/bat_sysfs.c‎

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -441,16 +441,16 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
441441
char *buff)
442442
{
443443
struct net_device *net_dev = kobj_to_netdev(kobj);
444-
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
444+
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
445445
ssize_t length;
446446

447-
if (!batman_if)
447+
if (!hard_iface)
448448
return 0;
449449

450-
length = sprintf(buff, "%s\n", batman_if->if_status == IF_NOT_IN_USE ?
451-
"none" : batman_if->soft_iface->name);
450+
length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
451+
"none" : hard_iface->soft_iface->name);
452452

453-
kref_put(&batman_if->refcount, hardif_free_ref);
453+
hardif_free_ref(hard_iface);
454454

455455
return length;
456456
}
@@ -459,11 +459,11 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
459459
char *buff, size_t count)
460460
{
461461
struct net_device *net_dev = kobj_to_netdev(kobj);
462-
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
462+
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
463463
int status_tmp = -1;
464-
int ret;
464+
int ret = count;
465465

466-
if (!batman_if)
466+
if (!hard_iface)
467467
return count;
468468

469469
if (buff[count - 1] == '\n')
@@ -472,7 +472,7 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
472472
if (strlen(buff) >= IFNAMSIZ) {
473473
pr_err("Invalid parameter for 'mesh_iface' setting received: "
474474
"interface name too long '%s'\n", buff);
475-
kref_put(&batman_if->refcount, hardif_free_ref);
475+
hardif_free_ref(hard_iface);
476476
return -EINVAL;
477477
}
478478

@@ -481,44 +481,45 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
481481
else
482482
status_tmp = IF_I_WANT_YOU;
483483

484-
if ((batman_if->if_status == status_tmp) || ((batman_if->soft_iface) &&
485-
(strncmp(batman_if->soft_iface->name, buff, IFNAMSIZ) == 0))) {
486-
kref_put(&batman_if->refcount, hardif_free_ref);
487-
return count;
488-
}
484+
if (hard_iface->if_status == status_tmp)
485+
goto out;
486+
487+
if ((hard_iface->soft_iface) &&
488+
(strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0))
489+
goto out;
489490

490491
if (status_tmp == IF_NOT_IN_USE) {
491492
rtnl_lock();
492-
hardif_disable_interface(batman_if);
493+
hardif_disable_interface(hard_iface);
493494
rtnl_unlock();
494-
kref_put(&batman_if->refcount, hardif_free_ref);
495-
return count;
495+
goto out;
496496
}
497497

498498
/* if the interface already is in use */
499-
if (batman_if->if_status != IF_NOT_IN_USE) {
499+
if (hard_iface->if_status != IF_NOT_IN_USE) {
500500
rtnl_lock();
501-
hardif_disable_interface(batman_if);
501+
hardif_disable_interface(hard_iface);
502502
rtnl_unlock();
503503
}
504504

505-
ret = hardif_enable_interface(batman_if, buff);
506-
kref_put(&batman_if->refcount, hardif_free_ref);
505+
ret = hardif_enable_interface(hard_iface, buff);
507506

507+
out:
508+
hardif_free_ref(hard_iface);
508509
return ret;
509510
}
510511

511512
static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
512513
char *buff)
513514
{
514515
struct net_device *net_dev = kobj_to_netdev(kobj);
515-
struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
516+
struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
516517
ssize_t length;
517518

518-
if (!batman_if)
519+
if (!hard_iface)
519520
return 0;
520521

521-
switch (batman_if->if_status) {
522+
switch (hard_iface->if_status) {
522523
case IF_TO_BE_REMOVED:
523524
length = sprintf(buff, "disabling\n");
524525
break;
@@ -537,7 +538,7 @@ static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
537538
break;
538539
}
539540

540-
kref_put(&batman_if->refcount, hardif_free_ref);
541+
hardif_free_ref(hard_iface);
541542

542543
return length;
543544
}

0 commit comments

Comments
 (0)