Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c54a4570 authored by David S. Miller's avatar David S. Miller
Browse files
parents 61d57f87 701b259f
Loading
Loading
Loading
Loading
+22 −14
Original line number Original line Diff line number Diff line
@@ -151,17 +151,18 @@ void bpf_jit_compile(struct sk_filter *fp)
	cleanup_addr = proglen; /* epilogue address */
	cleanup_addr = proglen; /* epilogue address */


	for (pass = 0; pass < 10; pass++) {
	for (pass = 0; pass < 10; pass++) {
		u8 seen_or_pass0 = (pass == 0) ? (SEEN_XREG | SEEN_DATAREF | SEEN_MEM) : seen;
		/* no prologue/epilogue for trivial filters (RET something) */
		/* no prologue/epilogue for trivial filters (RET something) */
		proglen = 0;
		proglen = 0;
		prog = temp;
		prog = temp;


		if (seen) {
		if (seen_or_pass0) {
			EMIT4(0x55, 0x48, 0x89, 0xe5); /* push %rbp; mov %rsp,%rbp */
			EMIT4(0x55, 0x48, 0x89, 0xe5); /* push %rbp; mov %rsp,%rbp */
			EMIT4(0x48, 0x83, 0xec, 96);	/* subq  $96,%rsp	*/
			EMIT4(0x48, 0x83, 0xec, 96);	/* subq  $96,%rsp	*/
			/* note : must save %rbx in case bpf_error is hit */
			/* note : must save %rbx in case bpf_error is hit */
			if (seen & (SEEN_XREG | SEEN_DATAREF))
			if (seen_or_pass0 & (SEEN_XREG | SEEN_DATAREF))
				EMIT4(0x48, 0x89, 0x5d, 0xf8); /* mov %rbx, -8(%rbp) */
				EMIT4(0x48, 0x89, 0x5d, 0xf8); /* mov %rbx, -8(%rbp) */
			if (seen & SEEN_XREG)
			if (seen_or_pass0 & SEEN_XREG)
				CLEAR_X(); /* make sure we dont leek kernel memory */
				CLEAR_X(); /* make sure we dont leek kernel memory */


			/*
			/*
@@ -170,7 +171,7 @@ void bpf_jit_compile(struct sk_filter *fp)
			 *  r9 = skb->len - skb->data_len
			 *  r9 = skb->len - skb->data_len
			 *  r8 = skb->data
			 *  r8 = skb->data
			 */
			 */
			if (seen & SEEN_DATAREF) {
			if (seen_or_pass0 & SEEN_DATAREF) {
				if (offsetof(struct sk_buff, len) <= 127)
				if (offsetof(struct sk_buff, len) <= 127)
					/* mov    off8(%rdi),%r9d */
					/* mov    off8(%rdi),%r9d */
					EMIT4(0x44, 0x8b, 0x4f, offsetof(struct sk_buff, len));
					EMIT4(0x44, 0x8b, 0x4f, offsetof(struct sk_buff, len));
@@ -260,9 +261,14 @@ void bpf_jit_compile(struct sk_filter *fp)
			case BPF_S_ALU_DIV_X: /* A /= X; */
			case BPF_S_ALU_DIV_X: /* A /= X; */
				seen |= SEEN_XREG;
				seen |= SEEN_XREG;
				EMIT2(0x85, 0xdb);	/* test %ebx,%ebx */
				EMIT2(0x85, 0xdb);	/* test %ebx,%ebx */
				if (pc_ret0 != -1)
				if (pc_ret0 > 0) {
					EMIT_COND_JMP(X86_JE, addrs[pc_ret0] - (addrs[i] - 4));
					/* addrs[pc_ret0 - 1] is start address of target
				else {
					 * (addrs[i] - 4) is the address following this jmp
					 * ("xor %edx,%edx; div %ebx" being 4 bytes long)
					 */
					EMIT_COND_JMP(X86_JE, addrs[pc_ret0 - 1] -
								(addrs[i] - 4));
				} else {
					EMIT_COND_JMP(X86_JNE, 2 + 5);
					EMIT_COND_JMP(X86_JNE, 2 + 5);
					CLEAR_A();
					CLEAR_A();
					EMIT1_off32(0xe9, cleanup_addr - (addrs[i] - 4)); /* jmp .+off32 */
					EMIT1_off32(0xe9, cleanup_addr - (addrs[i] - 4)); /* jmp .+off32 */
@@ -335,12 +341,12 @@ void bpf_jit_compile(struct sk_filter *fp)
				}
				}
				/* fallinto */
				/* fallinto */
			case BPF_S_RET_A:
			case BPF_S_RET_A:
				if (seen) {
				if (seen_or_pass0) {
					if (i != flen - 1) {
					if (i != flen - 1) {
						EMIT_JMP(cleanup_addr - addrs[i]);
						EMIT_JMP(cleanup_addr - addrs[i]);
						break;
						break;
					}
					}
					if (seen & SEEN_XREG)
					if (seen_or_pass0 & SEEN_XREG)
						EMIT4(0x48, 0x8b, 0x5d, 0xf8);  /* mov  -8(%rbp),%rbx */
						EMIT4(0x48, 0x8b, 0x5d, 0xf8);  /* mov  -8(%rbp),%rbx */
					EMIT1(0xc9);		/* leaveq */
					EMIT1(0xc9);		/* leaveq */
				}
				}
@@ -483,8 +489,9 @@ common_load: seen |= SEEN_DATAREF;
				goto common_load;
				goto common_load;
			case BPF_S_LDX_B_MSH:
			case BPF_S_LDX_B_MSH:
				if ((int)K < 0) {
				if ((int)K < 0) {
					if (pc_ret0 != -1) {
					if (pc_ret0 > 0) {
						EMIT_JMP(addrs[pc_ret0] - addrs[i]);
						/* addrs[pc_ret0 - 1] is the start address */
						EMIT_JMP(addrs[pc_ret0 - 1] - addrs[i]);
						break;
						break;
					}
					}
					CLEAR_A();
					CLEAR_A();
@@ -599,13 +606,14 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
		 * use it to give the cleanup instruction(s) addr
		 * use it to give the cleanup instruction(s) addr
		 */
		 */
		cleanup_addr = proglen - 1; /* ret */
		cleanup_addr = proglen - 1; /* ret */
		if (seen)
		if (seen_or_pass0)
			cleanup_addr -= 1; /* leaveq */
			cleanup_addr -= 1; /* leaveq */
		if (seen & SEEN_XREG)
		if (seen_or_pass0 & SEEN_XREG)
			cleanup_addr -= 4; /* mov  -8(%rbp),%rbx */
			cleanup_addr -= 4; /* mov  -8(%rbp),%rbx */


		if (image) {
		if (image) {
			WARN_ON(proglen != oldproglen);
			if (proglen != oldproglen)
				pr_err("bpb_jit_compile proglen=%u != oldproglen=%u\n", proglen, oldproglen);
			break;
			break;
		}
		}
		if (proglen == oldproglen) {
		if (proglen == oldproglen) {
+9 −18
Original line number Original line Diff line number Diff line
@@ -909,16 +909,12 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
	}
	}
}
}


/* hw is a boolean parameter that determines whether we should try and
static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
 * set the hw address of the device as well as the hw address of the
 * net_device
 */
static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
{
{
	struct net_device *dev = slave->dev;
	struct net_device *dev = slave->dev;
	struct sockaddr s_addr;
	struct sockaddr s_addr;


	if (!hw) {
	if (slave->bond->params.mode == BOND_MODE_TLB) {
		memcpy(dev->dev_addr, addr, dev->addr_len);
		memcpy(dev->dev_addr, addr, dev->addr_len);
		return 0;
		return 0;
	}
	}
@@ -948,8 +944,8 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct
	u8 tmp_mac_addr[ETH_ALEN];
	u8 tmp_mac_addr[ETH_ALEN];


	memcpy(tmp_mac_addr, slave1->dev->dev_addr, ETH_ALEN);
	memcpy(tmp_mac_addr, slave1->dev->dev_addr, ETH_ALEN);
	alb_set_slave_mac_addr(slave1, slave2->dev->dev_addr, bond->alb_info.rlb_enabled);
	alb_set_slave_mac_addr(slave1, slave2->dev->dev_addr);
	alb_set_slave_mac_addr(slave2, tmp_mac_addr, bond->alb_info.rlb_enabled);
	alb_set_slave_mac_addr(slave2, tmp_mac_addr);


}
}


@@ -1096,8 +1092,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav


		/* Try setting slave mac to bond address and fall-through
		/* Try setting slave mac to bond address and fall-through
		   to code handling that situation below... */
		   to code handling that situation below... */
		alb_set_slave_mac_addr(slave, bond->dev->dev_addr,
		alb_set_slave_mac_addr(slave, bond->dev->dev_addr);
				       bond->alb_info.rlb_enabled);
	}
	}


	/* The slave's address is equal to the address of the bond.
	/* The slave's address is equal to the address of the bond.
@@ -1133,8 +1128,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
	}
	}


	if (free_mac_slave) {
	if (free_mac_slave) {
		alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
		alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr);
				       bond->alb_info.rlb_enabled);


		pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
		pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
			   bond->dev->name, slave->dev->name,
			   bond->dev->name, slave->dev->name,
@@ -1491,8 +1485,7 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
{
{
	int res;
	int res;


	res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr,
	res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr);
				     bond->alb_info.rlb_enabled);
	if (res) {
	if (res) {
		return res;
		return res;
	}
	}
@@ -1643,8 +1636,7 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
		alb_swap_mac_addr(bond, swap_slave, new_slave);
		alb_swap_mac_addr(bond, swap_slave, new_slave);
	} else {
	} else {
		/* set the new_slave to the bond mac address */
		/* set the new_slave to the bond mac address */
		alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr,
		alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr);
				       bond->alb_info.rlb_enabled);
	}
	}


	if (swap_slave) {
	if (swap_slave) {
@@ -1704,8 +1696,7 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
		alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
		alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
		alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
		alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
	} else {
	} else {
		alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr,
		alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr);
				       bond->alb_info.rlb_enabled);


		read_lock(&bond->lock);
		read_lock(&bond->lock);
		alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
		alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
+1 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
 */
 */


#include <linux/list.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/phy.h>
#include <net/dsa.h>
#include <net/dsa.h>
+18 −4
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
 */
 */


#include <linux/list.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/phy.h>
#include <net/dsa.h>
#include <net/dsa.h>
@@ -20,12 +21,25 @@ static char *mv88e6123_61_65_probe(struct mii_bus *bus, int sw_addr)


	ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03);
	ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03);
	if (ret >= 0) {
	if (ret >= 0) {
		ret &= 0xfff0;
		if (ret == 0x1212)
		if (ret == 0x1210)
			return "Marvell 88E6123 (A1)";
		if (ret == 0x1213)
			return "Marvell 88E6123 (A2)";
		if ((ret & 0xfff0) == 0x1210)
			return "Marvell 88E6123";
			return "Marvell 88E6123";
		if (ret == 0x1610)

		if (ret == 0x1612)
			return "Marvell 88E6161 (A1)";
		if (ret == 0x1613)
			return "Marvell 88E6161 (A2)";
		if ((ret & 0xfff0) == 0x1610)
			return "Marvell 88E6161";
			return "Marvell 88E6161";
		if (ret == 0x1650)

		if (ret == 0x1652)
			return "Marvell 88E6165 (A1)";
		if (ret == 0x1653)
			return "Marvell 88e6165 (A2)";
		if ((ret & 0xfff0) == 0x1650)
			return "Marvell 88E6165";
			return "Marvell 88E6165";
	}
	}


+1 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
 */
 */


#include <linux/list.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/phy.h>
#include <net/dsa.h>
#include <net/dsa.h>
Loading